From 2ef400aefd9d1f1eedfe85616354b8cd94fe31b6 Mon Sep 17 00:00:00 2001 From: "Ahron Greenberg (agree)" <37550360+greenbea@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:39:47 -0500 Subject: [PATCH 01/55] validate domain before change (#7244) --- core/domains/domains.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/domains/domains.php b/core/domains/domains.php index 03940e5432..c059ebc34b 100644 --- a/core/domains/domains.php +++ b/core/domains/domains.php @@ -44,8 +44,6 @@ //update the domain session variables $domain_uuid = $_GET["domain_uuid"]; - $_SESSION["previous_domain_uuid"] = $_SESSION['domain_uuid']; - $_SESSION['domain_uuid'] = $domain_uuid; //get the domain details $sql = "select * from v_domains "; @@ -58,7 +56,14 @@ } unset($sql, $domains); + //validate the domain change + if (empty($_SESSION['domains'][$domain_uuid])) { + die("invalid domain"); + } + //update the domain session variables + $_SESSION["previous_domain_uuid"] = $_SESSION['domain_uuid']; + $_SESSION['domain_uuid'] = $domain_uuid; $_SESSION["domain_name"] = $_SESSION['domains'][$domain_uuid]['domain_name']; $_SESSION['domain']['template']['name'] = $_SESSION['domains'][$domain_uuid]['template_name'] ?? null; $_SESSION["context"] = $_SESSION["domain_name"]; From 3603711d77c156e179319b1f514b40677f6f8a84 Mon Sep 17 00:00:00 2001 From: "Ahron Greenberg (agree)" <37550360+greenbea@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:41:25 -0500 Subject: [PATCH 02/55] fix destination_condition_field gets overwritten by default setting (#7242) --- app/destinations/destination_edit.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 1508e4e240..bdcae911f5 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -462,7 +462,6 @@ } //authorized specific dialplan_detail_type that are safe, sanitize all other values - $dialplan_detail_type = $settings->get('dialplan', 'destination', ''); switch ($dialplan_detail_type) { case 'destination_number': break; From cd5ed73602a6902fc92ca9b6704f3f0525a2d3c2 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 11 Feb 2025 13:26:32 -0700 Subject: [PATCH 03/55] Allow # and * in the sanitized caller ID --- app/xml_cdr/resources/classes/xml_cdr.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 2ae2501ea6..f6f5029897 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -645,8 +645,8 @@ if (!class_exists('xml_cdr')) { $domain_uuid = urldecode($xml->variables->domain_uuid); //sanitize the caller ID - $caller_id_name = preg_replace('#[^a-zA-Z 0-9\-\.]#', '', $caller_id_name); - $caller_id_number = preg_replace('#[^0-9\-]#', '', $caller_id_number); + $caller_id_name = preg_replace('#[^a-zA-Z 0-9\-\.\#\*]#', '', $caller_id_name); + $caller_id_number = preg_replace('#[^0-9\-\#\*]#', '', $caller_id_number); //misc $this->array[$key][0]['ring_group_uuid'] = urldecode($xml->variables->ring_group_uuid); From 5b1697fc17049b4ff9c30bc8c89d84542b3d2bb9 Mon Sep 17 00:00:00 2001 From: fusionate Date: Tue, 11 Feb 2025 18:02:16 -0700 Subject: [PATCH 04/55] Menu - Fixed: Change to submenu item links to hopefully resolve random submenu closure on click bug. --- resources/classes/menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/classes/menu.php b/resources/classes/menu.php index 5def1ec9de..80f5718fc7 100644 --- a/resources/classes/menu.php +++ b/resources/classes/menu.php @@ -1049,7 +1049,7 @@ if (!class_exists('menu')) { $menu_sub_icon = null; } } - $html .= " \n"; + $html .= " \n"; if ($columns > 1 && $column_current == 1 && ($index_sub+1) > (ceil(@sizeof($menu_parent['menu_items'])/2)-1)) { $html .= " \n"; $html .= " \n"; From 5c9eeb19565e53afef3b75167856cf76e1015847 Mon Sep 17 00:00:00 2001 From: frytimo Date: Thu, 13 Feb 2025 12:09:34 -0400 Subject: [PATCH 05/55] Remove Extra Line Ending (#7253) --- app/call_block/resources/dashboard/config.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/call_block/resources/dashboard/config.php b/app/call_block/resources/dashboard/config.php index 96bd82114e..fa7d3b2657 100644 --- a/app/call_block/resources/dashboard/config.php +++ b/app/call_block/resources/dashboard/config.php @@ -45,4 +45,3 @@ $array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user'; $y++; ?> - From 0a5c377ae6b8502aa8a179da1b1996c53c2f8142 Mon Sep 17 00:00:00 2001 From: frytimo Date: Thu, 13 Feb 2025 12:09:52 -0400 Subject: [PATCH 06/55] Remove Extra Line Ending (#7252) --- app/number_translations/app_defaults.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/number_translations/app_defaults.php b/app/number_translations/app_defaults.php index 782d0ac654..3ccd87b9fe 100644 --- a/app/number_translations/app_defaults.php +++ b/app/number_translations/app_defaults.php @@ -74,4 +74,3 @@ } ?> - From 0cf387f306d78beb9d9b53cbb747b251ad985d28 Mon Sep 17 00:00:00 2001 From: frytimo Date: Thu, 13 Feb 2025 12:10:33 -0400 Subject: [PATCH 07/55] do not save event_guard logs to transactions (#7254) Event Guard already has a log table so no need to duplicate the transactions in another table --- app/event_guard/resources/service/event_guard.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/event_guard/resources/service/event_guard.php b/app/event_guard/resources/service/event_guard.php index b916d578df..e7c8db7090 100644 --- a/app/event_guard/resources/service/event_guard.php +++ b/app/event_guard/resources/service/event_guard.php @@ -233,7 +233,7 @@ $p->add('event_guard_log_edit', 'temp'); $database->app_name = 'event guard'; $database->app_uuid = 'c5b86612-1514-40cb-8e2c-3f01a8f6f637'; - $database->save($array); + $database->save($array, false); //$message = $database->message; $p->delete('event_guard_log_edit', 'temp'); unset($array); @@ -353,7 +353,7 @@ $p->add('event_guard_log_add', 'temp'); $database->app_name = 'event guard'; $database->app_uuid = 'c5b86612-1514-40cb-8e2c-3f01a8f6f637'; - $database->save($array); + $database->save($array, false); $p->delete('event_guard_log_add', 'temp'); //send debug information to the console From 68e3b4c1870c0ed3c18a493891e8a93931eca2df Mon Sep 17 00:00:00 2001 From: fusionate Date: Thu, 13 Feb 2025 11:56:07 -0700 Subject: [PATCH 08/55] Fax - New: Add cover_message, cover_message_height Default Settings to define a default Message and the height of the message box on the cover page, respectively. --- app/fax/app_config.php | 20 ++++++++++++++++++-- app/fax/fax_send.php | 22 ++++++++++++++-------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/app/fax/app_config.php b/app/fax/app_config.php index db9727586e..75f64f9b62 100644 --- a/app/fax/app_config.php +++ b/app/fax/app_config.php @@ -312,7 +312,23 @@ $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; $apps[$x]['default_settings'][$y]['default_setting_value'] = "The information contained in this facsimile is intended for the sole confidential use of the recipient(s) designated above, and may contain confidential and legally privileged information. If you are not the intended recipient, you are hereby notified that the review, disclosure, dissemination, distribution, copying, duplication in any form, and taking of any action in regards to the contents of this document - except with respect to its direct delivery to the intended recipient - is strictly prohibited. Please notify the sender immediately and destroy this cover sheet and all attachments. If stored or viewed electronically, please permanently delete it from your system."; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "Notice displayed in the footer of the cover sheet."; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Default text to populate the Footer field of a new fax (displayed below the box on the cover sheet)."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "034a7f00-9455-4354-978e-7978d193f675"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "fax"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "cover_message"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = ""; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Default text to populate the Message field of a new fax (displayed inside the box on the cover sheet)."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "760eb1ec-249a-4482-bdc4-3fd35d604db9"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "fax"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "cover_message_height"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "6.15"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the default height (inches) of the Message box on the cover sheet."; $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "e907df99-6b3a-4864-bd11-681888f20289"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "fax"; @@ -320,7 +336,7 @@ $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; $apps[$x]['default_settings'][$y]['default_setting_value'] = ""; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "Default information displayed beneath the logo in the header of the cover sheet."; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Default text to populate the Header field of a new fax (displayed near the top of the cover sheet, beneath the logo)."; $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "8338a404-3966-416e-b4f9-a1ac36c37bd1"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "fax"; diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index fff0a9d60f..9b1fc3650d 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -433,7 +433,7 @@ if (!function_exists('fax_split_dtmf')) { if (in_array($logo_fileext, ['gif','jpg','jpeg','png','bmp'])) { if (file_exists($logo_dirname.'/'.$logo_filename)) { $logo = $logo_dirname.'/'.$logo_filename; - $display_logo = true; + $display_logo = true; } else { $raw = file_get_contents($logo); @@ -568,7 +568,13 @@ if (!function_exists('fax_split_dtmf')) { unset($yn); } else { - $pdf->Rect($x + 0.5, $y + 3.4, 7.5, 6.25, 'D'); + //determine cover message box height, and difference, to adjust footer position accordingly + $cover_message_height = $setting->get('fax','cover_message_height'); + $cover_message_height = (float) ($cover_message_height ?? 6.15); + $height_difference = 6.15 - $cover_message_height; + + // draw message box + $pdf->Rect($x + 0.5, $y + 3.4, 7.5, $cover_message_height, 'D'); $y = $pdf->GetY(); } @@ -577,7 +583,7 @@ if (!function_exists('fax_split_dtmf')) { $pdf->SetAutoPageBreak(true, 0.6); $pdf->SetTopMargin(0.6); $pdf->SetFont("helvetica", "", 8); - $pdf->SetXY($x + 0.5, $y + 0.6); + $pdf->SetXY($x + 0.5, $y + 0.6 - (float) ($height_difference ?? 0)); $pdf->MultiCell(7.5, 0.75, $fax_footer, 0, 'C', false); } $pdf->SetAutoPageBreak(false); @@ -669,7 +675,7 @@ if (!function_exists('fax_split_dtmf')) { } exit; } - + //prepare variables send the fax $mail_from_address = (!empty($setting->get('fax','smtp_from'))) ? $setting->get('fax','smtp_from') : $setting->get('email','smtp_from'); @@ -940,7 +946,7 @@ if (!defined('STDIN')) { } if (is_array($contact_labels)) { //sort by name(s) - asort($contact_labels, SORT_NATURAL); + asort($contact_labels, SORT_NATURAL); } } @@ -1015,7 +1021,7 @@ if (!defined('STDIN')) { echo "\n"; echo $text['description-2']." ".(permission_exists('fax_extension_view_domain') ? $text['description-3'] : null)."\n"; echo "

\n"; - + if ($domain_enabled == false) { echo "
".$text['notice-sending-disabled']."
\n"; } @@ -1160,7 +1166,7 @@ if (!defined('STDIN')) { echo " ".$text['label-fax-message']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo " ".$text['description-fax-message']."\n"; echo "\n"; @@ -1220,4 +1226,4 @@ function showgrid($pdf) { } } */ -?> +?> \ No newline at end of file From 056ddc93ca69ec0a194aac44ab75972504090099 Mon Sep 17 00:00:00 2001 From: frytimo Date: Thu, 13 Feb 2025 17:09:03 -0400 Subject: [PATCH 09/55] remove the automatic setting of server connection port in provisioning (#7243) * remove the automatic setting of the server connection port in provisioning --- app/provision/resources/classes/provision.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index bd6cc5ea71..53acb6ae90 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -802,20 +802,11 @@ //set the variables $line_number = $row['line_number']; $register_expires = $row['register_expires']; - $sip_transport = strtolower($row['sip_transport']); - $sip_port = $row['sip_port']; + $sip_transport = strtolower($row['sip_transport'] ?? 'tcp'); + $sip_port = $row['sip_port'] ?? '5060'; //set defaults if (empty($register_expires)) { $register_expires = "120"; } - if (empty($sip_transport)) { $sip_transport = "tcp"; } - if (!isset($sip_port)) { - if ($line_number == "" || $line_number == "1") { - $sip_port = "5060"; - } - else { - $sip_port = "506".($line_number + 1); - } - } //convert seconds to minutes for grandstream if ($device_vendor == 'grandstream') { From f03803f1138d189a9ec44f89c7215982cd5583cd Mon Sep 17 00:00:00 2001 From: frytimo Date: Thu, 13 Feb 2025 17:12:48 -0400 Subject: [PATCH 10/55] use settings object where possible (#7246) * use settings object where possible * use $user_uuid instead of $_SESSION['user_uuid'] * use extension_uuid when counting for performance --- app/extensions/extension_edit.php | 195 ++++++++++++++++++------------ 1 file changed, 117 insertions(+), 78 deletions(-) diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index ae596f2bfc..0bddf373df 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -38,13 +38,56 @@ exit; } -//initialize the database object - $database = database::new(); +//get the domain and user UUIDs + $domain_uuid = $domain_uuid ?? ''; + $user_uuid = $user_uuid ?? ''; //add multi-lingual support $language = new text; $text = $language->get(); +//initialize the core objects + $domain_uuid = $_SESSION['domain_uuid'] ?? ''; + $user_uuid = $_SESSION['user_uuid'] ?? ''; + $config = config::load(); + $database = database::new(['config' => $config]); + $domain_name = $database->select('select domain_name from v_domains where domain_uuid = :domain_uuid', ['domain_uuid' => $domain_uuid], 'column'); + $settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid, 'user_uuid' => $user_uuid]); + +//set defaults + $limit_extensions = $settings->get('limit', 'extensions', null); + $limit_devices = $settings->get('limit', 'devices', null); + $extension_limit_max = $settings->get('extension', 'limit_max', 5); + $extension_call_timeout = $settings->get('extension', 'call_timeout', 30); + $extension_max_registrations = $settings->get('extension', 'max_registrations', null); + $extension_password_length = $settings->get('extension', 'password_length', 20); //set default to 20 + $extension_password_strength = $settings->get('extension', 'password_strength', 4); //set default to use numbers, Upper/Lowercase letters, special characters + $extension_user_record_default = $settings->get('extension', 'user_record_default', ''); + $provision_path = $settings->get('provision', 'path', ''); + $provision_line_label = $settings->get('provision','line_label', null); + $provision_line_display_name = $settings->get('provision','line_display_name', null); + $provision_outbound_proxy_primary = $settings->get('provision','outbound_proxy_primary', null); + $provision_outbound_proxy_secondary = $settings->get('provision','outbound_proxy_primary', null); + $provision_server_address_primary = $settings->get('provision','outbound_proxy_primary', null); + $provision_server_address_secondary = $settings->get('provision','outbound_proxy_primary', null); + $provision_line_sip_port = $settings->get('provision','line_sip_port', null); + $provision_line_sip_transport = $settings->get('provision','line_sip_transport', null); + $provision_line_register_expires = $settings->get('provision','line_register_expires', null); + $theme_input_toggle_style = $settings->get('theme','input_toggle_style', ''); //set default to empty string + $voicemail_password_length = $settings->get('voicemail', 'password_length', 6); //set default to 6 + $voicemail_transcription_enabled_default = $settings->get('voicemail', 'transcription_enabled_default', false); //set default to false + $voicemail_enabled_default = $settings->get('voicemail', 'enabled_default', true); + $switch_voicemail = $settings->get('switch', 'voicemail', '/var/lib/freeswitch/storage/voicemail') . "/default/$domain_name"; + $switch_extensions = $settings->get('switch', 'extensions', '/etc/freeswitch/directory'); + $switch_sounds = $settings->get('switch', 'sounds', '/usr/share/freeswitch/sounds'); + $transcribe_enabled = $settings->get('transcribe', 'enabled', false); + +//cast to integers if they have values + if ($limit_extensions !== null) $limit_extensions = intval($limit_extensions); + if ($limit_devices !== null) $limit_devices = intval($limit_devices); + if ($extension_password_length !== null) $extension_password_length = intval($extension_password_length); + if ($extension_max_registrations !== null) $extension_max_registrations = intval($extension_max_registrations); + //set the action as an add or an update if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; @@ -57,16 +100,16 @@ //get total extension count from the database, check limit, if defined if ($action == 'add') { - if (!empty($_SESSION['limit']['extensions']['numeric'])) { - $sql = "select count(*) "; + if ($limit_extensions > 0) { + $sql = "select count(extension_uuid) "; $sql .= "from v_extensions "; $sql .= "where domain_uuid = :domain_uuid "; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $parameters['domain_uuid'] = $domain_uuid; $total_extensions = $database->select($sql, $parameters, 'column'); unset($sql, $parameters); - if ($total_extensions >= $_SESSION['limit']['extensions']['numeric']) { - message::add($text['message-maximum_extensions'].' '.$_SESSION['limit']['extensions']['numeric'], 'negative'); + if ($total_extensions >= $limit_extensions) { + message::add($text['message-maximum_extensions'].' '.$limit_extensions, 'negative'); header('Location: extensions.php'.(isset($page) && is_numeric($page) ? '?page='.$page : null)); exit; } @@ -176,14 +219,14 @@ $user_uuid = $_POST["extension_users"][0]["user_uuid"] ?? null; //device provisioning variables - if (is_array($_POST["devices"]) && @sizeof($_POST["devices"]) != 0) { + if (!empty($_POST["devices"])) { //get the devices $sql = "select count(device_uuid) from v_devices "; $sql .= "where domain_uuid = :domain_uuid "; if (!permission_exists('device_all') && !permission_exists('device_domain_all')) { $sql .= "and device_user_uuid = :user_uuid "; - $parameters['user_uuid'] = $_SESSION['user_uuid']; + $parameters['user_uuid'] = $user_uuid; } $sql .= "order by device_address asc "; $parameters['domain_uuid'] = $domain_uuid; @@ -195,8 +238,8 @@ !empty($device["device_address"]) && strtolower($device["device_address"]) == 'uuid' && ( - !isset($_SESSION['limit']['devices']['numeric']) || - $total_devices < $_SESSION['limit']['devices']['numeric'] + $limit_devices === null || + $total_devices < $limit_devices )) { $device_address = strtolower(uuid()); } @@ -229,7 +272,7 @@ $parameters['device_address'] = $device_address; $row = $database->select($sql, $parameters, 'row'); if (is_array($row)) { - if ($_SESSION['domain_uuid'] == $row['domain_uuid']) { + if ($domain_uuid == $row['domain_uuid']) { $device_uuid = $row['device_uuid']; $device_domain_name = $row['device_domain_name']; $device_unique = true; @@ -314,7 +357,7 @@ $domain_uuid = $_POST["domain_uuid"]; } else { - $domain_uuid = $_SESSION['domain_uuid']; + $domain_uuid = $domain_uuid; } //validate the token @@ -345,10 +388,8 @@ } //prevent users from bypassing extension limit by using range - if (!empty($_SESSION['limit']['extensions']['numeric'])) { - if (isset($total_extensions) && ($total_extensions ?? 0) + $range > $_SESSION['limit']['extensions']['numeric']) { - $range = $_SESSION['limit']['extensions']['numeric'] - $total_extensions; - } + if (isset($total_extensions) && ($total_extensions ?? 0) + $range > $limit_extensions) { + $range = $limit_extensions - $total_extensions; } //add or update the database @@ -416,8 +457,8 @@ } //get the password length and strength - $password_length = $_SESSION["extension"]["password_length"]["numeric"]; - $password_strength = $_SESSION["extension"]["password_strength"]["numeric"]; + $password_length = $extension_password_length; + $password_strength = $extension_password_strength; //extension does not exist add it if ($action == "add" || $range > 1) { @@ -428,7 +469,7 @@ //prepare the values for mwi account if (!empty($mwi_account) && strpos($mwi_account, '@') === false) { - $mwi_account .= "@".$_SESSION['domain_name']; + $mwi_account .= "@".$domain_name; } //generate a password @@ -492,7 +533,7 @@ } else { if ($action == "add") { - $array["extensions"][$i]["max_registrations"] = $_SESSION['extension']['max_registrations']['numeric']; + $array["extensions"][$i]["max_registrations"] = $extension_max_registrations; } } if (permission_exists("extension_limit")) { @@ -504,7 +545,7 @@ } else { if ($action == "add") { - $array["extensions"][$i]["user_context"] = $_SESSION['domain_name']; + $array["extensions"][$i]["user_context"] = $domain_name; } } if (permission_exists('extension_missed_call')) { @@ -605,11 +646,11 @@ } //get the dislplay label - if ($_SESSION['provision']['line_label']['text'] == 'auto') { + if ($provision_line_label == 'auto') { $line_label = $extension; } else { - $line_label = $_SESSION['provision']['line_label']['text']; + $line_label = $provision_line_label; $line_label = str_replace("\${name}", $name, $line_label); $line_label = str_replace("\${effective_caller_id_name}", $effective_caller_id_name, $line_label); $line_label = str_replace("\${caller_id_name}", $effective_caller_id_name, $line_label); @@ -622,11 +663,11 @@ } //get the dislplay name - if ($_SESSION['provision']['line_display_name']['text'] == 'auto') { + if ($provision_line_display_name == 'auto') { $line_display_name = $name; } else { - $line_display_name = $_SESSION['provision']['line_display_name']['text']; + $line_display_name = $provision_line_display_name; $line_display_name = str_replace("\${name}", $name, $line_display_name); $line_display_name = str_replace("\${effective_caller_id_name}", $effective_caller_id_name, $line_display_name); $line_display_name = str_replace("\${caller_id_name}", $effective_caller_id_name, $line_display_name); @@ -640,14 +681,14 @@ //send a message to the user the device is not unique if (!$device_unique) { - $message = $text['message-duplicate'].(if_group("superadmin") && $_SESSION["domain_name"] != $device_domain_name ? ": ".$device_domain_name : null); + $message = $text['message-duplicate'].(if_group("superadmin") && $domain_name != $device_domain_name ? ": ".$device_domain_name : null); message::add($message,'negative'); } //build the devices array if ($device_unique && $device_address != '000000000000') { $array["devices"][$j]["device_uuid"] = $device_uuids[$d]; - $array["devices"][$j]["domain_uuid"] = $_SESSION['domain_uuid']; + $array["devices"][$j]["domain_uuid"] = $domain_uuid; $array["devices"][$j]["device_address"] = $device_address; $array["devices"][$j]["device_label"] = $extension; if (!empty($device_vendor)) { @@ -659,21 +700,21 @@ $array["devices"][$j]["device_enabled"] = "true"; $array["devices"][$j]["device_lines"][0]["device_uuid"] = $device_uuids[$d]; $array["devices"][$j]["device_lines"][0]["device_line_uuid"] = uuid(); - $array["devices"][$j]["device_lines"][0]["domain_uuid"] = $_SESSION['domain_uuid']; - $array["devices"][$j]["device_lines"][0]["server_address"] = $_SESSION['domain_name']; - $array["devices"][$j]["device_lines"][0]["outbound_proxy_primary"] = $_SESSION['provision']['outbound_proxy_primary']['text']; - $array["devices"][$j]["device_lines"][0]["outbound_proxy_secondary"] = $_SESSION['provision']['outbound_proxy_secondary']['text']; - $array["devices"][$j]["device_lines"][0]["server_address_primary"] = $_SESSION['provision']['server_address_primary']['text']; - $array["devices"][$j]["device_lines"][0]["server_address_secondary"] = $_SESSION['provision']['server_address_secondary']['text']; + $array["devices"][$j]["device_lines"][0]["domain_uuid"] = $domain_uuid; + $array["devices"][$j]["device_lines"][0]["server_address"] = $domain_name; + if ($provision_outbound_proxy_primary !== null) $array["devices"][$j]["device_lines"][0]["outbound_proxy_primary"] = $provision_outbound_proxy_primary; + if ($provision_outbound_proxy_secondary !== null) $array["devices"][$j]["device_lines"][0]["outbound_proxy_secondary"] = $provision_outbound_proxy_secondary; + if ($provision_server_address_primary !== null) $array["devices"][$j]["device_lines"][0]["server_address_primary"] = $provision_server_address_primary; + if ($provision_server_address_secondary !== null) $array["devices"][$j]["device_lines"][0]["server_address_secondary"] = $provision_server_address_secondary; $array["devices"][$j]["device_lines"][0]["label"] = $line_label; $array["devices"][$j]["device_lines"][0]["display_name"] = $line_display_name; $array["devices"][$j]["device_lines"][0]["user_id"] = $extension; $array["devices"][$j]["device_lines"][0]["auth_id"] = $extension; $array["devices"][$j]["device_lines"][0]["password"] = $password; $array["devices"][$j]["device_lines"][0]["line_number"] = is_numeric($line_numbers[$d]) ? $line_numbers[$d] : '1'; - $array["devices"][$j]["device_lines"][0]["sip_port"] = $_SESSION['provision']['line_sip_port']['text']; - $array["devices"][$j]["device_lines"][0]["sip_transport"] = $_SESSION['provision']['line_sip_transport']['text']; - $array["devices"][$j]["device_lines"][0]["register_expires"] = $_SESSION['provision']['line_register_expires']['text']; + if ($provision_line_sip_port !== null) $array["devices"][$j]["device_lines"][0]["sip_port"] = $provision_line_sip_port; + if ($provision_line_sip_transport !== null) $array["devices"][$j]["device_lines"][0]["sip_transport"] = $provision_line_sip_transport; + if ($provision_line_register_expires !== null) $array["devices"][$j]["device_lines"][0]["register_expires"] = $provision_line_register_expires; $array["devices"][$j]["device_lines"][0]["enabled"] = "true"; } @@ -689,7 +730,7 @@ if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) { //set the voicemail password if (empty($voicemail_password)) { - $voicemail_password = generate_password($_SESSION['voicemail']['password_length']['numeric'], 1); + $voicemail_password = generate_password($voicemail_password_length, 1); } //add the voicemail to the array @@ -711,8 +752,8 @@ $voicemail_uuid = uuid(); $voicemail_tutorial = 'true'; //if adding a mailbox and don't have the transcription permission, set the default transcribe behavior - if (!permission_exists('voicemail_transcription_enabled') && isset($_SESSION['voicemail']['transcription_enabled_default']['boolean'])) { - $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; + if (!permission_exists('voicemail_transcription_enabled')) { + $voicemail_transcription_enabled = $voicemail_transcription_enabled_default; } } @@ -738,8 +779,8 @@ $array["voicemails"][$i]["voicemail_description"] = $description; //make sure the voicemail directory exists - if (!file_exists($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id)) { - mkdir($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id, 0770, true); + if (!file_exists($switch_voicemail.'/'.$voicemail_id)) { + mkdir($switch_voicemail."/".$voicemail_id, 0770, true); } } @@ -772,8 +813,8 @@ $sql .= "and server_address = :server_address "; $sql .= "and user_id = :user_id "; $parameters['password'] = $password; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $parameters['server_address'] = $_SESSION['domain_name']; + $parameters['domain_uuid'] = $domain_uuid; + $parameters['server_address'] = $domain_name; $parameters['user_id'] = $extension; $database->execute($sql, $parameters); unset($sql, $parameters); @@ -786,7 +827,7 @@ $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and device_key_value = :device_key_value "; $parameters['device_key_label'] = $effective_caller_id_name; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $parameters['domain_uuid'] = $domain_uuid; $parameters['device_key_value'] = $extension; $database->execute($sql, $parameters); unset($sql, $parameters); @@ -808,7 +849,7 @@ if (permission_exists('extension_add') || permission_exists('extension_edit')) { //synchronize configuration - if (!empty($_SESSION['switch']['extensions']['dir']) && is_writable($_SESSION['switch']['extensions']['dir'])) { + if (is_writable($switch_extensions)) { require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); @@ -816,12 +857,10 @@ } //write the provision files - if (!empty($_SESSION['provision']['path']['text'])) { - if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) { - $prov = new provision; - $prov->domain_uuid = $domain_uuid; - $response = $prov->write(); - } + if (!empty($provision_path) && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) { + $prov = new provision; + $prov->domain_uuid = $domain_uuid; + $response = $prov->write(); } //clear the cache @@ -942,8 +981,8 @@ } else { - $voicemail_file = $_SESSION['voicemail']['voicemail_file']['text']; - $voicemail_local_after_email = $_SESSION['voicemail']['keep_local']['boolean']; + $voicemail_file = $settings->get('voicemail', 'voicemail_file', 'attach'); + $voicemail_local_after_email = $settings->get('voicemail','keep_local', true); } //get the device lines @@ -966,7 +1005,7 @@ $sql .= "where domain_uuid = :domain_uuid "; if (!permission_exists('device_all') && !permission_exists('device_domain_all')) { $sql .= "and device_user_uuid = :user_uuid "; - $parameters['user_uuid'] = $_SESSION['user_uuid']; + $parameters['user_uuid'] = $user_uuid; } $sql .= "order by device_address asc "; $parameters['domain_uuid'] = $domain_uuid; @@ -1044,30 +1083,30 @@ $toll_allow = str_replace(':',',', $toll_allow ?? ''); //get installed languages - $language_paths = glob($_SESSION["switch"]['sounds']['dir']."/*/*/*"); + $language_paths = glob($switch_sounds."/*/*/*"); foreach ($language_paths as $key => $path) { - $path = str_replace($_SESSION["switch"]['sounds']['dir'].'/', "", $path); + $path = str_replace($switch_sounds.'/', "", $path); $path_array = explode('/', $path); if (count($path_array) <> 3 || strlen($path_array[0]) <> 2 || strlen($path_array[1]) <> 2) { unset($language_paths[$key]); } - $language_paths[$key] = str_replace($_SESSION["switch"]['sounds']['dir']."/","",$language_paths[$key] ?? ''); + $language_paths[$key] = str_replace($switch_sounds."/","",$language_paths[$key] ?? ''); if (empty($language_paths[$key])) { unset($language_paths[$key]); } } //set the defaults - if (empty($user_context)) { $user_context = $_SESSION['domain_name']; } - if (empty($max_registrations)) { $max_registrations = $_SESSION['extension']['max_registrations']['numeric'] ?? ''; } + if (empty($user_context)) { $user_context = $domain_name; } + if (empty($max_registrations)) { $max_registrations = $extension_max_registrations ?? ''; } if (empty($accountcode)) { $accountcode = get_accountcode(); } - if (empty($limit_max)) { $limit_max = $_SESSION['extension']['limit_max']['numeric'] ?? 5; } + if (empty($limit_max)) { $limit_max = $extension_limit_max; } if (empty($limit_destination)) { $limit_destination = '!USER_BUSY'; } - if (empty($call_timeout)) { $call_timeout = $_SESSION['extension']['call_timeout']['numeric'] ?? 30; } + if (empty($call_timeout)) { $call_timeout = $extension_call_timeout; } if (empty($call_screen_enabled)) { $call_screen_enabled = 'false'; } - if (empty($user_record)) { $user_record = $_SESSION['extension']['user_record_default']['text']; } - if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; } - if (empty($voicemail_enabled)) { $voicemail_enabled = $_SESSION['voicemail']['enabled_default']['boolean']; } + if (empty($user_record)) { $user_record = $extension_user_record_default; } + if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $voicemail_transcription_enabled_default; } + if (empty($voicemail_enabled)) { $voicemail_enabled = $voicemail_enabled_default; } if (empty($enabled)) { $enabled = 'true'; } //create token @@ -1132,7 +1171,7 @@ } echo "\n"; echo "
\n"; - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'extensions.php'.(isset($page) && is_numeric($page) ? '?page='.$page : null)]); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','link'=>'extensions.php'.(isset($page) && is_numeric($page) ? '?page='.$page : null)]); if ($action == 'update') { $button_margin = 'margin-left: 15px;'; if (permission_exists('xml_cdr_view')) { @@ -1144,14 +1183,14 @@ unset($button_margin); } if (permission_exists('extension_setting_view')) { - echo button::create(['type'=>'button','label'=>$text['button-settings'],'icon'=>$_SESSION['theme']['button_icon_settings'],'id'=>'btn_settings','style'=>'','link'=>PROJECT_PATH.'/app/extension_settings/extension_settings.php?id='.urlencode($extension_uuid)]); + echo button::create(['type'=>'button','label'=>$text['button-settings'],'icon'=>$settings->get('theme', 'button_icon_settings'),'id'=>'btn_settings','style'=>'','link'=>PROJECT_PATH.'/app/extension_settings/extension_settings.php?id='.urlencode($extension_uuid)]); } if (permission_exists('extension_copy')) { - echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','style'=>'margin-left: 15px;','onclick'=>"copy_extension();"]); + echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$settings->get('theme', 'button_icon_copy'),'id'=>'btn_copy','style'=>'margin-left: 15px;','onclick'=>"copy_extension();"]); } } - echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;','onclick'=>'submit_form();']); + echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$settings->get('theme', 'button_icon_save'),'id'=>'btn_save','style'=>'margin-left: 15px;','onclick'=>'submit_form();']); echo "
\n"; echo "
\n"; echo "\n"; @@ -1165,7 +1204,7 @@ echo "\n"; echo "\n"; if ($action == "add" || permission_exists("extension_extension")) { - echo " \n"; + echo " get('extension','extension_range','')."\">\n"; echo " \n"; //help defeat browser auto-fill echo "
\n"; echo $text['description-extension']."\n"; @@ -1270,7 +1309,7 @@ } echo " "; if ($action == "update") { - echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]); + echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add')]); } echo "
\n"; } @@ -1404,7 +1443,7 @@ } } } - if (permission_exists('device_address_uuid') && (!isset($_SESSION['limit']['devices']['numeric']) || $total_devices < $_SESSION['limit']['devices']['numeric'])) { + if (permission_exists('device_address_uuid') && ($limit_devices === null || $total_devices < $limit_devices)) { echo " \n"; echo " \n"; } @@ -1439,7 +1478,7 @@ echo " \n"; if (is_array($device_lines) && @sizeof($device_lines) != 0) { echo " \n"; - echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]); + echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add')]); echo " \n"; } echo " \n"; @@ -1788,7 +1827,7 @@ echo "\n"; echo "\n"; - if (permission_exists('voicemail_transcription_enabled') && ($_SESSION['transcribe']['enabled']['boolean'] ?? '') == "true") { + if (permission_exists('voicemail_transcription_enabled') && $transcribe_enabled) { echo "\n"; echo "\n"; echo " ".$text['label-voicemail_transcription_enabled']."\n"; @@ -1904,10 +1943,10 @@ echo " ".$text['label-call_group']."\n"; echo "\n"; echo "\n"; - if (!empty($_SESSION['call_group']['name']) && is_array($_SESSION['call_group']['name'])) { + if (!empty($settings->get('call_group', 'name')) && is_array($settings->get('call_group', 'name'))) { echo " \n"; echo " \n"; @@ -2311,7 +2350,7 @@ echo "\n"; echo ""; if (!permission_exists('extension_domain')) { - echo ""; + echo ""; } echo ""; echo ""; From 9b0eead911045aa7abab3cd4fd695d3795afacb1 Mon Sep 17 00:00:00 2001 From: frytimo Date: Thu, 13 Feb 2025 17:18:36 -0400 Subject: [PATCH 11/55] Fix incorrect name on disk usage chart (#7237) * fix incorrect name on disk usage chart * put correct information in disk usage for Linux and FreeBSD systems * Update system_disk_usage.php * Update system_disk_usage.php --- .../resources/dashboard/system_disk_usage.php | 167 +++++------------- 1 file changed, 47 insertions(+), 120 deletions(-) diff --git a/app/system/resources/dashboard/system_disk_usage.php b/app/system/resources/dashboard/system_disk_usage.php index 02135183ea..ada15830fd 100644 --- a/app/system/resources/dashboard/system_disk_usage.php +++ b/app/system/resources/dashboard/system_disk_usage.php @@ -21,8 +21,8 @@ echo "
\n"; $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; + $row_style['0'] = "row_style0"; + $row_style['1'] = "row_style1"; //disk usage if (PHP_OS == 'FreeBSD' || PHP_OS == 'Linux') { @@ -37,16 +37,16 @@ if (!empty($percent_disk_usage)) { //add half doughnut chart - echo "
\n"; + echo "
\n"; echo " ".$text['label-disk_usage']."\n"; if (!isset($dashboard_chart_type) || $dashboard_chart_type == "doughnut") { ?> -
+
\n"; ?> + diff --git a/app/devices/device_vendors.php b/app/devices/device_vendors.php index 9d4a24e75d..9aed554771 100644 --- a/app/devices/device_vendors.php +++ b/app/devices/device_vendors.php @@ -178,8 +178,12 @@ if (is_array($result) && @sizeof($result) != 0) { $x = 0; foreach($result as $row) { + $list_row_url = ''; if (permission_exists('device_vendor_edit')) { $list_row_url = "device_vendor_edit.php?id=".urlencode($row['device_vendor_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('device_vendor_edit') || permission_exists('device_vendor_delete')) { @@ -222,3 +226,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/devices/devices.php b/app/devices/devices.php index ec56e1a667..7c251692a5 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -397,8 +397,12 @@ } } + $list_row_url = ''; if (permission_exists('device_edit')) { $list_row_url = "device_edit.php?id=".urlencode($row['device_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } $device_provisioned_method = ''; @@ -473,3 +477,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/dialplans/dialplans.php b/app/dialplans/dialplans.php index 296b764c34..81c7f11b16 100644 --- a/app/dialplans/dialplans.php +++ b/app/dialplans/dialplans.php @@ -551,9 +551,13 @@ $x = 0; foreach ($dialplans as $row) { + $list_row_url = ''; if ($row['app_uuid'] == "4b821450-926b-175a-af93-a03c441818b1") { if (permission_exists('time_condition_edit') || permission_exists('dialplan_edit')) { $list_row_url = PROJECT_PATH."/app/time_conditions/time_condition_edit.php?id=".urlencode($row['dialplan_uuid']).(is_uuid($app_uuid) ? "&app_uuid=".urlencode($app_uuid) : null); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } } else if ( @@ -563,6 +567,9 @@ permission_exists('dialplan_edit') ) { $list_row_url = "dialplan_edit.php?id=".urlencode($row['dialplan_uuid']).(is_uuid($app_uuid) ? "&app_uuid=".urlencode($app_uuid) : null); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } else { unset($list_row_url); @@ -648,3 +655,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/email_queue/email_queue.php b/app/email_queue/email_queue.php index faa6abc0c8..13e1d92e8e 100644 --- a/app/email_queue/email_queue.php +++ b/app/email_queue/email_queue.php @@ -337,8 +337,12 @@ if (is_array($email_queue) && @sizeof($email_queue) != 0) { $x = 0; foreach ($email_queue as $row) { + $list_row_url = ''; if (permission_exists('email_queue_edit')) { $list_row_url = "email_queue_edit.php?id=".urlencode($row['email_queue_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('email_queue_add') || permission_exists('email_queue_edit') || permission_exists('email_queue_delete')) { diff --git a/app/email_templates/email_templates.php b/app/email_templates/email_templates.php index ae1b22216a..36ae8687f0 100644 --- a/app/email_templates/email_templates.php +++ b/app/email_templates/email_templates.php @@ -257,8 +257,12 @@ if (!empty($result)) { $x = 0; foreach($result as $row) { + $list_row_url = ''; if (permission_exists('email_template_edit')) { $list_row_url = "email_template_edit.php?id=".urlencode($row['email_template_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('email_template_add') || permission_exists('email_template_edit') || permission_exists('email_template_delete')) { @@ -323,3 +327,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/event_guard/event_guard_logs.php b/app/event_guard/event_guard_logs.php index 7e40486006..38dce4027f 100644 --- a/app/event_guard/event_guard_logs.php +++ b/app/event_guard/event_guard_logs.php @@ -244,8 +244,12 @@ if (is_array($event_guard_logs) && @sizeof($event_guard_logs) != 0) { $x = 0; foreach ($event_guard_logs as $row) { + $list_row_url = ''; if (permission_exists('event_guard_log_edit')) { $list_row_url = "event_guard_log_edit.php?id=".urlencode($row['event_guard_log_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('event_guard_log_add') || permission_exists('event_guard_log_edit') || permission_exists('event_guard_log_delete')) { diff --git a/app/extensions/extensions.php b/app/extensions/extensions.php index 12eb539b7d..fac86bdfb3 100644 --- a/app/extensions/extensions.php +++ b/app/extensions/extensions.php @@ -339,8 +339,12 @@ if (is_array($extensions) && @sizeof($extensions) != 0) { $x = 0; foreach($extensions as $row) { + $list_row_url = ''; if (permission_exists('extension_edit')) { $list_row_url = "extension_edit.php?id=".urlencode($row['extension_uuid']).(is_numeric($page) ? '&page='.urlencode($page) : null); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('extension_enabled') || permission_exists('extension_delete')) { @@ -447,3 +451,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/fax/fax.php b/app/fax/fax.php index f87e1e63df..125a7b1305 100644 --- a/app/fax/fax.php +++ b/app/fax/fax.php @@ -247,8 +247,12 @@ if (is_array($result) && @sizeof($result) != 0) { $x = 0; foreach ($result as $row) { + $list_row_url = ''; if (permission_exists('fax_extension_edit')) { $list_row_url = "fax_edit.php?id=".urlencode($row['fax_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('fax_extension_add') || permission_exists('fax_extension_delete')) { @@ -325,3 +329,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/fax_queue/fax_queue.php b/app/fax_queue/fax_queue.php index 1822255f86..5e51787f56 100644 --- a/app/fax_queue/fax_queue.php +++ b/app/fax_queue/fax_queue.php @@ -332,8 +332,12 @@ if (!empty($fax_queue)) { $x = 0; foreach ($fax_queue as $row) { + $list_row_url = ''; if ($permission['fax_queue_edit']) { $list_row_url = "fax_queue_edit.php?id=".urlencode($row['fax_queue_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if ($permission['fax_queue_add'] || $permission['fax_queue_edit'] || $permission['fax_queue_delete']) { diff --git a/app/fifo/fifo.php b/app/fifo/fifo.php index 898a333c82..54e50a05a0 100644 --- a/app/fifo/fifo.php +++ b/app/fifo/fifo.php @@ -264,6 +264,9 @@ foreach ($fifo as $row) { if (permission_exists('fifo_edit')) { $list_row_url = "fifo_edit.php?id=".urlencode($row['fifo_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('fifo_add') || permission_exists('fifo_edit') || permission_exists('fifo_delete')) { @@ -320,3 +323,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index cd6299c25f..06f3a7bcc7 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.php @@ -286,8 +286,12 @@ if (!empty($gateways)) { $x = 0; foreach($gateways as $row) { + $list_row_url = ''; if (permission_exists('gateway_edit')) { $list_row_url = "gateway_edit.php?id=".urlencode($row['gateway_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('gateway_add') || permission_exists('gateway_edit') || permission_exists('gateway_delete')) { @@ -391,3 +395,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/ivr_menus/ivr_menus.php b/app/ivr_menus/ivr_menus.php index 2c4968369d..287a2a66f5 100644 --- a/app/ivr_menus/ivr_menus.php +++ b/app/ivr_menus/ivr_menus.php @@ -236,8 +236,12 @@ if (!empty($ivr_menus)) { $x = 0; foreach($ivr_menus as $row) { + $list_row_url = ''; if (permission_exists('ivr_menu_edit')) { $list_row_url = "ivr_menu_edit.php?id=".urlencode($row['ivr_menu_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('ivr_menu_add') || permission_exists('ivr_menu_edit') || permission_exists('ivr_menu_delete')) { @@ -298,3 +302,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/modules/modules.php b/app/modules/modules.php index f2ec07b185..bb3a16a2dc 100644 --- a/app/modules/modules.php +++ b/app/modules/modules.php @@ -202,8 +202,12 @@ echo "\n"; write_header($row["module_category"]); } + $list_row_url = ''; if (permission_exists('module_edit')) { $list_row_url = "module_edit.php?id=".urlencode($row['module_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('module_edit') || permission_exists('module_delete')) { @@ -283,3 +287,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/number_translations/number_translations.php b/app/number_translations/number_translations.php index bc02e4fef8..3b58216bf3 100644 --- a/app/number_translations/number_translations.php +++ b/app/number_translations/number_translations.php @@ -225,8 +225,12 @@ if (!empty($number_translations)) { $x = 0; foreach ($number_translations as $row) { + $list_row_url = ''; if (permission_exists('number_translation_edit')) { $list_row_url = "number_translation_edit.php?id=".urlencode($row['number_translation_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('number_translation_add') || permission_exists('number_translation_edit') || permission_exists('number_translation_delete')) { @@ -276,3 +280,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/phrases/phrases.php b/app/phrases/phrases.php index e8b5bd16ab..0edd4f6559 100644 --- a/app/phrases/phrases.php +++ b/app/phrases/phrases.php @@ -211,8 +211,12 @@ if (is_array($phrases) && @sizeof($phrases) != 0) { $x = 0; foreach($phrases as $row) { + $list_row_url = ''; if (permission_exists('phrase_edit')) { $list_row_url = "phrase_edit.php?id=".urlencode($row['phrase_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('phrase_add') || permission_exists('phrase_edit') || permission_exists('phrase_delete')) { @@ -273,3 +277,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/pin_numbers/pin_numbers.php b/app/pin_numbers/pin_numbers.php index 1740c631a2..e7581cecf7 100644 --- a/app/pin_numbers/pin_numbers.php +++ b/app/pin_numbers/pin_numbers.php @@ -189,8 +189,12 @@ if (is_array($pin_numbers) && @sizeof($pin_numbers) != 0) { $x = 0; foreach ($pin_numbers as $row) { + $list_row_url = ''; if (permission_exists('pin_number_edit')) { $list_row_url = "pin_number_edit.php?id=".urlencode($row['pin_number_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('pin_number_add') || permission_exists('pin_number_edit') || permission_exists('pin_number_delete')) { @@ -241,3 +245,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php index b429120270..0a8f68b13b 100644 --- a/app/recordings/recordings.php +++ b/app/recordings/recordings.php @@ -529,8 +529,12 @@ echo "\n"; echo "\n"; // dummy row to maintain alternating background color } + $list_row_url = ''; if (permission_exists('recording_edit')) { $list_row_url = "recording_edit.php?id=".urlencode($row['recording_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('recording_delete')) { @@ -710,3 +714,4 @@ } ?> + diff --git a/app/ring_groups/ring_groups.php b/app/ring_groups/ring_groups.php index 59473180d1..f995d7cdf0 100644 --- a/app/ring_groups/ring_groups.php +++ b/app/ring_groups/ring_groups.php @@ -257,8 +257,12 @@ if (is_array($ring_groups) && @sizeof($ring_groups) != 0) { $x = 0; foreach ($ring_groups as $row) { + $list_row_url = ''; if (permission_exists('ring_group_edit')) { $list_row_url = "ring_group_edit.php?id=".urlencode($row['ring_group_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('ring_group_add') || permission_exists('ring_group_edit') || permission_exists('ring_group_delete')) { @@ -315,3 +319,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/sip_profiles/sip_profiles.php b/app/sip_profiles/sip_profiles.php index a18b92c5e5..956d0727ea 100644 --- a/app/sip_profiles/sip_profiles.php +++ b/app/sip_profiles/sip_profiles.php @@ -188,8 +188,12 @@ if (!empty($sip_profiles) && @sizeof($sip_profiles) != 0) { $x = 0; foreach ($sip_profiles as $row) { + $list_row_url = ''; if (permission_exists('sip_profile_edit')) { $list_row_url = "sip_profile_edit.php?id=".urlencode($row['sip_profile_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('sip_profile_add') || permission_exists('sip_profile_edit') || permission_exists('sip_profile_delete')) { @@ -239,3 +243,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/sip_status/sip_status.php b/app/sip_status/sip_status.php index 364023a108..5dfb85360e 100644 --- a/app/sip_status/sip_status.php +++ b/app/sip_status/sip_status.php @@ -331,3 +331,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/sofia_global_settings/sofia_global_settings.php b/app/sofia_global_settings/sofia_global_settings.php index deb31716d5..12a40fb1ec 100644 --- a/app/sofia_global_settings/sofia_global_settings.php +++ b/app/sofia_global_settings/sofia_global_settings.php @@ -209,8 +209,12 @@ if (!empty($sofia_global_settings) && @sizeof($sofia_global_settings) != 0) { $x = 0; foreach ($sofia_global_settings as $row) { + $list_row_url = ''; if (permission_exists('sofia_global_setting_edit')) { $list_row_url = "sofia_global_setting_edit.php?id=".urlencode($row['sofia_global_setting_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('sofia_global_setting_add') || permission_exists('sofia_global_setting_edit') || permission_exists('sofia_global_setting_delete')) { @@ -261,3 +265,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/streams/streams.php b/app/streams/streams.php index 5b872b764a..c065cad90b 100644 --- a/app/streams/streams.php +++ b/app/streams/streams.php @@ -248,8 +248,12 @@ if (!empty($streams)) { $x = 0; foreach ($streams as $row) { + $list_row_url = ''; if (permission_exists('stream_edit')) { $list_row_url = "stream_edit.php?id=".urlencode($row['stream_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('stream_add') || permission_exists('stream_edit') || permission_exists('stream_delete')) { @@ -315,3 +319,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/time_conditions/time_conditions.php b/app/time_conditions/time_conditions.php index 63c826305e..6f5eede525 100644 --- a/app/time_conditions/time_conditions.php +++ b/app/time_conditions/time_conditions.php @@ -218,8 +218,12 @@ if (is_array($dialplans) && @sizeof($dialplans) != 0) { $x = 0; foreach ($dialplans as $row) { + $list_row_url = ''; if (permission_exists('time_condition_edit')) { $list_row_url = "time_condition_edit.php?id=".urlencode($row['dialplan_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('time_condition_add') || permission_exists('time_condition_edit') || permission_exists('time_condition_delete')) { @@ -282,3 +286,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/vars/vars.php b/app/vars/vars.php index d954ff394d..3e17ca5a23 100644 --- a/app/vars/vars.php +++ b/app/vars/vars.php @@ -224,8 +224,12 @@ echo "\n"; write_header($row["var_category"]); } + $list_row_url = ''; if (permission_exists('var_edit')) { $list_row_url = "var_edit.php?id=".urlencode($row['var_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('var_add') || permission_exists('var_edit') || permission_exists('var_delete')) { @@ -283,3 +287,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/voicemail_greetings/voicemail_greetings.php b/app/voicemail_greetings/voicemail_greetings.php index 93a5674dac..49eec2c8bb 100644 --- a/app/voicemail_greetings/voicemail_greetings.php +++ b/app/voicemail_greetings/voicemail_greetings.php @@ -437,8 +437,12 @@ echo "\n"; echo "\n"; // dummy row to maintain alternating background color } + $list_row_url = ''; if (permission_exists('voicemail_greeting_edit')) { $list_row_url = "voicemail_greeting_edit.php?id=".urlencode($row['voicemail_greeting_uuid'])."&voicemail_id=".urlencode($voicemail_id); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('voicemail_greeting_delete')) { @@ -605,3 +609,4 @@ } ?> + diff --git a/app/voicemails/voicemails.php b/app/voicemails/voicemails.php index 250e0b7160..ad6d6c1903 100644 --- a/app/voicemails/voicemails.php +++ b/app/voicemails/voicemails.php @@ -297,8 +297,12 @@ if (is_array($voicemails) && sizeof($voicemails) != 0) { $x = 0; foreach ($voicemails as $row) { + $list_row_url = ''; if (permission_exists('voicemail_edit')) { $list_row_url = "voicemail_edit.php?id=".urlencode($row['voicemail_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('voicemail_edit') || permission_exists('voicemail_delete')) { @@ -373,3 +377,4 @@ //include the footer require_once "resources/footer.php"; + diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index 2b59f228a3..68669d90a8 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -877,8 +877,12 @@ $content .= "\n"; $content .= "\n"; // dummy row to maintain alternating background color } + $list_row_url = ''; if ($permission['xml_cdr_details']) { $list_row_url = "xml_cdr_details.php?id=".urlencode($row['xml_cdr_uuid']).($_REQUEST['show'] ? "&show=all" : null); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } $content .= "\n"; if (!$archive_request && $permission['xml_cdr_delete']) { @@ -1059,3 +1063,4 @@ require_once "resources/footer.php"; ?> + diff --git a/core/contacts/contact_addresses.php b/core/contacts/contact_addresses.php index 7d17fd0180..8e375a3480 100644 --- a/core/contacts/contact_addresses.php +++ b/core/contacts/contact_addresses.php @@ -88,8 +88,12 @@ $x = 0; foreach ($contact_addresses as $row) { $map_query = $row['address_street']." ".$row['address_extended'].", ".$row['address_locality'].", ".$row['address_region'].", ".$row['address_region'].", ".$row['address_postal_code']; + $list_row_url = ''; if (permission_exists('contact_address_edit')) { $list_row_url = "contact_address_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_address_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('contact_address_delete')) { @@ -123,3 +127,4 @@ } ?> + diff --git a/core/contacts/contact_attachments.php b/core/contacts/contact_attachments.php index 7986b3fbb7..8b2c913c78 100644 --- a/core/contacts/contact_attachments.php +++ b/core/contacts/contact_attachments.php @@ -107,8 +107,12 @@ foreach ($contact_attachments as $row) { $attachment_type = strtolower(pathinfo($row['attachment_filename'], PATHINFO_EXTENSION)); $attachment_type_label = $attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png' ? $text['label-image'] : $text['label-file']; + $list_row_url = ''; if (permission_exists('contact_attachment_edit')) { $list_row_url = "contact_attachment_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_attachment_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('contact_attachment_delete')) { @@ -147,3 +151,4 @@ } ?> + diff --git a/core/contacts/contact_emails.php b/core/contacts/contact_emails.php index c89e9da80b..6afcb02539 100644 --- a/core/contacts/contact_emails.php +++ b/core/contacts/contact_emails.php @@ -79,8 +79,12 @@ if (!empty($contact_emails)) { $x = 0; foreach ($contact_emails as $row) { + $list_row_url = ''; if (permission_exists('contact_email_edit')) { $list_row_url = "contact_email_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_email_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('contact_email_delete')) { @@ -110,3 +114,4 @@ } ?> + diff --git a/core/contacts/contact_extensions.php b/core/contacts/contact_extensions.php index 96678d5e8f..a848bd0976 100644 --- a/core/contacts/contact_extensions.php +++ b/core/contacts/contact_extensions.php @@ -77,8 +77,12 @@ if (!empty($contact_extensions)) { $x = 0; foreach ($contact_extensions as $row) { + $list_row_url = ''; if (permission_exists('extension_edit')) { $list_row_url = PROJECT_PATH.'/app/extensions/extension_edit.php?id='.urlencode($row['extension_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; echo " "; @@ -109,3 +113,4 @@ } ?> + diff --git a/core/contacts/contact_notes.php b/core/contacts/contact_notes.php index 07d45b94db..0e66f265ec 100644 --- a/core/contacts/contact_notes.php +++ b/core/contacts/contact_notes.php @@ -82,8 +82,12 @@ $contact_note = $row['contact_note']; $contact_note = escape($contact_note); $contact_note = str_replace("\n","
",$contact_note); + $list_row_url = ''; if (permission_exists('contact_note_add')) { $list_row_url = "contact_note_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_note_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('contact_note_delete')) { @@ -112,3 +116,4 @@ } ?> + diff --git a/core/contacts/contact_phones.php b/core/contacts/contact_phones.php index b70759f153..51d18b2c14 100644 --- a/core/contacts/contact_phones.php +++ b/core/contacts/contact_phones.php @@ -93,8 +93,12 @@ if (!empty($contact_phones)) { $x = 0; foreach ($contact_phones as $row) { + $list_row_url = ''; if (permission_exists('contact_phone_edit')) { $list_row_url = "contact_phone_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_phone_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('contact_phone_delete')) { @@ -144,3 +148,4 @@ } ?> + diff --git a/core/contacts/contact_relations.php b/core/contacts/contact_relations.php index 01e2c77779..36e006cf8b 100644 --- a/core/contacts/contact_relations.php +++ b/core/contacts/contact_relations.php @@ -93,8 +93,12 @@ if (!empty($contact_relations)) { $x = 0; foreach ($contact_relations as $row) { + $list_row_url = ''; if (permission_exists('contact_relation_edit')) { $list_row_url = "contact_relation_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_relation_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('contact_relation_delete')) { @@ -124,3 +128,4 @@ } ?> + diff --git a/core/contacts/contact_settings.php b/core/contacts/contact_settings.php index 0fa2d63a3b..6ded1b022a 100644 --- a/core/contacts/contact_settings.php +++ b/core/contacts/contact_settings.php @@ -86,8 +86,12 @@ if (!empty($contact_settings)) { $x = 0; foreach ($contact_settings as $row) { + $list_row_url = ''; if (permission_exists('contact_setting_edit')) { $list_row_url = "contact_setting_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_setting_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('contact_setting_delete')) { @@ -133,3 +137,4 @@ } ?> + diff --git a/core/contacts/contact_times.php b/core/contacts/contact_times.php index 1ab5fcf912..193fa0f911 100644 --- a/core/contacts/contact_times.php +++ b/core/contacts/contact_times.php @@ -97,8 +97,12 @@ } $tmp = explode(' ', $row['time_start']); $time_start = $tmp[0]; + $list_row_url = ''; if (permission_exists('contact_time_edit')) { $list_row_url = "contact_time_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_time_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('contact_time_delete')) { @@ -129,3 +133,4 @@ } ?> + diff --git a/core/contacts/contact_urls.php b/core/contacts/contact_urls.php index d04d70cbb5..7de4cb087d 100644 --- a/core/contacts/contact_urls.php +++ b/core/contacts/contact_urls.php @@ -81,8 +81,12 @@ if (!empty($contact_urls)) { $x = 0; foreach ($contact_urls as $row) { + $list_row_url = ''; if (permission_exists('contact_url_edit')) { $list_row_url = "contact_url_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_url_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('contact_url_delete')) { @@ -112,3 +116,4 @@ } ?> + diff --git a/core/contacts/contacts.php b/core/contacts/contacts.php index f35857b5bc..abdbdbfe2f 100644 --- a/core/contacts/contacts.php +++ b/core/contacts/contacts.php @@ -396,6 +396,9 @@ $x = 0; foreach($contacts as $row) { $list_row_url = "contact_view.php?id=".urlencode($row['contact_uuid'])."&query_string=".urlencode($_SERVER["QUERY_STRING"]); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } echo "\n"; if (permission_exists('contact_delete')) { echo " \n"; @@ -469,3 +472,5 @@ require_once "resources/footer.php"; ?> + + diff --git a/core/dashboard/dashboard.php b/core/dashboard/dashboard.php index 7d3076b9dd..841a95ce4f 100644 --- a/core/dashboard/dashboard.php +++ b/core/dashboard/dashboard.php @@ -202,8 +202,12 @@ if (!empty($dashboard)) { $x = 0; foreach ($dashboard as $row) { + $list_row_url = ''; if (permission_exists('dashboard_edit')) { $list_row_url = "dashboard_edit.php?id=".urlencode($row['dashboard_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('dashboard_add') || permission_exists('dashboard_edit') || permission_exists('dashboard_delete')) { @@ -256,3 +260,4 @@ require_once "resources/footer.php"; ?> + diff --git a/core/databases/databases.php b/core/databases/databases.php index 9e5280ebb6..a579b486ef 100644 --- a/core/databases/databases.php +++ b/core/databases/databases.php @@ -200,3 +200,4 @@ require_once "resources/footer.php"; ?> + diff --git a/core/users/users.php b/core/users/users.php index cffbe80a8e..304f6a3d32 100644 --- a/core/users/users.php +++ b/core/users/users.php @@ -276,8 +276,12 @@ if (is_array($users) && @sizeof($users) != 0) { $x = 0; foreach ($users as $row) { + $list_row_url = ''; if (permission_exists('user_edit')) { $list_row_url = "user_edit.php?id=".urlencode($row['user_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } echo "\n"; if (permission_exists('user_add') || permission_exists('user_edit') || permission_exists('user_delete')) { @@ -337,3 +341,4 @@ require_once "resources/footer.php"; ?> + From 3adcad3e5e3b197292b22d7eca0ec6f7cc392875 Mon Sep 17 00:00:00 2001 From: chansizzle <14916599+chansizzle@users.noreply.github.com> Date: Thu, 20 Feb 2025 21:28:22 -0700 Subject: [PATCH 36/55] date column before time column (#7266) change the order of the columns --- app/emergency/emergency.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/emergency/emergency.php b/app/emergency/emergency.php index 899abb3f4e..6452043b3c 100644 --- a/app/emergency/emergency.php +++ b/app/emergency/emergency.php @@ -189,8 +189,8 @@ echo "\n"; if (!empty($show) && $show == 'all' && permission_exists('emergency_logs_view_all')) { echo th_order_by('domain_name', $text['label-domain'], $order_by, $order); } -echo "".$text['label-emergency_time']."\n"; echo "".$text['label-emergency_date']."\n"; +echo "".$text['label-emergency_time']."\n"; echo "".$text['label-emergency_extension']."\n"; echo "".$text['label-emergency_event']."\n"; echo "\n"; @@ -202,8 +202,8 @@ if (!empty($emergency_logs) && is_array($emergency_logs) && @sizeof($emergency_l if (!empty($_GET['show']) && $_GET['show'] == 'all' && permission_exists('emergency_logs_view_all')) { echo " ".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."\n"; } - echo " ".escape($row['time_formatted'])."\n"; echo " ".escape($row['date_formatted'])."\n"; + echo " ".escape($row['time_formatted'])."\n"; echo " ".escape($row['extension'])."\n"; echo " ".escape($row['event'])."\n"; echo "\n"; From b85eaaac73f37fdb63e8b3d3dd2f1d1c46d2781d Mon Sep 17 00:00:00 2001 From: fusionate Date: Fri, 21 Feb 2025 08:51:52 -0700 Subject: [PATCH 37/55] Upgrade - Source: Move Preview styles to theme CSS file, style after modal. --- core/upgrade/index.php | 33 ++---------------------------- themes/default/css.php | 46 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/core/upgrade/index.php b/core/upgrade/index.php index f9ed6c7c77..eb56ed9fce 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -221,12 +221,12 @@ } } echo "\n"; - echo "".$text['header-source_code_upgrade_preview']."\n"; + echo "
".$text['header-source_code_upgrade_preview']."
\n"; echo "

\n"; if (!empty($response) && is_array($response)) { echo str_replace('APP_NAME', (!empty($_GET['title']) ? "".$_GET['title']."" : null), $text['description-source_code_changes_found']); echo "


\n"; - echo "
\n"; + echo "
\n"; if (!empty($response) && is_array($response)) { echo implode("
\n
\n", $response); } @@ -254,35 +254,6 @@ require_once "resources/header.php"; //source preview layer - echo "\n"; - echo ""; echo "

"; if ($action == "update") { diff --git a/core/contacts/contact_email_edit.php b/core/contacts/contact_email_edit.php index 1f41f0ba77..f8a1229e67 100644 --- a/core/contacts/contact_email_edit.php +++ b/core/contacts/contact_email_edit.php @@ -239,6 +239,7 @@ if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) { } echo "

\n"; + echo "
\n"; echo "\n"; echo "\n"; @@ -311,6 +312,7 @@ if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) { echo "\n"; echo "
"; + echo "
\n"; echo "

"; echo "\n"; From e08a79e64d538fe2a7e292629efda6761dba7b4e Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Tue, 25 Feb 2025 12:48:50 -0700 Subject: [PATCH 46/55] Add missing required class to required fields (#7273) * Add missing required class to required fields * Update destination_edit.php * Update device_edit.php * Update voicemail_edit.php * Update dashboard_edit.php * Update call_block_edit.php * Update destination_edit.php --- app/call_block/call_block_edit.php | 4 ++-- app/destinations/destination_edit.php | 4 ++-- app/devices/device_edit.php | 6 +++--- app/voicemails/voicemail_edit.php | 4 ++-- core/dashboard/dashboard_edit.php | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/call_block/call_block_edit.php b/app/call_block/call_block_edit.php index 669a1f6c57..b4e986a149 100644 --- a/app/call_block/call_block_edit.php +++ b/app/call_block/call_block_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2024 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -557,7 +557,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr } echo "\n"; - echo "\n"; + echo "\n"; echo " ".$text['label-enabled']."\n"; echo "\n"; echo "\n"; diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index bdcae911f5..bd57431454 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2024 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -2097,7 +2097,7 @@ //enabled echo "\n"; - echo "\n"; + echo "\n"; echo " ".$text['label-destination_enabled']."\n"; echo "\n"; echo "\n"; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index b8cedfff56..f5567759fe 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2024 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. */ @@ -1101,7 +1101,7 @@ echo "\n"; echo "\n"; - echo "\n"; echo "\n"; - echo "\n"; echo "\n"; - echo "\n"; echo "\n"; echo "\n"; } - + if ($dashboard_chart_type == "icon") { echo "\n"; echo "\n"; echo "\n"; - echo "\n"; echo "
\n"; + echo "\n"; echo " ".$text['label-device_address']."\n"; echo "\n"; @@ -1992,7 +1992,7 @@ if (permission_exists('device_enable')) { echo "
\n"; + echo "\n"; echo " ".$text['label-device_enabled']."\n"; echo "\n"; diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php index 083c525d59..61637bd4c2 100644 --- a/app/voicemails/voicemail_edit.php +++ b/app/voicemails/voicemail_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2024 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -949,7 +949,7 @@ } echo "
\n"; + echo "\n"; echo " ".$text['label-voicemail_enabled']."\n"; echo "\n"; diff --git a/core/dashboard/dashboard_edit.php b/core/dashboard/dashboard_edit.php index 24915a82c3..3ed5dc78aa 100644 --- a/core/dashboard/dashboard_edit.php +++ b/core/dashboard/dashboard_edit.php @@ -18,7 +18,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2021-2024 + Portions created by the Initial Developer are Copyright (C) 2021-2025 the Initial Developer. All Rights Reserved. */ @@ -938,7 +938,7 @@ echo "
\n"; @@ -1175,7 +1175,7 @@ echo "
\n"; + echo "\n"; echo " ".$text['label-dashboard_enabled']."\n"; echo "\n"; From c22080d2fc3d5a7cb268ce2d01d29bd793ec8936 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 25 Feb 2025 13:09:49 -0700 Subject: [PATCH 47/55] Fix an unclosed {if} tag Caused by Commit 40f78c3 --- resources/templates/provision/grandstream/dp750/{$mac}.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/templates/provision/grandstream/dp750/{$mac}.xml b/resources/templates/provision/grandstream/dp750/{$mac}.xml index fdf95542fd..d9dcc91f9b 100644 --- a/resources/templates/provision/grandstream/dp750/{$mac}.xml +++ b/resources/templates/provision/grandstream/dp750/{$mac}.xml @@ -3095,6 +3095,7 @@ {elseif $grandstream_automatic_provisioning == 3} 2 {/if} +{/if} From 2f955d4fef155d1f77805ba46cfb9b4771d10d6e Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Tue, 25 Feb 2025 13:23:06 -0700 Subject: [PATCH 48/55] Fix queue edit content alignment (#7274) --- app/fifo/fifo_edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/fifo/fifo_edit.php b/app/fifo/fifo_edit.php index cb2937581f..e247ab121b 100644 --- a/app/fifo/fifo_edit.php +++ b/app/fifo/fifo_edit.php @@ -511,7 +511,7 @@ echo "\n"; echo "\n"; - echo "\n"; echo "\n"; @@ -310,6 +311,7 @@ //echo " \n"; //echo " \n"; //echo " \n"; + echo " \n"; if (permission_exists('user_edit')) { echo " \n"; } echo "\n"; - if (is_array($users) && @sizeof($users) != 0) { $x = 0; foreach ($users as $row) { @@ -303,10 +284,8 @@ } echo " \n"; echo " \n"; - if ($show_contact_fields) { - echo " \n"; - echo " \n"; - } + echo " \n"; + echo " \n"; //echo " \n"; //echo " \n"; //echo " \n"; From f3986290eaf3e3b65b792da803e21ff4969c0113 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 27 Feb 2025 10:48:29 -0700 Subject: [PATCH 55/55] Add enable-rfc-5626 to the internal profile --- app/switch/resources/conf/sip_profiles/internal-ipv6.xml.noload | 2 ++ app/switch/resources/conf/sip_profiles/internal.xml.noload | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/switch/resources/conf/sip_profiles/internal-ipv6.xml.noload b/app/switch/resources/conf/sip_profiles/internal-ipv6.xml.noload index 2c376ce0d0..f7bf02d931 100644 --- a/app/switch/resources/conf/sip_profiles/internal-ipv6.xml.noload +++ b/app/switch/resources/conf/sip_profiles/internal-ipv6.xml.noload @@ -11,6 +11,8 @@ + + diff --git a/app/switch/resources/conf/sip_profiles/internal.xml.noload b/app/switch/resources/conf/sip_profiles/internal.xml.noload index 872de9f47c..951af3f741 100644 --- a/app/switch/resources/conf/sip_profiles/internal.xml.noload +++ b/app/switch/resources/conf/sip_profiles/internal.xml.noload @@ -83,6 +83,8 @@ + +
\n"; + echo "\n"; echo " ".$text['label-fifo_name']."\n"; echo "\n"; @@ -789,4 +789,4 @@ //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> From 305f585b17ec53d7e56dbff43f9be7d6d97c4eb8 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Tue, 25 Feb 2025 16:24:16 -0700 Subject: [PATCH 49/55] Add missing counter divs (#7277) * Add counter div to voicemail messages and domain settings * Update domain_settings.php * Update menu_item_list.php * Update domain_settings.php * Update voicemail_messages.php --- app/voicemails/voicemail_messages.php | 4 ++-- core/domain_settings/domain_settings.php | 4 ++-- core/menu/menu_item_list.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/voicemails/voicemail_messages.php b/app/voicemails/voicemail_messages.php index 24290edc9b..39d815fa5b 100644 --- a/app/voicemails/voicemail_messages.php +++ b/app/voicemails/voicemail_messages.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2024 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -322,7 +322,7 @@ //show the content echo "
\n"; - echo "
".$text['title-voicemail_messages']." (".$total_rows.")
\n"; + echo "
".$text['title-voicemail_messages']."
".number_format($total_rows)."
\n"; echo "
\n"; echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>$_SESSION['back'][$_SERVER['PHP_SELF']]]); $margin_left = false; diff --git a/core/domain_settings/domain_settings.php b/core/domain_settings/domain_settings.php index 0f3df5c5ec..60d9d01245 100644 --- a/core/domain_settings/domain_settings.php +++ b/core/domain_settings/domain_settings.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008 - 2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -161,7 +161,7 @@ //show the content echo "
\n"; - echo "
".$domain_name." (".$num_rows.")
\n"; //$text['title-domain_settings'] + echo "
".$domain_name."
".number_format($num_rows)."
\n"; //$text['title-domain_settings'] echo "
\n"; echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'action_bar_sub_button_back','style'=>'','link'=>PROJECT_PATH.'/core/domains/domains.php']); if (permission_exists('default_setting_view') && $num_rows) { diff --git a/core/menu/menu_item_list.php b/core/menu/menu_item_list.php index 1b3a596e89..282fe7e9bf 100644 --- a/core/menu/menu_item_list.php +++ b/core/menu/menu_item_list.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2024 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -240,7 +240,7 @@ echo "\n"; echo "
\n"; - echo "
".$text['header-menu_items']." ()
\n"; + echo "
".$text['header-menu_items']."
\n"; echo "
\n"; echo button::create(['type'=>'button','id'=>'action_bar_sub_button_back','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'collapse'=>'hide-xs','style'=>'margin-right: 15px; display: none;','link'=>'menu.php']); if (permission_exists('menu_item_add')) { From d919a3cc1b9711063f3341c8dd797d8f734db4af Mon Sep 17 00:00:00 2001 From: frytimo Date: Tue, 25 Feb 2025 20:21:41 -0400 Subject: [PATCH 50/55] Add the apcu caching ability for performance (#7276) * add the apcu caching ability for performance When the PHP extension APCu is loaded, the settings class and the auto_loader will cache their results across requests in RAM. For more information about the APCu extension visit the PHP page: https://www.php.net/apcu * use global instead of default terminology --- app/sip_status/sip_status.php | 1 - .../default_settings_reload.php | 2 +- core/domain_settings/domain_setting_edit.php | 3 + core/user_settings/user_setting_edit.php | 3 + resources/classes/auto_loader.php | 73 ++++++++--- resources/classes/cache.php | 11 ++ resources/classes/settings.php | 115 +++++++++++++++--- 7 files changed, 171 insertions(+), 37 deletions(-) diff --git a/app/sip_status/sip_status.php b/app/sip_status/sip_status.php index 5dfb85360e..364023a108 100644 --- a/app/sip_status/sip_status.php +++ b/app/sip_status/sip_status.php @@ -331,4 +331,3 @@ require_once "resources/footer.php"; ?> - diff --git a/core/default_settings/default_settings_reload.php b/core/default_settings/default_settings_reload.php index 1400e7b976..916d51add7 100644 --- a/core/default_settings/default_settings_reload.php +++ b/core/default_settings/default_settings_reload.php @@ -46,7 +46,7 @@ $search = $_REQUEST['search'] ?? ''; $domain_uuid = $_GET['id'] ?? null; //reload default settings -require "resources/classes/domains.php"; +settings::clear_cache(); $domain = new domains(); $domain->set(); diff --git a/core/domain_settings/domain_setting_edit.php b/core/domain_settings/domain_setting_edit.php index 80b8395569..e9294fd58a 100644 --- a/core/domain_settings/domain_setting_edit.php +++ b/core/domain_settings/domain_setting_edit.php @@ -307,6 +307,9 @@ } } + //clear domain apcu cache due to changes + settings::clear_cache('domain'); + //redirect the browser if ($action == "update") { message::add($text['message-update']); diff --git a/core/user_settings/user_setting_edit.php b/core/user_settings/user_setting_edit.php index b480be6f05..3e0ec3fc2f 100644 --- a/core/user_settings/user_setting_edit.php +++ b/core/user_settings/user_setting_edit.php @@ -298,6 +298,9 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { } } + //clear the user settings cache + settings::clear_cache('user'); + //redirect the browser if ($action == "update") { message::add($text['message-update']); diff --git a/resources/classes/auto_loader.php b/resources/classes/auto_loader.php index 85dbcdb261..63042eb2d7 100644 --- a/resources/classes/auto_loader.php +++ b/resources/classes/auto_loader.php @@ -27,10 +27,21 @@ class auto_loader { const FILE = 'autoloader_cache.php'; + const CACHE_KEY = 'autoloader_classes'; private $classes; + /** + * Tracks the APCu extension for caching to RAM drive across requests + * @var bool + */ + private $apcu_enabled; + public function __construct($project_path = '') { + + //set if we can use RAM cache + $this->apcu_enabled = function_exists('apcu_enabled') && apcu_enabled(); + //classes must be loaded before this object is registered if (!$this->load_cache()) { //cache miss so load them @@ -43,34 +54,49 @@ class auto_loader { } public function update_cache(string $file = ''): bool { + //guard against writing an empty file + if (!empty($this->classes)) { + return false; + } + + //update RAM cache when available + if ($this->apcu_enabled) { + apcu_store(self::CACHE_KEY, $this->classes); + } + //ensure we have somewhere to put the file if (empty($file)) { $file = sys_get_temp_dir() . '/' . self::FILE; } - //guard against writing an empty file - if (!empty($this->classes)) { - //export the classes array using PHP engine - $data = var_export($this->classes, true); + //export the classes array using PHP engine + $data = var_export($this->classes, true); - //put the array in a form that it can be loaded directly to an array - $result = file_put_contents($file, "classes = []; + + //use apcu when available + if ($this->apcu_enabled && apcu_exists(self::CACHE_KEY)) { + $this->classes = apcu_fetch(self::CACHE_KEY, $success); + if ($success) return true; + } + //use a standard file if (empty($file)) { $file = sys_get_temp_dir() . '/'. self::FILE; @@ -81,6 +107,10 @@ class auto_loader { } //assign to an array if (!empty($this->classes)) { + //cache edge case of first time using apcu cache + if ($this->apcu_enabled) { + apcu_store(self::CACHE_KEY, $this->classes); + } return true; } return false; @@ -125,6 +155,11 @@ class auto_loader { return true; } + //Smarty has it's own autoloader so reject the request + if ($class_name === 'Smarty_Autoloader') { + return false; + } + //cache miss if (!empty($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') { openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); @@ -186,4 +221,10 @@ class auto_loader { } return ''; } + + public static function clear_cache() { + if (function_exists('apcu_enabled') && apcu_enabled()) { + apcu_delete(self::CACHE_KEY); + } + } } diff --git a/resources/classes/cache.php b/resources/classes/cache.php index 557d2cda63..f0ef9056ee 100644 --- a/resources/classes/cache.php +++ b/resources/classes/cache.php @@ -187,6 +187,17 @@ class cache { closelog(); } + //check for apcu extension + if (function_exists('apcu_enabled') && apcu_enabled()) { + //flush everything + apcu_clear_cache(); + } + + //remove the autoloader file cache + if (file_exists(sys_get_temp_dir() . '/' . auto_loader::FILE)) { + @unlink(sys_get_temp_dir() . '/' . auto_loader::FILE); + } + //cache method memcache if ($this->method === "memcache") { // connect to event socket diff --git a/resources/classes/settings.php b/resources/classes/settings.php index b2a85e024a..3a9a21c452 100644 --- a/resources/classes/settings.php +++ b/resources/classes/settings.php @@ -53,6 +53,12 @@ class settings { */ private $database; + /** + * Tracks if the APCu extension is loaded for database queries + * @var bool + */ + private $apcu_enabled; + /** * Create a settings object using key/value pairs in the $setting_array. * @@ -63,6 +69,16 @@ class settings { */ public function __construct($setting_array = []) { + //try to use RAM cache by default + if (!isset($setting_array['allow_caching'])) { + $setting_array['allow_caching'] = true; + } + + //track ram caching + if ($setting_array['allow_caching']) { + $this->apcu_enabled = function_exists('apcu_enabled') && apcu_enabled(); + } + //open a database connection if (empty($setting_array['database'])) { $this->database = database::new(); @@ -155,7 +171,7 @@ class settings { * @param bool $enabled (optional) True or False. Default is True. * @param string $description (optional) Description. Default is empty string. */ - public function set(string $table_prefix, string $uuid, string $category, string $subcategory, string $type = 'text', string $value = "", bool $enabled = true, string $description = "") { + public function set(string $table_prefix, string $uuid, string $category, string $subcategory, string $value = "", string $type = 'text', bool $enabled = true, string $description = "") { //set the table name $table_name = $table_prefix.'_settings'; @@ -207,6 +223,15 @@ class settings { */ private function default_settings() { + //set the key for global defaults + $key = 'settings_global_' . $this->category; + + //if the apcu extension is loaded get the already parsed array + if ($this->apcu_enabled && apcu_exists($key)) { + $this->settings = apcu_fetch($key); + return; + } + //get the default settings $sql = "select * from v_default_settings "; $sql .= "where default_setting_enabled = 'true' "; @@ -247,7 +272,11 @@ class settings { } } } - unset($sql, $result, $row); + + //if the apcu extension is loaded store the result + if ($this->apcu_enabled) { + apcu_store($key, $this->settings); + } } /** @@ -255,13 +284,22 @@ class settings { * @access private */ private function domain_settings() { - - $sql = "select * from v_domain_settings "; - $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and domain_setting_enabled = 'true' "; - $parameters['domain_uuid'] = $this->domain_uuid; - $result = $this->database->select($sql, $parameters, 'all'); - unset($sql, $parameters); + $key = 'settings_domain_'.$this->domain_uuid; + $result = ''; + //if the apcu extension is loaded get the cached database result + if ($this->apcu_enabled && apcu_exists($key)) { + $result = apcu_fetch($key); + } else { + $sql = "select * from v_domain_settings "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "and domain_setting_enabled = 'true' "; + $parameters['domain_uuid'] = $this->domain_uuid; + $result = $this->database->select($sql, $parameters, 'all'); + //if the apcu extension is loaded store the result + if ($this->apcu_enabled) { + apcu_store($key, $result); + } + } if (!empty($result)) { //domain setting array types override the default settings set as type array foreach ($result as $row) { @@ -305,7 +343,6 @@ class settings { } } - unset($result, $row); } /** @@ -314,15 +351,25 @@ class settings { * @depends $this->domain_uuid */ private function user_settings() { - - $sql = "select * from v_user_settings "; - $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and user_uuid = :user_uuid "; - $sql .= " order by user_setting_order asc "; - $parameters['domain_uuid'] = $this->domain_uuid; - $parameters['user_uuid'] = $this->user_uuid; - $result = $this->database->select($sql, $parameters, 'all'); - if (is_array($result)) { + $key = 'settings_user_'.$this->user_uuid; + $result = ''; + //if the apcu extension is loaded get the cached database result + if ($this->apcu_enabled && apcu_exists($key)) { + $result = apcu_fetch($key); + } else { + $sql = "select * from v_user_settings "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "and user_uuid = :user_uuid "; + $sql .= " order by user_setting_order asc "; + $parameters['domain_uuid'] = $this->domain_uuid; + $parameters['user_uuid'] = $this->user_uuid; + $result = $this->database->select($sql, $parameters, 'all'); + //if the apcu extension is loaded store the result + if ($this->apcu_enabled) { + apcu_store($key, $result); + } + } + if (!empty($result)) { foreach ($result as $row) { if ($row['user_setting_enabled'] == 'true') { $name = $row['user_setting_name']; @@ -406,4 +453,34 @@ class settings { } } } + + /** + * Clears the settings cache + * @param string $type Empty clears all settings. Values can be global, domain, or user. + */ + public static function clear_cache(string $type = '') { + if (function_exists('apcu_enabled') && apcu_enabled()) { + switch ($type) { + case 'all': + case '': + default: + $type = ""; + break; + case 'global': + case 'domain': + case 'user': + $type .= "_"; + break; + } + $cache = apcu_cache_info(false); + if (!empty($cache['cache_list'])) { + foreach ($cache['cache_list'] as $entry) { + $key = $entry['info']; + if (str_starts_with($key, 'settings_' . $type)) { + apcu_delete($key); + } + } + } + } + } } From bd54c07e50e60691f9437ef77daac5f0e0b2ed26 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 26 Feb 2025 10:29:45 -0700 Subject: [PATCH 51/55] Move email_templates to core --- {app => core}/email_templates/app_config.php | 0 {app => core}/email_templates/app_defaults.php | 0 {app => core}/email_templates/app_languages.php | 0 {app => core}/email_templates/app_menu.php | 0 .../email_templates/email_template_edit.php | 0 {app => core}/email_templates/email_templates.php | 0 .../resources/classes/email_templates.php | 0 .../email_templates/resources/images/icon_file.png | Bin .../resources/images/icon_folder.png | Bin .../email_templates/resources/images/icon_gear.png | Bin 10 files changed, 0 insertions(+), 0 deletions(-) rename {app => core}/email_templates/app_config.php (100%) rename {app => core}/email_templates/app_defaults.php (100%) rename {app => core}/email_templates/app_languages.php (100%) rename {app => core}/email_templates/app_menu.php (100%) rename {app => core}/email_templates/email_template_edit.php (100%) rename {app => core}/email_templates/email_templates.php (100%) rename {app => core}/email_templates/resources/classes/email_templates.php (100%) rename {app => core}/email_templates/resources/images/icon_file.png (100%) rename {app => core}/email_templates/resources/images/icon_folder.png (100%) rename {app => core}/email_templates/resources/images/icon_gear.png (100%) diff --git a/app/email_templates/app_config.php b/core/email_templates/app_config.php similarity index 100% rename from app/email_templates/app_config.php rename to core/email_templates/app_config.php diff --git a/app/email_templates/app_defaults.php b/core/email_templates/app_defaults.php similarity index 100% rename from app/email_templates/app_defaults.php rename to core/email_templates/app_defaults.php diff --git a/app/email_templates/app_languages.php b/core/email_templates/app_languages.php similarity index 100% rename from app/email_templates/app_languages.php rename to core/email_templates/app_languages.php diff --git a/app/email_templates/app_menu.php b/core/email_templates/app_menu.php similarity index 100% rename from app/email_templates/app_menu.php rename to core/email_templates/app_menu.php diff --git a/app/email_templates/email_template_edit.php b/core/email_templates/email_template_edit.php similarity index 100% rename from app/email_templates/email_template_edit.php rename to core/email_templates/email_template_edit.php diff --git a/app/email_templates/email_templates.php b/core/email_templates/email_templates.php similarity index 100% rename from app/email_templates/email_templates.php rename to core/email_templates/email_templates.php diff --git a/app/email_templates/resources/classes/email_templates.php b/core/email_templates/resources/classes/email_templates.php similarity index 100% rename from app/email_templates/resources/classes/email_templates.php rename to core/email_templates/resources/classes/email_templates.php diff --git a/app/email_templates/resources/images/icon_file.png b/core/email_templates/resources/images/icon_file.png similarity index 100% rename from app/email_templates/resources/images/icon_file.png rename to core/email_templates/resources/images/icon_file.png diff --git a/app/email_templates/resources/images/icon_folder.png b/core/email_templates/resources/images/icon_folder.png similarity index 100% rename from app/email_templates/resources/images/icon_folder.png rename to core/email_templates/resources/images/icon_folder.png diff --git a/app/email_templates/resources/images/icon_gear.png b/core/email_templates/resources/images/icon_gear.png similarity index 100% rename from app/email_templates/resources/images/icon_gear.png rename to core/email_templates/resources/images/icon_gear.png From 9591ce0cbd4da12ba16f9bc02867f02046a0596e Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 26 Feb 2025 10:30:39 -0700 Subject: [PATCH 52/55] Change the path in the menu to use core --- core/email_templates/app_menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/email_templates/app_menu.php b/core/email_templates/app_menu.php index 570bc8ee4d..62078d1092 100644 --- a/core/email_templates/app_menu.php +++ b/core/email_templates/app_menu.php @@ -29,7 +29,7 @@ $apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f"; $apps[$x]['menu'][$y]['category'] = "internal"; $apps[$x]['menu'][$y]['icon'] = ""; - $apps[$x]['menu'][$y]['path'] = "/app/email_templates/email_templates.php"; + $apps[$x]['menu'][$y]['path'] = "/core/email_templates/email_templates.php"; $apps[$x]['menu'][$y]['order'] = ""; $apps[$x]['menu'][$y]['groups'][] = "superadmin"; $y++; From 1fba94d92b210cdcf70f0fbdf13ba8f3546f954d Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 26 Feb 2025 12:01:20 -0700 Subject: [PATCH 53/55] Add contact note to users --- core/users/app_defaults.php | 2 +- core/users/app_languages.php | 28 +++++++++++++++++++++++++++- core/users/users.php | 9 +++++---- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/core/users/app_defaults.php b/core/users/app_defaults.php index 75c00a25c1..66968669be 100644 --- a/core/users/app_defaults.php +++ b/core/users/app_defaults.php @@ -35,7 +35,7 @@ if ($domains_processed == 1) { $sql = "CREATE VIEW view_users AS ( \n"; $sql .= " select u.domain_uuid, u.user_uuid, d.domain_name, u.username, u.user_status, u.user_enabled, u.add_date, \n"; - $sql .= " c.contact_uuid, c.contact_organization, c.contact_name_given ||' '|| c.contact_name_family as contact_name, c.contact_name_given, c.contact_name_family, \n"; + $sql .= " c.contact_uuid, c.contact_organization, c.contact_name_given ||' '|| c.contact_name_family as contact_name, c.contact_name_given, c.contact_name_family, c.contact_note, \n"; $sql .= " ( \n"; $sql .= " select \n"; $sql .= " string_agg(g.group_name, ', ') \n"; diff --git a/core/users/app_languages.php b/core/users/app_languages.php index ca0ff692f9..27cdb13300 100644 --- a/core/users/app_languages.php +++ b/core/users/app_languages.php @@ -1975,6 +1975,32 @@ $text['label-user_enabled']['zh-cn'] = "启用"; $text['label-user_enabled']['ja-jp'] = "有効"; $text['label-user_enabled']['ko-kr'] = "사용"; +$text['label-contact_note']['en-us'] = "Note"; +$text['label-contact_note']['en-gb'] = "Note"; +$text['label-contact_note']['ar-eg'] = "ملحوظة"; +$text['label-contact_note']['de-at'] = "Notiz"; +$text['label-contact_note']['de-ch'] = "Notiz"; +$text['label-contact_note']['de-de'] = "Notiz"; +$text['label-contact_note']['el-gr'] = "Σημείωση"; +$text['label-contact_note']['es-cl'] = "Nota"; +$text['label-contact_note']['es-mx'] = "Nota"; +$text['label-contact_note']['fr-ca'] = "Note"; +$text['label-contact_note']['fr-fr'] = "Note"; +$text['label-contact_note']['he-il'] = "הערה"; +$text['label-contact_note']['it-it'] = "Nota"; +$text['label-contact_note']['ka-ge'] = "შენიშვნა"; +$text['label-contact_note']['nl-nl'] = "Notitie"; +$text['label-contact_note']['pl-pl'] = "Notatka"; +$text['label-contact_note']['pt-br'] = "Nota"; +$text['label-contact_note']['pt-pt'] = "Nota"; +$text['label-contact_note']['ro-ro'] = "Notă"; +$text['label-contact_note']['ru-ru'] = "Примечание"; +$text['label-contact_note']['sv-se'] = "Notering"; +$text['label-contact_note']['uk-ua'] = "Нотатка"; +$text['label-contact_note']['zh-cn'] = "笔记"; +$text['label-contact_note']['ja-jp'] = "ノート"; +$text['label-contact_note']['ko-kr'] = "메모"; + $text['label-additional_info']['en-us'] = "Additional Info"; $text['label-additional_info']['en-gb'] = "Additional Info"; $text['label-additional_info']['ar-eg'] = "معلومات إضافية"; @@ -2866,4 +2892,4 @@ $text['button-permissions']['zh-cn'] = "权限"; $text['button-permissions']['ja-jp'] = "パーミッション"; $text['button-permissions']['ko-kr'] = "권한"; -?> +?> \ No newline at end of file diff --git a/core/users/users.php b/core/users/users.php index 304f6a3d32..d787de164d 100644 --- a/core/users/users.php +++ b/core/users/users.php @@ -113,7 +113,7 @@ $sql_search .= " or lower(group_names) like :search "; $sql_search .= " or lower(contact_organization) like :search "; $sql_search .= " or lower(contact_name) like :search "; - //$sql_search .= " or lower(user_status) like :search "; + $sql_search .= " or lower(contact_note) like :search "; $sql_search .= ") "; $parameters['search'] = '%'.$search.'%'; } @@ -154,7 +154,7 @@ //get the list $sql = "select domain_name, domain_uuid, user_uuid, username, group_names, "; if ($show_contact_fields) { - $sql .= "contact_organization,contact_name, "; + $sql .= "contact_organization,contact_name,contact_note, "; } $sql .= "cast(user_enabled as text) "; $sql .= "from view_users "; @@ -267,6 +267,7 @@ //echo th_order_by('contact_name_family', $text['label-contact_name_family'], $order_by, $order); //echo th_order_by('user_status', $text['label-user_status'], $order_by, $order); //echo th_order_by('add_date', $text['label-add_date'], $order_by, $order); + echo th_order_by('contact_note', $text['label-contact_note'], $order_by, $order, null, "class='center'", $param); echo th_order_by('user_enabled', $text['label-user_enabled'], $order_by, $order, null, "class='center'", $param); if (permission_exists('user_edit') && $list_row_edit_button == 'true') { echo "
 ".escape($row['contact_name_family'])."".escape($row['user_status'])."".escape($row['add_date'])."".escape($row['contact_note'])." 
".escape($row['group_names'])."".escape($row['contact_organization'])."".escape($row['contact_name'])."".escape($row['contact_organization'])."".escape($row['contact_name'])."".escape($row['contact_name_given'])."".escape($row['contact_name_family'])."".escape($row['user_status'])."