From 036731202eb9143a542eeb297e23a965b919bf93 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Thu, 20 Feb 2025 11:33:06 -0700 Subject: [PATCH 01/88] Remove unnecessary if statement (#7264) --- core/domains/domains.php | 78 ++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/core/domains/domains.php b/core/domains/domains.php index c059ebc34b..bf68b7a1b8 100644 --- a/core/domains/domains.php +++ b/core/domains/domains.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) 2018 - 2022 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -39,52 +39,50 @@ } //change the domain - if (!empty($_GET["domain_uuid"]) && is_uuid($_GET["domain_uuid"]) && $_GET["domain_change"] == "true") { - if (permission_exists('domain_select')) { + if (!empty($_GET["domain_uuid"]) && is_uuid($_GET["domain_uuid"]) && $_GET["domain_change"] == "true" && permission_exists('domain_select')) { - //update the domain session variables - $domain_uuid = $_GET["domain_uuid"]; + //update the domain session variables + $domain_uuid = $_GET["domain_uuid"]; - //get the domain details - $sql = "select * from v_domains "; - $sql .= "order by domain_name asc "; - $domains = $database->select($sql, null, 'all'); - if (!empty($domains)) { - foreach($domains as $row) { - $_SESSION['domains'][$row['domain_uuid']] = $row; - } + //get the domain details + $sql = "select * from v_domains "; + $sql .= "order by domain_name asc "; + $domains = $database->select($sql, null, 'all'); + if (!empty($domains)) { + foreach($domains as $row) { + $_SESSION['domains'][$row['domain_uuid']] = $row; } - unset($sql, $domains); + } + 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"]; + //validate the domain change + if (empty($_SESSION['domains'][$domain_uuid])) { + die("invalid domain"); + } - //clear the extension array so that it is regenerated for the selected domain - unset($_SESSION['extension_array']); + //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"]; - //set the setting arrays - $domain = new domains(); - $domain->set(); + //clear the extension array so that it is regenerated for the selected domain + unset($_SESSION['extension_array']); - //redirect the user - if (!empty($_SESSION["login"]["destination"])) { - // to default, or domain specific, login destination - header("Location: ".PROJECT_PATH.$_SESSION["login"]["destination"]["text"]); - } - else { - header("Location: ".PROJECT_PATH."/core/dashboard/"); - } - exit; - } + //set the setting arrays + $domain = new domains(); + $domain->set(); + + //redirect the user + if (!empty($_SESSION["login"]["destination"])) { + // to default, or domain specific, login destination + header("Location: ".PROJECT_PATH.$_SESSION["login"]["destination"]["text"]); + } + else { + header("Location: ".PROJECT_PATH."/core/dashboard/"); + } + exit; } //check permission From c2fe9d32f75bbe4a68bbe976501aad1f86107153 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 20 Feb 2025 15:01:28 -0700 Subject: [PATCH 02/88] Fix a voicemail bug Fix the voicemail link Use only one keep local feature Deprecate the voicemail_local_after_forward --- .../resources/functions/send_email.lua | 689 +++++++++--------- app/voicemails/app_config.php | 7 +- app/voicemails/app_languages.php | 56 +- app/voicemails/voicemail_edit.php | 49 -- 4 files changed, 346 insertions(+), 455 deletions(-) diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/send_email.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/send_email.lua index eaaa53dbb2..05ed42cb48 100644 --- a/app/switch/resources/scripts/app/voicemail/resources/functions/send_email.lua +++ b/app/switch/resources/scripts/app/voicemail/resources/functions/send_email.lua @@ -25,364 +25,361 @@ -- POSSIBILITY OF SUCH DAMAGE. --load libraries - local send_mail = require 'resources.functions.send_mail' - local Database = require "resources.functions.database" - local Settings = require "resources.functions.lazy_settings" +local send_mail = require 'resources.functions.send_mail' +local Database = require "resources.functions.database" +local Settings = require "resources.functions.lazy_settings" --define a function to send email - function send_email(id, uuid) +function send_email(id, uuid) + --prepare the database, settings and variables local db = dbh or Database.new('system'); local settings = Settings.new(db, domain_name, domain_uuid); local http_protocol = settings:get('domain', 'http_protocol', 'text') or "https"; local email_queue_enabled = "true"; - --get voicemail message details - local sql = [[SELECT * FROM v_voicemails - WHERE domain_uuid = :domain_uuid - AND voicemail_id = :voicemail_id]] - local params = {domain_uuid = domain_uuid, voicemail_id = id}; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); - end - dbh:query(sql, params, function(row) - db_voicemail_uuid = string.lower(row["voicemail_uuid"]); - --voicemail_password = row["voicemail_password"]; - --greeting_id = row["greeting_id"]; - voicemail_mail_to = row["voicemail_mail_to"]; - voicemail_transcription_enabled = row["voicemail_transcription_enabled"]; - voicemail_file = row["voicemail_file"]; - voicemail_local_after_email = row["voicemail_local_after_email"]; - voicemail_local_after_forward = row["voicemail_local_after_forward"]; - voicemail_description = row["voicemail_description"]; - end); + --get voicemail message details + local sql = [[SELECT * FROM v_voicemails + WHERE domain_uuid = :domain_uuid + AND voicemail_id = :voicemail_id]] + local params = {domain_uuid = domain_uuid, voicemail_id = id}; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); + end + dbh:query(sql, params, function(row) + db_voicemail_uuid = string.lower(row["voicemail_uuid"]); + --voicemail_password = row["voicemail_password"]; + --greeting_id = row["greeting_id"]; + voicemail_mail_to = row["voicemail_mail_to"]; + voicemail_transcription_enabled = row["voicemail_transcription_enabled"]; + voicemail_file = row["voicemail_file"]; + voicemail_local_after_email = row["voicemail_local_after_email"]; + voicemail_description = row["voicemail_description"]; + end); - --set default values - if (voicemail_file == nil) then - voicemail_file = "listen"; - end - if (voicemail_local_after_email == nil) then - voicemail_local_after_email = "true"; - end - if (voicemail_local_after_forward == nil) then - voicemail_local_after_forward = "true"; - end + --set default values + if (voicemail_file == nil or voicemail_file == '') then + voicemail_file = "listen"; + end + if (voicemail_local_after_email == nil or voicemail_local_after_email == '') then + voicemail_local_after_email = "true"; + end - --require the email address to send the email - if (string.len(voicemail_mail_to) > 2) then - --include languages file - local Text = require "resources.functions.text" - local text = Text.new("app.voicemail.app_languages") - local dbh = dbh + --require the email address to send the email + if (string.len(voicemail_mail_to) > 2) then + --include languages file + local Text = require "resources.functions.text" + local text = Text.new("app.voicemail.app_languages") + local dbh = dbh - --user setting time zone, if set - local sql = [[ - select - us.user_setting_value as time_zone - from - v_user_settings as us, - v_extension_users as eu, - v_extensions as e, - v_voicemails as v - where - v.voicemail_id = :voicemail_id and - v.domain_uuid = :domain_uuid and - v.voicemail_id = e.extension and - e.domain_uuid = :domain_uuid and - e.extension_uuid = eu.extension_uuid and - eu.domain_uuid = :domain_uuid and - eu.user_uuid = us.user_uuid and - us.domain_uuid = :domain_uuid and - us.user_setting_category = 'domain' and - us.user_setting_subcategory = 'time_zone' and - us.user_setting_name = 'name' and - us.user_setting_enabled = 'true' - order by - eu.insert_date asc - limit 1 - ]] - local params = {domain_uuid = domain_uuid, voicemail_id = id}; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); - end - dbh:query(sql, params, function(row) - time_zone = row["time_zone"]; - end); + --user setting time zone, if set + local sql = [[ + select + us.user_setting_value as time_zone + from + v_user_settings as us, + v_extension_users as eu, + v_extensions as e, + v_voicemails as v + where + v.voicemail_id = :voicemail_id and + v.domain_uuid = :domain_uuid and + v.voicemail_id = e.extension and + e.domain_uuid = :domain_uuid and + e.extension_uuid = eu.extension_uuid and + eu.domain_uuid = :domain_uuid and + eu.user_uuid = us.user_uuid and + us.domain_uuid = :domain_uuid and + us.user_setting_category = 'domain' and + us.user_setting_subcategory = 'time_zone' and + us.user_setting_name = 'name' and + us.user_setting_enabled = 'true' + order by + eu.insert_date asc + limit 1 + ]] + local params = {domain_uuid = domain_uuid, voicemail_id = id}; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); + end + dbh:query(sql, params, function(row) + time_zone = row["time_zone"]; + end); - --default/domain setting time zone - if (time_zone == nil or time_zone == '') then - time_zone = settings:get('domain', 'time_zone', 'name'); - end - - --default time zone - if (time_zone == nil or time_zone == '') then - time_zone = 'UTC'; - end - - --connect using other backend if needed - if storage_type == "base64" then - dbh = Database.new('system', 'base64/read') - end - - --get voicemail message details - local sql = [[SELECT to_char(timezone(:time_zone, to_timestamp(created_epoch)), 'Day DD Mon YYYY HH:MI:SS PM') as message_date, * - FROM v_voicemail_messages - WHERE domain_uuid = :domain_uuid - AND voicemail_message_uuid = :uuid]] - local params = {domain_uuid = domain_uuid, uuid = uuid, time_zone = time_zone}; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); - end - dbh:query(sql, params, function(row) - --get the values from the database - --uuid = row["voicemail_message_uuid"]; - created_epoch = row["created_epoch"]; - caller_id_name = row["caller_id_name"]; - caller_id_number = row["caller_id_number"]; - message_date = row["message_date"]; - message_length = row["message_length"]; - --message_status = row["message_status"]; - --message_priority = row["message_priority"]; - --get the recordings from the database - if (storage_type == "base64") then - --set the voicemail intro and message paths - message_location = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext; - intro_location = voicemail_dir.."/"..id.."/intro_"..uuid.."."..vm_message_ext; - - --save the recordings to the file system - if (string.len(row["message_base64"]) > 32) then - --save the value to a variable - voicemail_base64 = row["message_base64"]; - - --include the file io - local file = require "resources.functions.file" - - --write decoded message string to file - file.write_base64(message_location, row["message_base64"]); - - --write decoded intro string to file, if any - if (string.len(row["message_intro_base64"]) > 32) then - file.write_base64(intro_location, row["message_intro_base64"]); - end - end - end - end); - - --close temporary connection - if storage_type == "base64" then - dbh:release() - end - - --format the message length and date - message_length_formatted = format_seconds(message_length); - if (debug["info"]) then - freeswitch.consoleLog("notice", "[voicemail] message date: " .. message_date .. "\n"); - freeswitch.consoleLog("notice", "[voicemail] message length: " .. message_length .. "\n"); - end - --local message_date = os.date("%A, %d %b %Y %I:%M %p", created_epoch); - - --connect to the database - local dbh = Database.new('system'); - - --get the templates - local sql = "SELECT * FROM v_email_templates "; - sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) "; - sql = sql .. "AND template_language = :template_language "; - sql = sql .. "AND template_category = 'voicemail' " - if (voicemail_transcription_enabled == 'true') then - sql = sql .. "AND template_subcategory = 'transcription' " - else - sql = sql .. "AND template_subcategory = 'default' " - end - sql = sql .. "AND template_enabled = 'true' " - sql = sql .. "ORDER BY domain_uuid DESC " - local params = {domain_uuid = domain_uuid, template_language = default_language.."-"..default_dialect}; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); - end - dbh:query(sql, params, function(row) - subject = row["template_subject"]; - body = row["template_body"]; - end); - - --get the link_address - link_address = http_protocol.."://"..domain_name..project_path; - - --set proper delete status - local local_after_email = ''; - if (voicemail_local_after_email == "false" or voicemail_local_after_forward == "false") then - local_after_email = "false"; - else - local_after_email = "true"; - end - - --prepare the headers - local headers = { - ["X-FusionPBX-Domain-UUID"] = domain_uuid; - ["X-FusionPBX-Domain-Name"] = domain_name; - ["X-FusionPBX-Call-UUID"] = uuid; - ["X-FusionPBX-Email-Type"] = 'voicemail'; - ["X-FusionPBX-local_after_email"] = local_after_email; - } - - --prepare the voicemail_name_formatted - voicemail_name_formatted = id; - local display_domain_name = settings:get('voicemail', 'display_domain_name', 'boolean'); - - if (display_domain_name == 'true') then - voicemail_name_formatted = id.."@"..domain_name; - end - if (voicemail_description ~= nil and voicemail_description ~= "" and voicemail_description ~= id) then - voicemail_name_formatted = voicemail_name_formatted.." ("..voicemail_description..")"; - end - - --prepare file - file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext; - - --combine intro, if exists, with message for emailing (only) - intro = voicemail_dir.."/"..id.."/intro_"..uuid.."."..vm_message_ext; - combined = voicemail_dir.."/"..id.."/intro_msg_"..uuid.."."..vm_message_ext; - if (file_exists(intro) and file_exists(file)) then - os.execute("sox "..intro.." "..file.." "..combined); - end - - --prepare the subject - if (subject ~= nil) then - subject = subject:gsub("${caller_id_name}", caller_id_name); - subject = subject:gsub("${caller_id_number}", caller_id_number); - subject = subject:gsub("${message_date}", message_date); - subject = subject:gsub("${message_duration}", message_length_formatted); - subject = subject:gsub("${account}", voicemail_name_formatted); - subject = subject:gsub("${voicemail_id}", id); - subject = subject:gsub("${voicemail_description}", voicemail_description); - subject = subject:gsub("${voicemail_name_formatted}", voicemail_name_formatted); - subject = subject:gsub("${domain_name}", domain_name); - subject = subject:gsub("${new_messages}", new_messages); - subject = trim(subject); - else - subject = text['label-voicemail'] .. ' ' .. caller_id_name .. ' <' .. caller_id_number .. '> ' .. message_length_formatted; - end - subject = '=?utf-8?B?'..base64.encode(subject)..'?='; - - --prepare the body - if (body ~= nil) then - body = body:gsub("${caller_id_name}", caller_id_name); - body = body:gsub("${caller_id_number}", caller_id_number); - body = body:gsub("${message_date}", message_date); - if (transcription ~= nil) then - transcription = transcription:gsub("%%", "*"); - body = body:gsub("${message_text}", transcription); - end - body = body:gsub("${message_duration}", message_length_formatted); - body = body:gsub("${account}", voicemail_name_formatted); - body = body:gsub("${voicemail_id}", id); - body = body:gsub("${voicemail_description}", voicemail_description); - body = body:gsub("${voicemail_name_formatted}", voicemail_name_formatted); - body = body:gsub("${domain_name}", domain_name); - body = body:gsub("${sip_to_user}", id); - if (origination_callee_id_name ~= nil) then - body = body:gsub("${origination_callee_id_name}", origination_callee_id_name); - end - body = body:gsub("${dialed_user}", id); - if (voicemail_file == "attach" and file) then - body = body:gsub("${message}", text['label-attached']); - elseif (voicemail_file == "link") then - body = body:gsub("${message}", ""..text['label-download']..""); - else - body = body:gsub("${message}", ""..text['label-listen']..""); - end - --body = body:gsub(" ", " "); - --body = body:gsub("%s+", ""); - --body = body:gsub(" ", " "); - body = trim(body); - else - body = ''; - if (caller_id_name ~= nil and caller_id_name ~= caller_id_number) then - body = body .. caller_id_name .. '
'; - end - body = body .. caller_id_number .. '
'; - body = body .. message_date .. '
'; - if (voicemail_file == "attach" and file) then - body = body .. '
' .. text['label-attached']; - elseif (voicemail_file == "link") then - body = body .. "
"..text['label-download']..""; - else - body = body .. "
"..text['label-listen']..""; - end - body = body .. ''; - end - - --get the smtp from address and name - smtp_from = settings:get('voicemail', 'smtp_from', 'text'); - smtp_from_name = settings:get('voicemail', 'smtp_from_name', 'text'); - if (smtp_from == nil or smtp_from == '') then - smtp_from = settings:get('email', 'smtp_from', 'text'); - end - if (smtp_from_name == nil or smtp_from_name == '') then - smtp_from_name = settings:get('email', 'smtp_from_name', 'text'); - end - if (smtp_from_name and string.len(smtp_from_name) > 0 and smtp_from and string.len(smtp_from) > 2) then - smtp_from = smtp_from_name.."<"..smtp_from..">"; - end - - --send the email with, or without, including the intro - if (file_exists(combined)) then - voicemail_path = combined - else - voicemail_path = file - end - - --send the email - send_mail(headers, - smtp_from, - voicemail_mail_to, - {subject, body}, - (voicemail_file == "attach") and voicemail_path, - voicemail_base64 - ); - - end - - --whether to keep the voicemail message and details local after email - if (string.len(voicemail_mail_to) > 2 and email_queue_enabled == 'false') then - if (voicemail_local_after_email == "false" and voicemail_local_after_forward == "false") then - --delete the voicemail message details - local sql = [[DELETE FROM v_voicemail_messages - WHERE domain_uuid = :domain_uuid - AND voicemail_uuid = :voicemail_uuid - AND voicemail_message_uuid = :uuid]] - local params = {domain_uuid = domain_uuid, - voicemail_uuid = db_voicemail_uuid, uuid = uuid}; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); - end - dbh:query(sql, params); - --delete voicemail recording files - if (file_exists(file)) then - os.remove(file); - end - if (file_exists(intro)) then - os.remove(intro); - end - if (file_exists(combined)) then - os.remove(combined); - end - --set message waiting indicator - message_waiting(id, domain_uuid); - --clear the variable - db_voicemail_uuid = ''; - elseif (storage_type == "base64") then - --delete voicemail recording files - if (file_exists(file)) then - os.remove(file); - end - if (file_exists(intro)) then - os.remove(intro); - end - if (file_exists(combined)) then - os.remove(combined); - end + --default/domain setting time zone + if (time_zone == nil or time_zone == '') then + time_zone = settings:get('domain', 'time_zone', 'name'); end + --default time zone + if (time_zone == nil or time_zone == '') then + time_zone = 'UTC'; + end + + --connect using other backend if needed + if storage_type == "base64" then + dbh = Database.new('system', 'base64/read') + end + + --get voicemail message details + local sql = [[SELECT to_char(timezone(:time_zone, to_timestamp(created_epoch)), 'Day DD Mon YYYY HH:MI:SS PM') as message_date, * + FROM v_voicemail_messages + WHERE domain_uuid = :domain_uuid + AND voicemail_message_uuid = :uuid]] + local params = {domain_uuid = domain_uuid, uuid = uuid, time_zone = time_zone}; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); + end + dbh:query(sql, params, function(row) + --get the values from the database + --uuid = row["voicemail_message_uuid"]; + created_epoch = row["created_epoch"]; + caller_id_name = row["caller_id_name"]; + caller_id_number = row["caller_id_number"]; + message_date = row["message_date"]; + message_length = row["message_length"]; + --message_status = row["message_status"]; + --message_priority = row["message_priority"]; + --get the recordings from the database + if (storage_type == "base64") then + --set the voicemail intro and message paths + message_location = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext; + intro_location = voicemail_dir.."/"..id.."/intro_"..uuid.."."..vm_message_ext; + + --save the recordings to the file system + if (string.len(row["message_base64"]) > 32) then + --save the value to a variable + voicemail_base64 = row["message_base64"]; + + --include the file io + local file = require "resources.functions.file" + + --write decoded message string to file + file.write_base64(message_location, row["message_base64"]); + + --write decoded intro string to file, if any + if (string.len(row["message_intro_base64"]) > 32) then + file.write_base64(intro_location, row["message_intro_base64"]); + end + end + end + end); + + --close temporary connection + if storage_type == "base64" then + dbh:release() + end + + --format the message length and date + message_length_formatted = format_seconds(message_length); + if (debug["info"]) then + freeswitch.consoleLog("notice", "[voicemail] message date: " .. message_date .. "\n"); + freeswitch.consoleLog("notice", "[voicemail] message length: " .. message_length .. "\n"); + end + --local message_date = os.date("%A, %d %b %Y %I:%M %p", created_epoch); + + --connect to the database + local dbh = Database.new('system'); + + --get the templates + local sql = "SELECT * FROM v_email_templates "; + sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) "; + sql = sql .. "AND template_language = :template_language "; + sql = sql .. "AND template_category = 'voicemail' " + if (voicemail_transcription_enabled == 'true') then + sql = sql .. "AND template_subcategory = 'transcription' " + else + sql = sql .. "AND template_subcategory = 'default' " + end + sql = sql .. "AND template_enabled = 'true' " + sql = sql .. "ORDER BY domain_uuid DESC " + local params = {domain_uuid = domain_uuid, template_language = default_language.."-"..default_dialect}; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); + end + dbh:query(sql, params, function(row) + subject = row["template_subject"]; + body = row["template_body"]; + end); + + --get the link_address + link_address = http_protocol.."://"..domain_name..project_path; + + --set proper delete status + local local_after_email = ''; + if (voicemail_local_after_email == "false") then + local_after_email = "false"; + else + local_after_email = "true"; + end + + --prepare the headers + local headers = { + ["X-FusionPBX-Domain-UUID"] = domain_uuid; + ["X-FusionPBX-Domain-Name"] = domain_name; + ["X-FusionPBX-Call-UUID"] = uuid; + ["X-FusionPBX-Email-Type"] = 'voicemail'; + ["X-FusionPBX-local_after_email"] = local_after_email; + } + + --prepare the voicemail_name_formatted + voicemail_name_formatted = id; + local display_domain_name = settings:get('voicemail', 'display_domain_name', 'boolean'); + + if (display_domain_name == 'true') then + voicemail_name_formatted = id.."@"..domain_name; + end + if (voicemail_description ~= nil and voicemail_description ~= "" and voicemail_description ~= id) then + voicemail_name_formatted = voicemail_name_formatted.." ("..voicemail_description..")"; + end + + --prepare file + file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext; + + --combine intro, if exists, with message for emailing (only) + intro = voicemail_dir.."/"..id.."/intro_"..uuid.."."..vm_message_ext; + combined = voicemail_dir.."/"..id.."/intro_msg_"..uuid.."."..vm_message_ext; + if (file_exists(intro) and file_exists(file)) then + os.execute("sox "..intro.." "..file.." "..combined); + end + + --prepare the subject + if (subject ~= nil) then + subject = subject:gsub("${caller_id_name}", caller_id_name); + subject = subject:gsub("${caller_id_number}", caller_id_number); + subject = subject:gsub("${message_date}", message_date); + subject = subject:gsub("${message_duration}", message_length_formatted); + subject = subject:gsub("${account}", voicemail_name_formatted); + subject = subject:gsub("${voicemail_id}", id); + subject = subject:gsub("${voicemail_description}", voicemail_description); + subject = subject:gsub("${voicemail_name_formatted}", voicemail_name_formatted); + subject = subject:gsub("${domain_name}", domain_name); + subject = subject:gsub("${new_messages}", new_messages); + subject = trim(subject); + else + subject = text['label-voicemail'] .. ' ' .. caller_id_name .. ' <' .. caller_id_number .. '> ' .. message_length_formatted; + end + subject = '=?utf-8?B?'..base64.encode(subject)..'?='; + + --prepare the body + if (body ~= nil) then + body = body:gsub("${caller_id_name}", caller_id_name); + body = body:gsub("${caller_id_number}", caller_id_number); + body = body:gsub("${message_date}", message_date); + if (transcription ~= nil) then + transcription = transcription:gsub("%%", "*"); + body = body:gsub("${message_text}", transcription); + end + body = body:gsub("${message_duration}", message_length_formatted); + body = body:gsub("${account}", voicemail_name_formatted); + body = body:gsub("${voicemail_id}", id); + body = body:gsub("${voicemail_description}", voicemail_description); + body = body:gsub("${voicemail_name_formatted}", voicemail_name_formatted); + body = body:gsub("${domain_name}", domain_name); + body = body:gsub("${sip_to_user}", id); + if (origination_callee_id_name ~= nil) then + body = body:gsub("${origination_callee_id_name}", origination_callee_id_name); + end + body = body:gsub("${dialed_user}", id); + if (voicemail_file == "attach" and file) then + body = body:gsub("${message}", text['label-attached']); + elseif (voicemail_file == "link") then + body = body:gsub("${message}", ""..text['label-download']..""); + else + body = body:gsub("${message}", ""..text['label-listen']..""); + end + --body = body:gsub(" ", " "); + --body = body:gsub("%s+", ""); + --body = body:gsub(" ", " "); + body = trim(body); + else + body = ''; + if (caller_id_name ~= nil and caller_id_name ~= caller_id_number) then + body = body .. caller_id_name .. '
'; + end + body = body .. caller_id_number .. '
'; + body = body .. message_date .. '
'; + if (voicemail_file == "attach" and file) then + body = body .. '
' .. text['label-attached']; + elseif (voicemail_file == "link") then + body = body .. "
"..text['label-download']..""; + else + body = body .. "
"..text['label-listen']..""; + end + body = body .. ''; + end + + --get the smtp from address and name + smtp_from = settings:get('voicemail', 'smtp_from', 'text'); + smtp_from_name = settings:get('voicemail', 'smtp_from_name', 'text'); + if (smtp_from == nil or smtp_from == '') then + smtp_from = settings:get('email', 'smtp_from', 'text'); + end + if (smtp_from_name == nil or smtp_from_name == '') then + smtp_from_name = settings:get('email', 'smtp_from_name', 'text'); + end + if (smtp_from_name and string.len(smtp_from_name) > 0 and smtp_from and string.len(smtp_from) > 2) then + smtp_from = smtp_from_name.."<"..smtp_from..">"; + end + + --send the email with, or without, including the intro + if (file_exists(combined)) then + voicemail_path = combined + else + voicemail_path = file + end + + --send the email + send_mail(headers, + smtp_from, + voicemail_mail_to, + {subject, body}, + (voicemail_file == "attach") and voicemail_path, + voicemail_base64 + ); + + end + + --whether to keep the voicemail message and details local after email + if (string.len(voicemail_mail_to) > 2 and email_queue_enabled == 'false') then + if (voicemail_local_after_email == "false") then + --delete the voicemail message details + local sql = [[DELETE FROM v_voicemail_messages + WHERE domain_uuid = :domain_uuid + AND voicemail_uuid = :voicemail_uuid + AND voicemail_message_uuid = :uuid]] + local params = {domain_uuid = domain_uuid, + voicemail_uuid = db_voicemail_uuid, uuid = uuid}; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); + end + dbh:query(sql, params); + --delete voicemail recording files + if (file_exists(file)) then + os.remove(file); + end + if (file_exists(intro)) then + os.remove(intro); + end + if (file_exists(combined)) then + os.remove(combined); + end + --set message waiting indicator + message_waiting(id, domain_uuid); + --clear the variable + db_voicemail_uuid = ''; + elseif (storage_type == "base64") then + --delete voicemail recording files + if (file_exists(file)) then + os.remove(file); + end + if (file_exists(intro)) then + os.remove(intro); + end + if (file_exists(combined)) then + os.remove(combined); + end end - end + end + +end diff --git a/app/voicemails/app_config.php b/app/voicemails/app_config.php index 11d6f974b0..6adc844b91 100644 --- a/app/voicemails/app_config.php +++ b/app/voicemails/app_config.php @@ -180,10 +180,6 @@ $apps[$x]['permissions'][$y]['groups'][] = "user"; $apps[$x]['permissions'][$y]['groups'][] = "agent"; $y++; - $apps[$x]['permissions'][$y]['name'] = "voicemail_local_after_forward"; - $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; - $apps[$x]['permissions'][$y]['groups'][] = "admin"; - $y++; $apps[$x]['permissions'][$y]['name'] = "voicemail_recording_instructions"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; @@ -491,6 +487,7 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Choose to keep the voicemail file after sending to forward destinations."; + $apps[$x]['db'][$y]['fields'][$z]['deprecated'] = "true"; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_enabled"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; @@ -751,4 +748,4 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; -?> +?> \ No newline at end of file diff --git a/app/voicemails/app_languages.php b/app/voicemails/app_languages.php index ecaa6b0d9c..6c0ec4839a 100644 --- a/app/voicemails/app_languages.php +++ b/app/voicemails/app_languages.php @@ -649,33 +649,6 @@ $text['label-voicemail_local_after_email']['zh-cn'] = "保持本地"; $text['label-voicemail_local_after_email']['ja-jp'] = "ローカルに保つ"; $text['label-voicemail_local_after_email']['ko-kr'] = "로컬 유지"; -$text['label-voicemail_local_after_forward']['en-us'] = "Keep Local After Forward"; -$text['label-voicemail_local_after_forward']['en-gb'] = "Keep Local After Forward"; -$text['label-voicemail_local_after_forward']['ar-eg'] = "الحفاظ على المحلية بعد الأمام"; -$text['label-voicemail_local_after_forward']['de-at'] = "Nach Weiterleitung lokal behalten"; -$text['label-voicemail_local_after_forward']['de-ch'] = "Nach Weiterleitung lokal behalten"; -$text['label-voicemail_local_after_forward']['de-de'] = "Nach Weiterleitung lokal behalten"; -$text['label-voicemail_local_after_forward']['el-gr'] = "Keep Local After Forward"; -$text['label-voicemail_local_after_forward']['es-cl'] = "Mantener local después de avanzar"; -$text['label-voicemail_local_after_forward']['es-mx'] = "Mantener local después de avanzar"; -$text['label-voicemail_local_after_forward']['fr-ca'] = "Rester local après le transfert"; -$text['label-voicemail_local_after_forward']['fr-fr'] = "Rester local après le transfert"; -$text['label-voicemail_local_after_forward']['he-il'] = "שמור על מקומי לאחר קדימה"; -$text['label-voicemail_local_after_forward']['it-it'] = "Mantieni locale dopo l'inoltro"; -$text['label-voicemail_local_after_forward']['ka-ge'] = "გადაგზავნის შემდეგ ადგილობრივად შენარჩუნება"; -$text['label-voicemail_local_after_forward']['nl-nl'] = "Lokaal behouden na doorsturen"; -$text['label-voicemail_local_after_forward']['pl-pl'] = "Zachowaj lokalny po przesłaniu dalej"; -$text['label-voicemail_local_after_forward']['pt-br'] = "Manter local depois de encaminhar"; -$text['label-voicemail_local_after_forward']['pt-pt'] = "Manter local depois de encaminhar"; -$text['label-voicemail_local_after_forward']['ro-ro'] = "Păstrați local după redirecționare"; -$text['label-voicemail_local_after_forward']['ru-ru'] = "Сохранять локальное значение после пересылки"; -$text['label-voicemail_local_after_forward']['sv-se'] = "Håll lokal efter Forward"; -$text['label-voicemail_local_after_forward']['uk-ua'] = "Зберігати локальні після пересилання"; -$text['label-voicemail_local_after_forward']['tr-tr'] = "İleriden Sonra Yerel Tut"; -$text['label-voicemail_local_after_forward']['zh-cn'] = "转发后保持本地"; -$text['label-voicemail_local_after_forward']['ja-jp'] = "転送後もローカルに保持"; -$text['label-voicemail_local_after_forward']['ko-kr'] = "전달 후 로컬 유지"; - $text['label-voicemail_transcribe_enabled']['en-us'] = "Transcribe"; $text['label-voicemail_transcribe_enabled']['en-gb'] = "Transcribe"; $text['label-voicemail_transcribe_enabled']['ar-eg'] = "نسخ"; @@ -1836,33 +1809,6 @@ $text['description-voicemail_local_after_email']['zh-cn'] = "选择发送电子 $text['description-voicemail_local_after_email']['ja-jp'] = "電子メール通知の送信後にボイスメールをシステムに保持するかどうかを選択します。"; $text['description-voicemail_local_after_email']['ko-kr'] = "이메일 알림을 보낸 후 시스템에 음성 메일을 유지할지 여부를 선택합니다."; -$text['description-voicemail_local_after_forward']['en-us'] = "Choose whether to keep the voicemail in this mailbox after sending to the defined Forward Destination(s)."; -$text['description-voicemail_local_after_forward']['en-gb'] = "Choose whether to keep the voicemail in this mailbox after sending to the defined Forward Destination(s)."; -$text['description-voicemail_local_after_forward']['ar-eg'] = "اختر ما إذا كنت تريد الاحتفاظ بالبريد الصوتي في صندوق البريد هذا بعد إرساله إلى وجهة (وجهات) إعادة التوجيه المحددة."; -$text['description-voicemail_local_after_forward']['de-at'] = "Wählen Sie, ob die Voicemail nach dem Senden an die definierten Weiterleitungsziele in dieser Mailbox bleiben soll."; -$text['description-voicemail_local_after_forward']['de-ch'] = "Wählen Sie, ob die Voicemail nach dem Senden an die definierten Weiterleitungsziele in dieser Mailbox bleiben soll."; -$text['description-voicemail_local_after_forward']['de-de'] = "Wählen Sie, ob die Voicemail nach dem Senden an die definierten Weiterleitungsziele in dieser Mailbox bleiben soll."; -$text['description-voicemail_local_after_forward']['el-gr'] = "Επιλέξτε εάν θα διατηρηθεί ο τηλεφωνητής σε αυτό το γραμματοκιβώτιο μετά την αποστολή στον καθορισμένο(ους) Προορισμό(ους)."; -$text['description-voicemail_local_after_forward']['es-cl'] = "Elija si desea conservar el correo de voz en este buzón después de enviarlo a los destinos de reenvío definidos."; -$text['description-voicemail_local_after_forward']['es-mx'] = "Elija si desea conservar el correo de voz en este buzón después de enviarlo a los destinos de reenvío definidos."; -$text['description-voicemail_local_after_forward']['fr-ca'] = "Choisissez si vous souhaitez conserver la messagerie vocale dans cette boîte aux lettres après l'envoi vers la ou les destinations de transfert définies."; -$text['description-voicemail_local_after_forward']['fr-fr'] = "Choisissez si vous souhaitez conserver la messagerie vocale dans cette boîte aux lettres après l'envoi vers la ou les destinations de transfert définies."; -$text['description-voicemail_local_after_forward']['he-il'] = "בחר אם לשמור את הדואר הקולי בתיבת הדואר הזו לאחר השליחה ליעד/ים המוגדרים."; -$text['description-voicemail_local_after_forward']['it-it'] = "Scegliere se conservare i messaggi vocali in questa casella di posta dopo l'invio alle destinazioni di inoltro definite."; -$text['description-voicemail_local_after_forward']['ka-ge'] = "აირჩიეთ, დარჩება თუ არა ხმოვანი ფოსტა ამ საფოსტო ყუთში განსაზღვრულ დანიშნულების პუნქტებამდე გაგზავნის შემდეგ."; -$text['description-voicemail_local_after_forward']['nl-nl'] = "Kies of u de voicemail in deze mailbox wilt bewaren na verzending naar de gedefinieerde doorstuurbestemming(en)."; -$text['description-voicemail_local_after_forward']['pl-pl'] = "Wybierz, czy poczta głosowa ma być przechowywana w tej skrzynce pocztowej po wysłaniu do określonych miejsc docelowych przekazywania."; -$text['description-voicemail_local_after_forward']['pt-br'] = "Escolha se deseja manter o correio de voz nesta caixa postal após enviar para o(s) destino(s) de encaminhamento definido(s)."; -$text['description-voicemail_local_after_forward']['pt-pt'] = "Escolha se deseja manter o correio de voz nesta caixa postal após enviar para o(s) destino(s) de encaminhamento definido(s)."; -$text['description-voicemail_local_after_forward']['ro-ro'] = "Alegeți dacă doriți să păstrați mesageria vocală în această cutie poștală după trimiterea către destinația (destinațiile) de redirecționare definite."; -$text['description-voicemail_local_after_forward']['ru-ru'] = "Выберите, следует ли сохранять голосовую почту в этом почтовом ящике после отправки в определенные пункты назначения пересылки."; -$text['description-voicemail_local_after_forward']['sv-se'] = "Välj om du vill behålla röstbrevlådan i den här brevlådan efter att ha skickats till den eller de definierade vidarebefordrandestinationerna."; -$text['description-voicemail_local_after_forward']['uk-ua'] = "Виберіть, чи зберігати голосову пошту в цій поштовій скриньці після надсилання на визначені пункти призначення."; -$text['description-voicemail_local_after_forward']['tr-tr'] = "Tanımlanan İletme Hedef(ler)ine gönderdikten sonra sesli postanın bu posta kutusunda tutulup tutulmayacağını seçin."; -$text['description-voicemail_local_after_forward']['zh-cn'] = "选择在发送到定义的转发目的地后是否将语音邮件保留在此邮箱中。"; -$text['description-voicemail_local_after_forward']['ja-jp'] = "定義された転送先に送信した後、ボイスメールをこのメールボックスに保持するかどうかを選択します。"; -$text['description-voicemail_local_after_forward']['ko-kr'] = "정의된 전달 대상으로 음성 메일을 보낸 후 이 사서함에 음성 메일을 보관할지 여부를 선택합니다."; - $text['description-voicemail_id']['en-us'] = "Enter the Voicemail ID"; $text['description-voicemail_id']['en-gb'] = "Enter the Voicemail ID"; $text['description-voicemail_id']['ar-eg'] = "أدخل معرف البريد الصوتي"; @@ -2726,4 +2672,4 @@ $text['message-emails_resent']['zh-cn'] = "电子邮件已重新发送"; $text['message-emails_resent']['ja-jp'] = "再送信メール"; $text['message-emails_resent']['ko-kr'] = "이메일 재전송"; -?> +?> \ No newline at end of file diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php index a5aaec41da..1da52e957e 100644 --- a/app/voicemails/voicemail_edit.php +++ b/app/voicemails/voicemail_edit.php @@ -100,7 +100,6 @@ $voicemail_file = $_POST["voicemail_file"]; $voicemail_local_after_email = $_POST["voicemail_local_after_email"] ?? null; $voicemail_destination = $_POST["voicemail_destination"]; - $voicemail_local_after_forward = $_POST["voicemail_local_after_forward"] ?? null; $voicemail_enabled = $_POST["voicemail_enabled"] ?? 'false'; $voicemail_description = $_POST["voicemail_description"]; $voicemail_tutorial = $_POST["voicemail_tutorial"] ?? null; @@ -181,21 +180,6 @@ if (permission_exists('voicemail_local_after_email') && !empty($voicemail_mail_to)) { $array['voicemails'][0]['voicemail_local_after_email'] = $voicemail_local_after_email ?? 'false'; } - else if (permission_exists('voicemail_local_after_forward')) { - $array['voicemails'][0]['voicemail_local_after_email'] = $voicemail_local_after_forward ?? 'false'; - } - else { - $array['voicemails'][0]['voicemail_local_after_email'] = 'true'; - } - if (permission_exists('voicemail_local_after_forward')) { - $array['voicemails'][0]['voicemail_local_after_forward'] = $voicemail_local_after_forward ?? 'false'; - } - else if (permission_exists('voicemail_local_after_email') && !empty($voicemail_mail_to)) { - $array['voicemails'][0]['voicemail_local_after_forward'] = $voicemail_local_after_email ?? 'false'; - } - else { - $array['voicemails'][0]['voicemail_local_after_forward'] = 'true'; - } $array['voicemails'][0]['voicemail_enabled'] = $voicemail_enabled; $array['voicemails'][0]['voicemail_description'] = $voicemail_description; @@ -362,7 +346,6 @@ $voicemail_recording_options = $row["voicemail_recording_options"]; $voicemail_file = $row["voicemail_file"]; $voicemail_local_after_email = $row["voicemail_local_after_email"]; - $voicemail_local_after_forward = $row["voicemail_local_after_forward"]; $voicemail_enabled = $row["voicemail_enabled"]; $voicemail_description = $row["voicemail_description"]; } @@ -371,7 +354,6 @@ else { $voicemail_file = $_SESSION['voicemail']['voicemail_file']['text']; $voicemail_local_after_email = $_SESSION['voicemail']['keep_local']['boolean']; - $voicemail_local_after_forward = $_SESSION['voicemail']['keep_local']['boolean']; } //remove the spaces @@ -381,7 +363,6 @@ //set the defaults if (empty($voicemail_local_after_email)) { $voicemail_local_after_email = 'true'; } - if (empty($voicemail_local_after_forward)) { $voicemail_local_after_forward = 'true'; } if (empty($voicemail_enabled)) { $voicemail_enabled = 'true'; } if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; } if (empty($voicemail_tutorial)) { $voicemail_tutorial = 'false'; } @@ -970,36 +951,6 @@ echo " "; } - if ( - permission_exists('voicemail_forward') && - permission_exists('voicemail_local_after_forward') && - !empty($voicemail_destinations_assigned) && - is_array($voicemail_destinations_assigned) - ) { - echo "\n"; - echo "\n"; - echo " ".$text['label-voicemail_local_after_forward']."\n"; - echo "\n"; - echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; - } - else { - echo " \n"; - } - echo "
\n"; - echo $text['description-voicemail_local_after_forward']."\n"; - echo "\n"; - echo "\n"; - unset($voicemail_destinations_assigned); - } - echo "\n"; echo "\n"; echo " ".$text['label-voicemail_enabled']."\n"; From 8cfc221da4191c9440f8516c1af473db46d050b2 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Thu, 20 Feb 2025 16:30:09 -0700 Subject: [PATCH 03/88] Redirect to the correct domain if using show all (#7265) * Redirect to the correct domain if using show all * Update bridges.php * Update call_recordings.php * Update conference_controls.php * Update conference_profile_params.php * Update conference_profiles.php * Update email_queue.php * Update event_guard_logs.php * Update fax_queue.php * Update user_settings.php * Update require.php --- app/access_controls/access_controls.php | 5 +++++ app/bridges/bridges.php | 4 ++++ app/call_block/call_block.php | 5 +++++ app/call_broadcast/call_broadcast.php | 5 +++++ app/call_center_active/call_center_queue.php | 4 ++++ app/call_centers/call_center_agents.php | 5 +++++ app/call_centers/call_center_queues.php | 5 +++++ app/call_flows/call_flows.php | 5 +++++ app/call_forward/call_forward.php | 4 ++++ app/conference_centers/conference_centers.php | 5 +++++ app/conference_centers/conference_rooms.php | 5 +++++ app/conferences/conferences.php | 5 +++++ app/database_transactions/database_transactions.php | 5 +++++ app/destinations/destinations.php | 5 +++++ app/devices/device_profiles.php | 5 +++++ app/devices/device_vendor_functions.php | 5 +++++ app/devices/device_vendors.php | 5 +++++ app/devices/devices.php | 5 +++++ app/dialplans/dialplans.php | 8 ++++++++ app/email_queue/email_queue.php | 4 ++++ app/email_templates/email_templates.php | 5 +++++ app/event_guard/event_guard_logs.php | 4 ++++ app/extensions/extensions.php | 5 +++++ app/fax/fax.php | 5 +++++ app/fax_queue/fax_queue.php | 4 ++++ app/fifo/fifo.php | 4 ++++ app/gateways/gateways.php | 5 +++++ app/ivr_menus/ivr_menus.php | 5 +++++ app/modules/modules.php | 5 +++++ app/number_translations/number_translations.php | 5 +++++ app/phrases/phrases.php | 5 +++++ app/pin_numbers/pin_numbers.php | 5 +++++ app/recordings/recordings.php | 5 +++++ app/ring_groups/ring_groups.php | 5 +++++ app/sip_profiles/sip_profiles.php | 5 +++++ app/sip_status/sip_status.php | 1 + app/sofia_global_settings/sofia_global_settings.php | 5 +++++ app/streams/streams.php | 5 +++++ app/time_conditions/time_conditions.php | 5 +++++ app/vars/vars.php | 5 +++++ app/voicemail_greetings/voicemail_greetings.php | 5 +++++ app/voicemails/voicemails.php | 5 +++++ app/xml_cdr/xml_cdr.php | 5 +++++ core/contacts/contact_addresses.php | 5 +++++ core/contacts/contact_attachments.php | 5 +++++ core/contacts/contact_emails.php | 5 +++++ core/contacts/contact_extensions.php | 5 +++++ core/contacts/contact_notes.php | 5 +++++ core/contacts/contact_phones.php | 5 +++++ core/contacts/contact_relations.php | 5 +++++ core/contacts/contact_settings.php | 5 +++++ core/contacts/contact_times.php | 5 +++++ core/contacts/contact_urls.php | 5 +++++ core/contacts/contacts.php | 5 +++++ core/dashboard/dashboard.php | 5 +++++ core/databases/databases.php | 1 + core/users/users.php | 5 +++++ 57 files changed, 273 insertions(+) diff --git a/app/access_controls/access_controls.php b/app/access_controls/access_controls.php index ac6f92a527..e049c83431 100644 --- a/app/access_controls/access_controls.php +++ b/app/access_controls/access_controls.php @@ -211,8 +211,12 @@ if (!empty($access_controls) && count($access_controls) > 0) { $x = 0; foreach ($access_controls as $row) { + $list_row_url = ''; if (permission_exists('access_control_edit')) { $list_row_url = "access_control_edit.php?id=".urlencode($row['access_control_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('access_control_add') || permission_exists('access_control_edit') || permission_exists('access_control_delete')) { @@ -254,3 +258,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/bridges/bridges.php b/app/bridges/bridges.php index 39946553f0..ce706932a3 100644 --- a/app/bridges/bridges.php +++ b/app/bridges/bridges.php @@ -234,8 +234,12 @@ if (!empty($bridges)) { $x = 0; foreach ($bridges as $row) { + $list_row_url = ''; if (permission_exists('bridge_edit')) { $list_row_url = "bridge_edit.php?id=".urlencode($row['bridge_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('bridge_add') || permission_exists('bridge_edit') || permission_exists('bridge_delete')) { diff --git a/app/call_block/call_block.php b/app/call_block/call_block.php index 83484517eb..6ed672bc6d 100644 --- a/app/call_block/call_block.php +++ b/app/call_block/call_block.php @@ -309,8 +309,12 @@ if (!empty($result)) { $x = 0; foreach ($result as $row) { + $list_row_url = ''; if (permission_exists('call_block_edit')) { $list_row_url = "call_block_edit.php?id=".urlencode($row['call_block_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('call_block_add') || permission_exists('call_block_edit') || permission_exists('call_block_delete')) { @@ -405,3 +409,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/call_broadcast/call_broadcast.php b/app/call_broadcast/call_broadcast.php index 33ad94f238..6e6cd20c00 100644 --- a/app/call_broadcast/call_broadcast.php +++ b/app/call_broadcast/call_broadcast.php @@ -227,8 +227,12 @@ if (!empty($result)) { $x = 0; foreach($result as $row) { + $list_row_url = ''; if (permission_exists('call_broadcast_edit')) { $list_row_url = "call_broadcast_edit.php?id=".urlencode($row['call_broadcast_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('call_broadcast_add') || permission_exists('call_broadcast_delete')) { @@ -286,3 +290,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/call_center_active/call_center_queue.php b/app/call_center_active/call_center_queue.php index 3b10afdf77..427a8f1716 100644 --- a/app/call_center_active/call_center_queue.php +++ b/app/call_center_active/call_center_queue.php @@ -128,6 +128,9 @@ $x = 0; foreach($call_center_queues as $row) { $list_row_url = PROJECT_PATH."/app/call_center_active/call_center_active.php?queue_name=".escape($row['call_center_queue_uuid'])."&name=".urlencode(escape($row['queue_name'])); + 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 " ".escape($row['queue_name'])."\n"; echo " ".escape($row['queue_extension'])."\n"; @@ -159,3 +162,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/call_centers/call_center_agents.php b/app/call_centers/call_center_agents.php index 07951e8535..9d76bf34bb 100644 --- a/app/call_centers/call_center_agents.php +++ b/app/call_centers/call_center_agents.php @@ -214,8 +214,12 @@ if (!empty($result)) { $x = 0; foreach($result as $row) { + $list_row_url = ''; if (permission_exists('call_center_agent_edit')) { $list_row_url = "call_center_agent_edit.php?id=".urlencode($row['call_center_agent_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('call_center_agent_delete')) { @@ -290,3 +294,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/call_centers/call_center_queues.php b/app/call_centers/call_center_queues.php index 76d4692f2b..52ef61e629 100644 --- a/app/call_centers/call_center_queues.php +++ b/app/call_centers/call_center_queues.php @@ -227,8 +227,12 @@ if (!empty($result)) { $x = 0; foreach($result as $row) { + $list_row_url = ''; if (permission_exists('call_center_queue_edit')) { $list_row_url = "call_center_queue_edit.php?id=".urlencode($row['call_center_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('call_center_queue_add') || permission_exists('call_center_queue_delete')) { @@ -293,3 +297,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index 90083781d4..2cbd2d6a53 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -243,8 +243,12 @@ if (!empty($call_flows)) { $x = 0; foreach ($call_flows as $row) { + $list_row_url = ''; if (permission_exists('call_flow_edit')) { $list_row_url = "call_flow_edit.php?id=".urlencode($row['call_flow_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('call_flow_add') || permission_exists('call_flow_edit') || permission_exists('call_flow_delete')) { @@ -311,3 +315,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/call_forward/call_forward.php b/app/call_forward/call_forward.php index cdb478d034..91e7d5f156 100644 --- a/app/call_forward/call_forward.php +++ b/app/call_forward/call_forward.php @@ -306,6 +306,9 @@ $x = 0; foreach ($extensions as $row) { $list_row_url = PROJECT_PATH . "/app/call_forward/call_forward_edit.php?id=" . $row['extension_uuid'] . "&return_url=" . urlencode($_SERVER['REQUEST_URI']); + 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 (!$is_included && $extensions) { echo " \n"; @@ -424,3 +427,4 @@ require_once "resources/footer.php"; } ?> + diff --git a/app/conference_centers/conference_centers.php b/app/conference_centers/conference_centers.php index b0b1038154..e5a0ab5ed2 100644 --- a/app/conference_centers/conference_centers.php +++ b/app/conference_centers/conference_centers.php @@ -229,8 +229,12 @@ if (!empty($conference_centers)) { $x = 0; foreach ($conference_centers as $row) { + $list_row_url = ''; if (permission_exists('conference_center_edit')) { $list_row_url = "conference_center_edit.php?id=".$row['conference_center_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('conference_center_edit') || permission_exists('conference_center_delete')) { @@ -285,3 +289,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/conference_centers/conference_rooms.php b/app/conference_centers/conference_rooms.php index 5ce0cd55de..53d30c44e9 100644 --- a/app/conference_centers/conference_rooms.php +++ b/app/conference_centers/conference_rooms.php @@ -319,8 +319,12 @@ $participant_pin = substr($participant_pin, 0, 3) ."-". substr($participant_pin, 3, 3) ."-". substr($participant_pin, -3)."\n"; } + $list_row_url = ''; if (permission_exists('conference_room_edit')) { $list_row_url = "conference_room_edit.php?id=".urlencode($row['conference_room_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('conference_room_add') || permission_exists('conference_room_edit') || permission_exists('conference_room_delete')) { @@ -508,3 +512,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/conferences/conferences.php b/app/conferences/conferences.php index 159cc29475..2a112abe24 100644 --- a/app/conferences/conferences.php +++ b/app/conferences/conferences.php @@ -231,8 +231,12 @@ if (!empty($conferences)) { $x = 0; foreach($conferences as $row) { + $list_row_url = ''; if (permission_exists('conference_edit')) { $list_row_url = "conference_edit.php?id=".urlencode($row['conference_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('conference_add') || permission_exists('conference_edit') || permission_exists('conference_delete')) { @@ -301,3 +305,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/database_transactions/database_transactions.php b/app/database_transactions/database_transactions.php index a04060d413..a17c6bfef6 100644 --- a/app/database_transactions/database_transactions.php +++ b/app/database_transactions/database_transactions.php @@ -195,8 +195,12 @@ $x = 0; foreach($transactions as $row) { if (empty($row['domain_name'])) { $row['domain_name'] = $text['label-global']; } + $list_row_url = ''; if (permission_exists('database_transaction_edit')) { $list_row_url = "database_transaction_edit.php?id=".urlencode($row['database_transaction_uuid']).(!empty($page) ? "&page=".urlencode($page) : null).(!empty($search) ? "&search=".urlencode($search) : 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"; echo " ".escape($row['domain_name'])." \n"; @@ -225,3 +229,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index eabcd61c09..99a0e0b4e1 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -375,8 +375,12 @@ foreach ($destinations as $row) { //create the row link + $list_row_url = ''; if (permission_exists('destination_edit')) { $list_row_url = "destination_edit.php?id=".urlencode($row['destination_uuid']); + if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { + $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; + } } //show the data @@ -459,3 +463,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/devices/device_profiles.php b/app/devices/device_profiles.php index 8597a26352..d9cbfe0054 100644 --- a/app/devices/device_profiles.php +++ b/app/devices/device_profiles.php @@ -237,8 +237,12 @@ if (is_array($device_profiles) && @sizeof($device_profiles) != 0) { $x = 0; foreach($device_profiles as $row) { + $list_row_url = ''; if (permission_exists('device_profile_edit')) { $list_row_url = "device_profile_edit.php?id=".urlencode($row['device_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('device_profile_add') || permission_exists('device_profile_edit') || permission_exists('device_profile_delete')) { @@ -298,3 +302,4 @@ require_once "resources/footer.php"; ?> + diff --git a/app/devices/device_vendor_functions.php b/app/devices/device_vendor_functions.php index 3b1e3b2b40..7a7dea5425 100644 --- a/app/devices/device_vendor_functions.php +++ b/app/devices/device_vendor_functions.php @@ -211,8 +211,12 @@ unset ($vendor_function_groups); //show the row of data + $list_row_url = ''; if (permission_exists('device_vendor_function_edit')) { $list_row_url = "device_vendor_function_edit.php?device_vendor_uuid=".urlencode($row['device_vendor_uuid'])."&id=".urlencode($row['device_vendor_function_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_function_add') || permission_exists('device_vendor_function_edit') || permission_exists('device_vendor_function_delete')) { @@ -289,3 +293,4 @@ echo "\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 04/88] 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 05/88] 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 14/88] 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 15/88] 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 16/88] 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 23/88] 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 @@ + + From 863de97270ae156daf7b59d724070f6726ec6ae5 Mon Sep 17 00:00:00 2001 From: frytimo Date: Thu, 27 Feb 2025 22:47:27 -0400 Subject: [PATCH 24/88] Update grandstream template loop (#7281) --- resources/templates/provision/grandstream/grp2612/{$mac}.xml | 2 +- resources/templates/provision/grandstream/grp2612w/{$mac}.xml | 2 +- resources/templates/provision/grandstream/grp2613/{$mac}.xml | 2 +- resources/templates/provision/grandstream/grp2614/{$mac}.xml | 2 +- resources/templates/provision/grandstream/grp2615/{$mac}.xml | 2 +- resources/templates/provision/grandstream/grp2616/{$mac}.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/templates/provision/grandstream/grp2612/{$mac}.xml b/resources/templates/provision/grandstream/grp2612/{$mac}.xml index d6d6634ac2..ba1ea01ede 100644 --- a/resources/templates/provision/grandstream/grp2612/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2612/{$mac}.xml @@ -4565,7 +4565,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/grp2612w/{$mac}.xml b/resources/templates/provision/grandstream/grp2612w/{$mac}.xml index 423013911b..7a6765af35 100644 --- a/resources/templates/provision/grandstream/grp2612w/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2612w/{$mac}.xml @@ -4560,7 +4560,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/grp2613/{$mac}.xml b/resources/templates/provision/grandstream/grp2613/{$mac}.xml index 8fe7f212a0..ab148d963c 100644 --- a/resources/templates/provision/grandstream/grp2613/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2613/{$mac}.xml @@ -4566,7 +4566,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/grp2614/{$mac}.xml b/resources/templates/provision/grandstream/grp2614/{$mac}.xml index d6d6634ac2..ba1ea01ede 100644 --- a/resources/templates/provision/grandstream/grp2614/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2614/{$mac}.xml @@ -4565,7 +4565,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/grp2615/{$mac}.xml b/resources/templates/provision/grandstream/grp2615/{$mac}.xml index 01b07777d0..5311dec42e 100644 --- a/resources/templates/provision/grandstream/grp2615/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2615/{$mac}.xml @@ -4558,7 +4558,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/grp2616/{$mac}.xml b/resources/templates/provision/grandstream/grp2616/{$mac}.xml index d6d6634ac2..ba1ea01ede 100644 --- a/resources/templates/provision/grandstream/grp2616/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2616/{$mac}.xml @@ -4565,7 +4565,7 @@ - + {$row.device_key_value} {/foreach} From f8e1e815460bc58c502e76cd6ae79f658a92ef22 Mon Sep 17 00:00:00 2001 From: frytimo Date: Fri, 28 Feb 2025 00:09:31 -0400 Subject: [PATCH 25/88] fix wrong logical check (#7282) Forgot to remove the '!' (not) operator from the cache check when re-organizing the update cache function --- resources/classes/auto_loader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/classes/auto_loader.php b/resources/classes/auto_loader.php index 63042eb2d7..1b5ed65549 100644 --- a/resources/classes/auto_loader.php +++ b/resources/classes/auto_loader.php @@ -55,7 +55,7 @@ class auto_loader { public function update_cache(string $file = ''): bool { //guard against writing an empty file - if (!empty($this->classes)) { + if (empty($this->classes)) { return false; } From c1296f26e0840c4321605082378e9d793899c09c Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 27 Feb 2025 23:16:42 -0700 Subject: [PATCH 26/88] Update users.php --- core/users/users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/users/users.php b/core/users/users.php index 7f0890e625..fa6e34b052 100644 --- a/core/users/users.php +++ b/core/users/users.php @@ -52,7 +52,7 @@ $users = $_POST['users'] ?? ''; } -S//process the http post data by action +//process the http post data by action if (!empty($action) && is_array($users) && @sizeof($users) != 0) { switch ($action) { case 'copy': @@ -321,4 +321,4 @@ S//process the http post data by action //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> From 3de202b987d243b133455b1b278db8352706ff67 Mon Sep 17 00:00:00 2001 From: fusionate Date: Fri, 28 Feb 2025 09:36:42 -0700 Subject: [PATCH 27/88] Contact - Attachment: Store image files in same format as uploaded. --- core/contacts/contact_attachment_edit.php | 46 ++++++++++++++--------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/core/contacts/contact_attachment_edit.php b/core/contacts/contact_attachment_edit.php index 23642505a0..62b05e1d08 100644 --- a/core/contacts/contact_attachment_edit.php +++ b/core/contacts/contact_attachment_edit.php @@ -70,15 +70,15 @@ //get the attachment type if (empty($attachment) || sizeof($attachment) == 0) { - $attachment_type = strtolower(pathinfo($_POST['attachment_filename'], PATHINFO_EXTENSION)); + $attachment_extension = strtolower(pathinfo($_POST['attachment_filename'], PATHINFO_EXTENSION)); } else { - $attachment_type = strtolower(pathinfo($attachment['name'], PATHINFO_EXTENSION)); + $attachment_extension = strtolower(pathinfo($attachment['name'], PATHINFO_EXTENSION)); } //unflag others as primary $allowed_primary_attachment = false; - if ($attachment_primary && ($attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png')) { + if ($attachment_primary && ($attachment_extension == 'jpg' || $attachment_extension == 'jpeg' || $attachment_extension == 'gif' || $attachment_extension == 'png')) { $sql = "update v_contact_attachments set attachment_primary = 0 "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and contact_uuid = :contact_uuid "; @@ -94,29 +94,41 @@ //get the allowed extensions $allowed_extensions = array_keys(json_decode($_SESSION['contact']['allowed_attachment_types']['text'], true)); - //get the attachment extension - $attachment_extension = strtolower(pathinfo($attachment['name'], PATHINFO_EXTENSION)); - //check the allowed extensions if ($attachment['error'] == '0' && in_array($attachment_extension, $allowed_extensions)) { //get the attachment content $attachment_content = file_get_contents($attachment['tmp_name']); - //list of image extensions - $image_extensions = array('png','jpg','jpeg','gif','bmp', 'webp'); - //read the image from the string then output the image without meta data - if (in_array($attachment_extension, $image_extensions)) { + if (in_array($attachment_extension, ['png','jpg','jpeg','gif','bmp', 'webp'])) { //create the image object from the content string $image = imagecreatefromstring($attachment_content); - imagealphablending($image, FALSE); - imagesavealpha($image, TRUE); //start output buffering to capture the image data ob_start(); //output the image without the EXIF data - imagepng($image); + switch ($attachment_extension) { + case 'png': + imagealphablending($image, FALSE); + imagesavealpha($image, TRUE); + imagepng($image); + break; + case 'jpg': + case 'jpeg': + imagejpeg($image); + break; + case 'gif': + imagesavealpha($image, TRUE); + imagegif($image); + break; + case 'bmp': + imagebmp($image); + break; + case 'webp': + imagewebp($image); + break; + } //get the image from the buffer $attachment_content = ob_get_contents(); @@ -215,11 +227,11 @@ echo " ".$text['label-attachment']."\n"; echo "\n"; echo "\n"; echo "\n"; - if ($action == 'update' && ($attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png')) { + if ($action == 'update' && ($attachment_extension == 'jpg' || $attachment_extension == 'jpeg' || $attachment_extension == 'gif' || $attachment_extension == 'png')) { echo "\n"; echo "
\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 17/88] 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 18/88] 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 19/88] 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 20/88] 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 21/88] 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'])."\n"; - $attachment_type = strtolower(pathinfo($attachment_filename ?? '', PATHINFO_EXTENSION)); + $attachment_extension = strtolower(pathinfo($attachment_filename ?? '', PATHINFO_EXTENSION)); if ($action == 'update') { echo "\n"; - if ($attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png') { - echo ""; + if ($attachment_extension == 'jpg' || $attachment_extension == 'jpeg' || $attachment_extension == 'gif' || $attachment_extension == 'png') { + echo ""; } else { echo "".$attachment_filename.""; @@ -233,7 +245,7 @@ echo "
\n"; echo " ".$text['label-attachment_filename']."\n"; From f6df4fd0b3c4d85bde70189bd408e7a34009f0a9 Mon Sep 17 00:00:00 2001 From: fusionate Date: Fri, 28 Feb 2025 11:03:05 -0700 Subject: [PATCH 28/88] Contacts - List: Only retrieve a single Primary attachment, in the chance that multiple exist. --- core/contacts/contacts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/contacts/contacts.php b/core/contacts/contacts.php index abdbdbfe2f..5e5722524b 100644 --- a/core/contacts/contacts.php +++ b/core/contacts/contacts.php @@ -245,7 +245,7 @@ //get the list $sql = "select *, "; - $sql .= "(select a.contact_attachment_uuid from v_contact_attachments as a where a.contact_uuid = c.contact_uuid and a.attachment_primary = 1) as contact_attachment_uuid "; + $sql .= "(select a.contact_attachment_uuid from v_contact_attachments as a where a.contact_uuid = c.contact_uuid and a.attachment_primary = 1 limit 1) as contact_attachment_uuid "; $sql .= "from v_contacts as c "; $sql .= "where true "; if ($show != "all" || !permission_exists('contact_all')) { From 06e69bf5df8150d0bcc46427f4abe4ea72562420 Mon Sep 17 00:00:00 2001 From: fusionate Date: Fri, 28 Feb 2025 14:36:41 -0700 Subject: [PATCH 29/88] Contact - Attachments: Prevent access without authentication. --- core/contacts/contact_attachment.php | 1 + 1 file changed, 1 insertion(+) diff --git a/core/contacts/contact_attachment.php b/core/contacts/contact_attachment.php index 11b7bac938..f07714ca1e 100644 --- a/core/contacts/contact_attachment.php +++ b/core/contacts/contact_attachment.php @@ -26,6 +26,7 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; + require_once "resources/check_auth.php"; //add multi-lingual support $language = new text; From b4de6f5e4b94f5cca8b9a1a43925c3d2a3ad4470 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 28 Feb 2025 17:09:35 -0700 Subject: [PATCH 30/88] Use status voicemail Moved voicemail status after missed calls. This way, it will show the status of voicemail when it goes to voicemail. There is still a field in the CDR for missed_call and this will still be set to true. --- app/xml_cdr/resources/classes/xml_cdr.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 9cf18165ce..8d9f14e136 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -612,12 +612,6 @@ if (!class_exists('xml_cdr')) { if ($xml->variables->hangup_cause == 'NO_ANSWER') { $status = 'no_answer'; } - if (substr($destination_number, 0, 3) == '*99') { - $status = 'voicemail'; - } - if (isset($xml->variables->voicemail_message_seconds) && $xml->variables->voicemail_message_seconds > 0) { - $status = 'voicemail'; - } if ($xml->variables->hangup_cause == 'ORIGINATOR_CANCEL') { $status = 'cancelled'; } @@ -633,12 +627,18 @@ if (!class_exists('xml_cdr')) { if ($xml->variables->cc_side == 'agent' && $xml->variables->billsec == 0) { $status = 'no_answer'; } - if (!isset($status) && $xml->variables->billsec == 0) { + if (!isset($status) && $xml->variables->billsec == 0) { $status = 'no_answer'; } if ($missed_call == 'true') { $status = 'missed'; } + if (substr($destination_number, 0, 3) == '*99') { + $status = 'voicemail'; + } + if (!empty($xml->variables->voicemail_message_seconds)) { + $status = 'voicemail'; + } //set the key $key = 'xml_cdr'; From e4ddb4561e1d3d7be46d9e92958042b2fbc6d78e Mon Sep 17 00:00:00 2001 From: chansizzle <14916599+chansizzle@users.noreply.github.com> Date: Fri, 28 Feb 2025 17:22:22 -0700 Subject: [PATCH 31/88] fix email category mispelling (#7280) --- app/switch/resources/scripts/app/emergency/index.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/switch/resources/scripts/app/emergency/index.lua b/app/switch/resources/scripts/app/emergency/index.lua index f4bffd0936..009e72c2f0 100644 --- a/app/switch/resources/scripts/app/emergency/index.lua +++ b/app/switch/resources/scripts/app/emergency/index.lua @@ -94,7 +94,7 @@ local sql = "SELECT * FROM v_email_templates "; sql = sql .. "WHERE template_category = :category "; sql = sql .. "AND template_subcategory = :subcategory "; sql = sql .. "AND template_enabled = :status "; - local params = {category = 'plugins', subcategory = 'emergency', status = 'true'} + local params = {category = 'plugin', subcategory = 'emergency', status = 'true'} dbh:query(sql, params, function(row) subject = row.template_subject; body = row.template_body; From de516ed210cde73aed08e36c43a2396340b0198c Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 1 Mar 2025 20:59:48 -0700 Subject: [PATCH 32/88] Minor version update 5.4.2 --- core/software/resources/classes/software.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/software/resources/classes/software.php b/core/software/resources/classes/software.php index 7fe0436ccd..7a84332caf 100644 --- a/core/software/resources/classes/software.php +++ b/core/software/resources/classes/software.php @@ -12,7 +12,7 @@ if (!class_exists('software')) { * version */ public static function version() { - return '5.4.1'; + return '5.4.2'; } /** From 06c20ef292841cb5db8c4bf93ad4cde245c7a914 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 1 Mar 2025 22:25:06 -0700 Subject: [PATCH 33/88] Fix contact notes with line feeds. When saving contact notes, it would add extra line feeds. The escaping caused this issue. --- core/contacts/contact_edit.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/contacts/contact_edit.php b/core/contacts/contact_edit.php index e95f3c1393..5e8e288bee 100644 --- a/core/contacts/contact_edit.php +++ b/core/contacts/contact_edit.php @@ -2719,8 +2719,9 @@ if (permission_exists('contact_note_view')) { $x = 0; foreach($contact_notes as $row) { $contact_note = $row['contact_note']; - $contact_note = escape($contact_note); - $contact_note = str_replace("\n","
",$contact_note); + if (!empty($contact_note)) { + $contact_note = htmlspecialcars($contact_note, ENT_QUOTES, 'UTF-8'); + } 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']); } From 48e44814de5300a5fc034d5241f5cc630cff2ed7 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sun, 2 Mar 2025 10:38:34 -0700 Subject: [PATCH 34/88] Update email_send.php --- app/email_queue/resources/jobs/email_send.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/email_queue/resources/jobs/email_send.php b/app/email_queue/resources/jobs/email_send.php index bdfa84c3d1..82a0180358 100755 --- a/app/email_queue/resources/jobs/email_send.php +++ b/app/email_queue/resources/jobs/email_send.php @@ -298,7 +298,7 @@ //echo "Body: ".$email_body."\n"; //update the message transcription - if (isset($voicemail_transcription_enabled) && $voicemail_transcription_enabled == 'true' && isset($transcribe_message)) { + if (isset($voicemail_transcription_enabled) && $voicemail_transcription_enabled && isset($transcribe_message)) { $sql = "update v_voicemail_messages "; $sql .= "set message_transcription = :message_transcription "; $sql .= "where voicemail_message_uuid = :voicemail_message_uuid; "; From a15488a708eebce27a0471e2e65ccc46e7c1bb19 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sun, 2 Mar 2025 10:45:31 -0700 Subject: [PATCH 35/88] Update the condition for validate certificate for a boolean value --- resources/classes/email.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/classes/email.php b/resources/classes/email.php index 81cf026dd3..dc419897b0 100644 --- a/resources/classes/email.php +++ b/resources/classes/email.php @@ -445,7 +445,7 @@ if (!class_exists('email')) { $smtp['password'] = $this->settings->get('email','smtp_password'); $smtp['from'] = $this->settings->get('voicemail','smtp_from') ?? $this->settings->get('email','smtp_from'); $smtp['from_name'] = $this->settings->get('voicemail','smtp_from_name') ?? $this->settings->get('email','smtp_from_name'); - $smtp['validate_certificate'] = $this->settings->get('email','smtp_validate_certificate'); + $smtp['validate_certificate'] = $this->settings->get('email','smtp_validate_certificate', true); $smtp['crypto_method'] = $this->settings->get('email','smtp_crypto_method') ?? null; //override the domain-specific smtp server settings, if any @@ -506,7 +506,7 @@ if (!class_exists('email')) { $mail->SMTPSecure = $smtp['secure']; } - if ($smtp_secure && isset($smtp['validate_certificate']) && $smtp['validate_certificate'] == "false") { + if ($smtp_secure && isset($smtp['validate_certificate']) && !$smtp['validate_certificate']) { //bypass certificate check e.g. for self-signed certificates $smtp_options['ssl']['verify_peer'] = false; $smtp_options['ssl']['verify_peer_name'] = false; @@ -638,5 +638,3 @@ $email->attachments = $email_attachments; $response = $mail->error; $sent = $email->send(); */ - -?> From 7d62cc1e639e3ec668b2046c3b51916ffa9b11f6 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 3 Mar 2025 12:29:56 -0700 Subject: [PATCH 36/88] Fix the server 2 address and sip transport --- .../provision/grandstream/gxp2130/{$mac}.xml | 2 ++ .../provision/grandstream/gxp2135/{$mac}.xml | 6 ++++++ .../provision/grandstream/gxp2140/{$mac}.xml | 15 ++++++++++----- .../provision/grandstream/gxp2160/{$mac}.xml | 15 ++++++++++----- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/resources/templates/provision/grandstream/gxp2130/{$mac}.xml b/resources/templates/provision/grandstream/gxp2130/{$mac}.xml index 9162c1b7e3..4de008c7a4 100644 --- a/resources/templates/provision/grandstream/gxp2130/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2130/{$mac}.xml @@ -180,6 +180,7 @@ + {if $row.sip_transport == ''}1{/if} {if $row.sip_transport == 'udp'}0{/if} {if $row.sip_transport == 'tcp'}1{/if} @@ -913,6 +914,7 @@ {if $grandstream_lan_port_vlan == '0'}No{else}Yes{/if} + diff --git a/resources/templates/provision/grandstream/gxp2135/{$mac}.xml b/resources/templates/provision/grandstream/gxp2135/{$mac}.xml index c17ee0a6e9..3038d56bbb 100644 --- a/resources/templates/provision/grandstream/gxp2135/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2135/{$mac}.xml @@ -38,7 +38,11 @@ {$row.server_address}:{$row.sip_port} {/if} + {if isset($row.server_address_secondary)} {$row.server_address_secondary}:{$row.sip_port} + {else} + + {/if} {if $row.sip_transport != 'dns srv' && isset($row.outbound_proxy_primary)} @@ -176,6 +180,7 @@ + {if $row.sip_transport == ''}1{/if} {if $row.sip_transport == 'udp'}0{/if} {if $row.sip_transport == 'tcp'}1{/if} @@ -909,6 +914,7 @@ {if $grandstream_lan_port_vlan == '0'}No{else}Yes{/if} + diff --git a/resources/templates/provision/grandstream/gxp2140/{$mac}.xml b/resources/templates/provision/grandstream/gxp2140/{$mac}.xml index bb5a7f2856..ca8998d462 100644 --- a/resources/templates/provision/grandstream/gxp2140/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2140/{$mac}.xml @@ -38,7 +38,11 @@ {$row.server_address}:{$row.sip_port} {/if} + {if isset($row.server_address_secondary)} {$row.server_address_secondary}:{$row.sip_port} + {else} + + {/if} {if $row.sip_transport != 'dns srv' && isset($row.outbound_proxy_primary)} @@ -176,10 +180,11 @@ - {if $row.sip_transport == ''}TCP{/if} - {if $row.sip_transport == 'udp'}UDP{/if} - {if $row.sip_transport == 'tcp'}TCP{/if} - {if $row.sip_transport == 'tls'}Tls{/if} + + {if $row.sip_transport == ''}1{/if} + {if $row.sip_transport == 'udp'}0{/if} + {if $row.sip_transport == 'tcp'}1{/if} + {if $row.sip_transport == 'tls'}2{/if} @@ -3318,4 +3323,4 @@ {/foreach} - \ No newline at end of file + diff --git a/resources/templates/provision/grandstream/gxp2160/{$mac}.xml b/resources/templates/provision/grandstream/gxp2160/{$mac}.xml index 5bfc894586..6ece8ae8f7 100644 --- a/resources/templates/provision/grandstream/gxp2160/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2160/{$mac}.xml @@ -38,7 +38,11 @@ {$row.server_address}:{$row.sip_port} {/if} + {if isset($row.server_address_secondary)} {$row.server_address_secondary}:{$row.sip_port} + {else} + + {/if} {if $row.sip_transport != 'dns srv' && isset($row.outbound_proxy_primary)} @@ -176,10 +180,11 @@ - {if $row.sip_transport == ''}TCP{/if} - {if $row.sip_transport == 'udp'}UDP{/if} - {if $row.sip_transport == 'tcp'}TCP{/if} - {if $row.sip_transport == 'tls'}Tls{/if} + + {if $row.sip_transport == ''}1{/if} + {if $row.sip_transport == 'udp'}0{/if} + {if $row.sip_transport == 'tcp'}1{/if} + {if $row.sip_transport == 'tls'}2{/if} @@ -3318,4 +3323,4 @@ {/foreach} - \ No newline at end of file + From 7b3b3aa5f906e905975de785a9d87474fa8fab1a Mon Sep 17 00:00:00 2001 From: fusionate Date: Mon, 3 Mar 2025 14:08:05 -0700 Subject: [PATCH 37/88] Menu: New option to set icon colors. --- core/menu/app_config.php | 4 ++++ core/menu/app_languages.php | 27 +++++++++++++++++++++++++++ core/menu/menu_item_edit.php | 12 +++++++++++- core/menu/menu_item_list.php | 8 +++++--- resources/classes/menu.php | 15 +++++++++------ resources/fontawesome/fa_icons.php | 2 +- themes/default/css.php | 1 - 7 files changed, 57 insertions(+), 12 deletions(-) diff --git a/core/menu/app_config.php b/core/menu/app_config.php index df80515875..bf46c8ab0c 100644 --- a/core/menu/app_config.php +++ b/core/menu/app_config.php @@ -184,6 +184,10 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "menu_item_icon_color"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "menu_item_category"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['search'] = "true"; diff --git a/core/menu/app_languages.php b/core/menu/app_languages.php index 723f57d730..35cd87c29e 100644 --- a/core/menu/app_languages.php +++ b/core/menu/app_languages.php @@ -540,6 +540,33 @@ $text['label-icon']['zh-cn'] = "图标"; $text['label-icon']['ja-jp'] = "アイコン"; $text['label-icon']['ko-kr'] = "아이콘"; +$text['label-icon_color']['en-us'] = "Icon Color"; +$text['label-icon_color']['en-gb'] = "Icon Color"; +$text['label-icon_color']['ar-eg'] = "لون الأيقونة"; +$text['label-icon_color']['de-at'] = "Symbolfarbe"; +$text['label-icon_color']['de-ch'] = "Symbolfarbe"; +$text['label-icon_color']['de-de'] = "Symbolfarbe"; +$text['label-icon_color']['el-gr'] = "Χρώμα εικονιδίου"; +$text['label-icon_color']['es-cl'] = "Color del icono"; +$text['label-icon_color']['es-mx'] = "Color del icono"; +$text['label-icon_color']['fr-ca'] = "Couleur de l'icône"; +$text['label-icon_color']['fr-fr'] = "Couleur de l'icône"; +$text['label-icon_color']['he-il'] = "צבע סמל"; +$text['label-icon_color']['it-it'] = "Colore dell'icona"; +$text['label-icon_color']['ka-ge'] = "ხატულა ფერი"; +$text['label-icon_color']['nl-nl'] = "Icoon Kleur"; +$text['label-icon_color']['pl-pl'] = "Kolor ikony"; +$text['label-icon_color']['pt-br'] = "Cor do ícone"; +$text['label-icon_color']['pt-pt'] = "Cor do ícone"; +$text['label-icon_color']['ro-ro'] = "Culoarea pictogramei"; +$text['label-icon_color']['ru-ru'] = "Цвет значка"; +$text['label-icon_color']['sv-se'] = "Ikon färg"; +$text['label-icon_color']['uk-ua'] = "Колір значка"; +$text['label-icon_color']['tr-tr'] = "Simge Rengi"; +$text['label-icon_color']['zh-cn'] = "图标颜色"; +$text['label-icon_color']['ja-jp'] = "アイコンの色"; +$text['label-icon_color']['ko-kr'] = "아이콘 색상"; + $text['label-groups']['en-us'] = "Groups"; $text['label-groups']['en-gb'] = "Groups"; $text['label-groups']['ar-eg'] = "المجموعات"; diff --git a/core/menu/menu_item_edit.php b/core/menu/menu_item_edit.php index dba0d09a89..a5e24a849e 100644 --- a/core/menu/menu_item_edit.php +++ b/core/menu/menu_item_edit.php @@ -51,6 +51,7 @@ $menu_item_link = ''; $menu_item_category = ''; $menu_item_icon = ''; + $menu_item_icon_color = ''; $menu_item_description = ''; $menu_item_protected = ''; $menu_item_parent_uuid = null; @@ -102,6 +103,7 @@ $menu_item_link = $_POST["menu_item_link"] ?? ''; $menu_item_category = $_POST["menu_item_category"] ?? ''; $menu_item_icon = $_POST["menu_item_icon"] ?? ''; + $menu_item_icon_color = $_POST["menu_item_icon_color"] ?? ''; $menu_item_description = $_POST["menu_item_description"] ?? ''; $menu_item_protected = $_POST["menu_item_protected"] ?? ''; $menu_item_parent_uuid = $_POST["menu_item_parent_uuid"] ?? null; @@ -173,6 +175,7 @@ $array['menu_items'][0]['menu_item_link'] = $menu_item_link; $array['menu_items'][0]['menu_item_category'] = $menu_item_category; $array['menu_items'][0]['menu_item_icon'] = $menu_item_icon; + $array['menu_items'][0]['menu_item_icon_color'] = $menu_item_icon_color; $array['menu_items'][0]['menu_item_description'] = $menu_item_description; $array['menu_items'][0]['menu_item_protected'] = $menu_item_protected; $array['menu_items'][0]['menu_item_uuid'] = $menu_item_uuid; @@ -198,6 +201,7 @@ $array['menu_items'][0]['menu_item_link'] = $menu_item_link; $array['menu_items'][0]['menu_item_category'] = $menu_item_category; $array['menu_items'][0]['menu_item_icon'] = $menu_item_icon; + $array['menu_items'][0]['menu_item_icon_color'] = $menu_item_icon_color; $array['menu_items'][0]['menu_item_description'] = $menu_item_description; $array['menu_items'][0]['menu_item_protected'] = $menu_item_protected; $array['menu_items'][0]['menu_item_uuid'] = $menu_item_uuid; @@ -313,6 +317,7 @@ $menu_item_link = $row["menu_item_link"]; $menu_item_category = $row["menu_item_category"]; $menu_item_icon = $row["menu_item_icon"]; + $menu_item_icon_color = $row["menu_item_icon_color"]; $menu_item_description = $row["menu_item_description"]; $menu_item_protected = $row["menu_item_protected"]; $menu_item_parent_uuid = $row["menu_item_parent_uuid"]; @@ -430,7 +435,7 @@ echo "\n"; echo " \n"; echo " "; echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; echo " "; echo " \n"; - if (permission_exists('bridge_edit') && !empty($list_row_edit_button) && $list_row_edit_button == 'true') { + if (permission_exists('bridge_edit') && $list_row_edit_button) { echo " \n"; } echo "\n"; @@ -270,7 +270,7 @@ } echo " \n"; echo " \n"; - if (permission_exists('bridge_edit') && !empty($list_row_edit_button) && $list_row_edit_button == 'true') { + if (permission_exists('bridge_edit') && $list_row_edit_button) { echo " \n"; diff --git a/app/call_block/call_block.php b/app/call_block/call_block.php index 6ed672bc6d..3d6ae3c27e 100644 --- a/app/call_block/call_block.php +++ b/app/call_block/call_block.php @@ -46,7 +46,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get posted data if (!empty($_POST['call_blocks'])) { @@ -301,7 +301,7 @@ echo th_order_by('call_block_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('insert_date', $text['label-date-added'], $order_by, $order, null, "class='shrink no-wrap'"); echo "\n"; - if (permission_exists('call_block_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_block_edit') && $list_row_edit_button) { echo " \n"; } echo "\n"; @@ -385,7 +385,7 @@ echo " \n"; echo " \n"; echo " \n"; - if (permission_exists('call_block_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_block_edit') && $list_row_edit_button) { echo " \n"; diff --git a/app/call_broadcast/call_broadcast.php b/app/call_broadcast/call_broadcast.php index 6e6cd20c00..aac61a9d67 100644 --- a/app/call_broadcast/call_broadcast.php +++ b/app/call_broadcast/call_broadcast.php @@ -47,7 +47,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get posted data if (!empty($_POST['call_broadcasts'])) { @@ -219,7 +219,7 @@ echo th_order_by('broadcast_concurrent_limit', $text['label-concurrent-limit'], $order_by, $order); echo th_order_by('broadcast_start_time', $text['label-start_time'], $order_by, $order); echo th_order_by('broadcast_description', $text['label-description'], $order_by, $order); - if (permission_exists('call_broadcast_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_broadcast_edit') && $list_row_edit_button) { echo " \n"; } echo "\n"; @@ -266,7 +266,7 @@ } echo " \n"; echo " \n"; - if (permission_exists('call_broadcast_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_broadcast_edit') && $list_row_edit_button) { echo " \n"; diff --git a/app/call_centers/call_center_agents.php b/app/call_centers/call_center_agents.php index 9d76bf34bb..634b1468ac 100644 --- a/app/call_centers/call_center_agents.php +++ b/app/call_centers/call_center_agents.php @@ -43,7 +43,7 @@ $text = $language->get(); //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get posted data if (!empty($_POST['call_center_agents'])) { @@ -206,7 +206,7 @@ //echo th_order_by('agent_wrap_up_time', $text['label-wrap_up_time'], $order_by, $order); //echo th_order_by('agent_reject_delay_time', $text['label-reject_delay_time'], $order_by, $order); //echo th_order_by('agent_busy_delay_time', $text['label-busy_delay_time'], $order_by, $order); - if (permission_exists('call_center_agent_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_center_agent_edit') && $list_row_edit_button) { echo " \n"; } echo "\n"; @@ -270,7 +270,7 @@ //echo " \n"; //echo " \n"; //echo " \n"; - if (permission_exists('call_center_agent_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_center_agent_edit') && $list_row_edit_button) { echo " \n"; diff --git a/app/call_centers/call_center_queues.php b/app/call_centers/call_center_queues.php index 52ef61e629..50b9e93ee3 100644 --- a/app/call_centers/call_center_queues.php +++ b/app/call_centers/call_center_queues.php @@ -46,7 +46,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get posted data if (!empty($_POST['call_center_queues']) && is_array($_POST['call_center_queues'])) { @@ -219,7 +219,7 @@ //echo th_order_by('queue_abandoned_resume_allowed', $text['label-abandoned_resume_allowed'], $order_by, $order); //echo th_order_by('queue_tier_rule_wait_multiply_level', $text['label-tier_rule_wait_multiply_level'], $order_by, $order); echo th_order_by('queue_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('call_center_queue_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_center_queue_edit') && $list_row_edit_button) { echo " \n"; } echo "\n"; @@ -273,7 +273,7 @@ //echo " \n"; //echo " \n"; echo " \n"; - if (permission_exists('call_center_queue_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_center_queue_edit') && $list_row_edit_button) { echo " \n"; diff --git a/app/call_centers/waveform.php b/app/call_centers/waveform.php index 3408037311..f51a6a97fc 100644 --- a/app/call_centers/waveform.php +++ b/app/call_centers/waveform.php @@ -96,8 +96,8 @@ Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba - Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom - Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis + Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL); // positive phase only - left (a-leg) top, right (b-leg) bottom + Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? false, FILTER_VALIDATE_BOOL); // combine channels into single axis $height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null; $wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string } diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index 2cbd2d6a53..85d5182497 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -46,7 +46,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get search $search = $_REQUEST['search'] ?? null; @@ -235,7 +235,7 @@ } echo th_order_by('call_flow_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('call_flow_description', $text['label-call_flow_description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('call_flow_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_flow_edit') && $list_row_edit_button) { echo " \n"; } echo "\n"; @@ -291,7 +291,7 @@ echo escape($row['call_flow_enabled']); } echo " \n"; - if (permission_exists('call_flow_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_flow_edit') && $list_row_edit_button) { echo " \n"; diff --git a/app/call_flows/waveform.php b/app/call_flows/waveform.php index 3408037311..f51a6a97fc 100644 --- a/app/call_flows/waveform.php +++ b/app/call_flows/waveform.php @@ -96,8 +96,8 @@ Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba - Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom - Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis + Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL); // positive phase only - left (a-leg) top, right (b-leg) bottom + Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? false, FILTER_VALIDATE_BOOL); // combine channels into single axis $height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null; $wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string } diff --git a/app/call_forward/call_forward.php b/app/call_forward/call_forward.php index 45c6c2abbd..e7de481ed3 100644 --- a/app/call_forward/call_forward.php +++ b/app/call_forward/call_forward.php @@ -296,8 +296,8 @@ echo " \n"; } echo " \n"; - $list_row_edit_button = $_SESSION['theme']['list_row_edit_button']['boolean'] ?? 'false'; - if ( $list_row_edit_button === 'true') { + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); + if ($list_row_edit_button) { echo " \n"; } echo "\n"; @@ -402,7 +402,7 @@ echo " \n"; } echo " \n"; - if ($list_row_edit_button === 'true') { + if ($list_row_edit_button) { echo " \n"; diff --git a/app/call_forward/call_forward_edit.php b/app/call_forward/call_forward_edit.php index a1b2bc6e72..a6e48e8f7c 100644 --- a/app/call_forward/call_forward_edit.php +++ b/app/call_forward/call_forward_edit.php @@ -341,7 +341,7 @@ */ //send feature event notify to the phone - if (!empty($_SESSION['device']['feature_sync']['boolean']) && $_SESSION['device']['feature_sync']['boolean'] == "true") { + if (filter_var($_SESSION['device']['feature_sync']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { $ring_count = ceil($call_timeout / 6); $feature_event_notify = new feature_event_notify; $feature_event_notify->domain_name = $_SESSION['domain_name']; @@ -358,7 +358,7 @@ else { $feature_event_notify->forward_all_destination = $forward_all_destination; } - + if ($forward_busy_destination == "") { $feature_event_notify->forward_busy_destination = "0"; } @@ -504,7 +504,7 @@ } //prepare the autocomplete - if(!empty($_SESSION['follow_me']['follow_me_autocomplete']['boolean']) && $_SESSION['follow_me']['follow_me_autocomplete']['boolean'] == 'true') { + if(filter_var($_SESSION['follow_me']['follow_me_autocomplete']['boolean'] ?? false, FILTER_VALIDATE_BOOLEAN)) { echo "\n"; echo "\n"; echo " - \n"; + echo " function get_destinations(id, destination_type, action, search) {\n"; + echo " var xhttp = new XMLHttpRequest();\n"; + echo " xhttp.onreadystatechange = function() {\n"; + echo " if (this.readyState == 4 && this.status == 200) {\n"; + echo " document.getElementById(id).innerHTML = this.responseText;\n"; + echo " }\n"; + echo " };\n"; + echo " if (action) {\n"; + echo " xhttp.open(\"GET\", \"/app/destinations/resources/destinations.php?destination_type=\"+destination_type+\"&action=\"+action, true);\n"; + echo " }\n"; + echo " else {\n"; + echo " xhttp.open(\"GET\", \"/app/destinations/resources/destinations.php?destination_type=\"+destination_type, true);\n"; + echo " }\n"; + echo " xhttp.send();\n"; + echo " }\n"; + echo "\n"; //get the destinations $destinations = $this->get($destination_type); @@ -1308,7 +1302,7 @@ if (!class_exists('destinations')) { } //method } //class -} + /* $obj = new destinations; //$destinations = $obj->destinations; @@ -1319,5 +1313,3 @@ echo $obj->select('ivr', 'example4', ''); echo $obj->select('ivr', 'example5', ''); echo $obj->select('ivr', 'example6', ''); */ - -?> diff --git a/app/dialplans/resources/classes/dialplan.php b/app/dialplans/resources/classes/dialplan.php index 5c5b1cee7b..0147b6b313 100644 --- a/app/dialplans/resources/classes/dialplan.php +++ b/app/dialplans/resources/classes/dialplan.php @@ -25,7 +25,6 @@ */ //define the dialplan class - if (!class_exists('dialplan')) { class dialplan { //variables @@ -1580,6 +1579,3 @@ } //class - } - -?> diff --git a/app/email_queue/resources/classes/email_queue.php b/app/email_queue/resources/classes/email_queue.php index 77bc6542ee..a7efc72c7e 100644 --- a/app/email_queue/resources/classes/email_queue.php +++ b/app/email_queue/resources/classes/email_queue.php @@ -2,12 +2,7 @@ /** * email_queue class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('email_queue')) { class email_queue { /** @@ -225,6 +220,3 @@ if (!class_exists('email_queue')) { } } -} - -?> diff --git a/app/email_queue/resources/jobs/email_queue.php b/app/email_queue/resources/jobs/email_queue.php index 9e1d3952eb..0167e54796 100755 --- a/app/email_queue/resources/jobs/email_queue.php +++ b/app/email_queue/resources/jobs/email_queue.php @@ -11,7 +11,6 @@ //includes files require_once "resources/pdo.php"; - include "resources/classes/permissions.php"; require $_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/functions/transcribe.php"; //increase limits diff --git a/app/email_queue/resources/jobs/email_send.php b/app/email_queue/resources/jobs/email_send.php index 82a0180358..a0b3f8d213 100755 --- a/app/email_queue/resources/jobs/email_send.php +++ b/app/email_queue/resources/jobs/email_send.php @@ -10,7 +10,6 @@ } //include files - include "resources/classes/permissions.php"; include_once "resources/phpmailer/class.phpmailer.php"; include_once "resources/phpmailer/class.smtp.php"; diff --git a/app/email_queue/resources/service/email_queue.php b/app/email_queue/resources/service/email_queue.php index f12a023502..684dbc7b8e 100644 --- a/app/email_queue/resources/service/email_queue.php +++ b/app/email_queue/resources/service/email_queue.php @@ -9,9 +9,6 @@ exit; } -//include files - include "resources/classes/permissions.php"; - //increase limits set_time_limit(0); ini_set('max_execution_time', 0); diff --git a/app/event_guard/resources/classes/event_guard.php b/app/event_guard/resources/classes/event_guard.php index 02bafd1bc2..69ff9aefcf 100644 --- a/app/event_guard/resources/classes/event_guard.php +++ b/app/event_guard/resources/classes/event_guard.php @@ -26,12 +26,7 @@ /** * event_guard_logs class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('event_guard')) { class event_guard { /** @@ -303,6 +298,3 @@ if (!class_exists('event_guard')) { } } -} - -?> diff --git a/app/extension_settings/resources/classes/extension_settings.php b/app/extension_settings/resources/classes/extension_settings.php index b473669e9d..15c5b2cc01 100644 --- a/app/extension_settings/resources/classes/extension_settings.php +++ b/app/extension_settings/resources/classes/extension_settings.php @@ -26,12 +26,7 @@ /** * extension_settings class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('extension_settings')) { class extension_settings { /** @@ -272,6 +267,3 @@ if (!class_exists('extension_settings')) { } } -} - -?> diff --git a/app/extensions/extension_copy.php b/app/extensions/extension_copy.php index 9148d21b6b..0aeca685a4 100644 --- a/app/extensions/extension_copy.php +++ b/app/extensions/extension_copy.php @@ -186,7 +186,6 @@ //synchronize configuration if (is_writable($_SESSION['switch']['extensions']['dir'])) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 0bddf373df..f99c45b1b6 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -850,7 +850,6 @@ //synchronize configuration if (is_writable($switch_extensions)) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); @@ -2037,7 +2036,6 @@ echo " ".$text['label-hold_music']."\n"; echo "\n"; echo "
\n"; - echo " \n"; echo " \n"; foreach ($font_awesome_icons as $icon) { $selected = $menu_item_icon == implode(' ', $icon['classes']) ? "selected" : null; @@ -470,6 +475,11 @@ echo "
".$text['label-icon_color']."
".$text['label-parent_menu'].""; diff --git a/core/menu/menu_item_list.php b/core/menu/menu_item_list.php index 282fe7e9bf..9da3c1c654 100644 --- a/core/menu/menu_item_list.php +++ b/core/menu/menu_item_list.php @@ -104,6 +104,7 @@ $menu_item_title = $row2['menu_item_title']; $menu_item_link = $row2['menu_item_link']; $menu_item_icon = $row2['menu_item_icon']; + $menu_item_icon_color = $row2['menu_item_icon_color']; //get the groups that have been assigned to the menu $sql = "select "; @@ -149,7 +150,7 @@ } //format icon - $menu_item_icon = !empty($menu_item_icon) ? "" : null; + $menu_item_icon = !empty($menu_item_icon) ? "" : null; //display the content of the list if (permission_exists('menu_item_edit')) { @@ -291,6 +292,7 @@ $menu_item_title = $row['menu_item_title']; $menu_item_link = $row['menu_item_link']; $menu_item_icon = $row['menu_item_icon']; + $menu_item_icon_color = $row['menu_item_icon_color']; $menu_item_protected = $row['menu_item_protected']; //get the groups that have been assigned to the menu @@ -336,7 +338,7 @@ } //format icon - $menu_item_icon = !empty($menu_item_icon) ? "" : null; + $menu_item_icon = !empty($menu_item_icon) ? "" : null; //display the content of the list if (permission_exists('menu_item_edit')) { @@ -437,4 +439,4 @@ echo "\n"; -?> +?> \ No newline at end of file diff --git a/resources/classes/menu.php b/resources/classes/menu.php index 86c8b8983c..9df1c94320 100644 --- a/resources/classes/menu.php +++ b/resources/classes/menu.php @@ -427,6 +427,7 @@ if (!class_exists('menu')) { $menu_item_parent_uuid = $uuid_array[$menu['parent_uuid']] ?? null; $menu_item_category = $menu['category']; $menu_item_icon = $menu['icon'] ?? null; + $menu_item_icon_color = $menu['icon_color'] ?? null; $menu_item_path = $menu['path']; $menu_item_order = $menu['order'] ?? null; $menu_item_description = $menu['desc'] ?? null; @@ -471,6 +472,7 @@ if (!class_exists('menu')) { $array['menu_items'][$x]['menu_item_link'] = $menu_item_path; $array['menu_items'][$x]['menu_item_category'] = $menu_item_category; $array['menu_items'][$x]['menu_item_icon'] = $menu_item_icon; + $array['menu_items'][$x]['menu_item_icon_color'] = $menu_item_icon_color; if (!empty($menu_item_order)) { $array['menu_items'][$x]['menu_item_order'] = $menu_item_order; } @@ -745,7 +747,7 @@ if (!class_exists('menu')) { //get the menu from the database $sql = "select i.menu_item_link, l.menu_item_title as menu_language_title, "; $sql .= "i.menu_item_title, i.menu_item_protected, i.menu_item_category, "; - $sql .= "i.menu_item_icon, i.menu_item_uuid, i.menu_item_parent_uuid "; + $sql .= "i.menu_item_icon, i.menu_item_icon_color, i.menu_item_uuid, i.menu_item_parent_uuid "; $sql .= "from v_menu_items as i, v_menu_languages as l "; $sql .= "where i.menu_item_uuid = l.menu_item_uuid "; $sql .= "and l.menu_language = :menu_language "; @@ -814,7 +816,7 @@ if (!class_exists('menu')) { } //get the child menu from the database - $sql = "select i.menu_item_link, l.menu_item_title as menu_language_title, i.menu_item_title, i.menu_item_protected, i.menu_item_category, i.menu_item_icon, i.menu_item_uuid, i.menu_item_parent_uuid "; + $sql = "select i.menu_item_link, l.menu_item_title as menu_language_title, i.menu_item_title, i.menu_item_protected, i.menu_item_category, i.menu_item_icon, i.menu_item_icon_color, i.menu_item_uuid, i.menu_item_parent_uuid "; $sql .= "from v_menu_items as i, v_menu_languages as l "; $sql .= "where i.menu_item_uuid = l.menu_item_uuid "; $sql .= "and l.menu_language = :menu_language "; @@ -854,6 +856,7 @@ if (!class_exists('menu')) { $menu_item_link = $row['menu_item_link']; $menu_item_category = $row['menu_item_category']; $menu_item_icon = $row['menu_item_icon']; + $menu_item_icon_color = $row['menu_item_icon_color']; $menu_item_uuid = $row['menu_item_uuid']; $menu_item_parent_uuid = $row['menu_item_parent_uuid']; @@ -1010,7 +1013,7 @@ if (!class_exists('menu')) { $mod_a_3 = ($menu_parent['menu_item_category'] == 'external') ? "target='_blank' " : null; if ($this->settings->get('theme', 'menu_main_icons', true) === true) { if (!empty($menu_parent['menu_item_icon']) && substr($menu_parent['menu_item_icon'], 0, 3) == 'fa-') { // font awesome icon - $menu_main_icon = ""; + $menu_main_icon = ""; } else { $menu_main_icon = null; @@ -1043,7 +1046,7 @@ if (!class_exists('menu')) { $menu_sub_icon = null; if ($this->settings->get('theme', 'menu_sub_icons', true) !== false) { if (!empty($menu_sub['menu_item_icon']) && substr($menu_sub['menu_item_icon'], 0, 3) == 'fa-') { // font awesome icon - $menu_sub_icon = ""; + $menu_sub_icon = ""; } else { $menu_sub_icon = null; @@ -1211,7 +1214,7 @@ if (!class_exists('menu')) { $html .= " \n"; } if (!empty($menu_item_main['menu_item_icon']) && substr($menu_item_main['menu_item_icon'], 0, 3) == 'fa-') { // font awesome icon - $html .= ""; + $html .= ""; } $html .= "".$menu_item_main['menu_language_title'].""; $html .= "\n"; @@ -1222,7 +1225,7 @@ if (!class_exists('menu')) { $menu_sub_icon = null; if ($this->settings->get('theme', 'menu_sub_icons', true) !== false) { if (!empty($menu_item_sub['menu_item_icon']) && substr($menu_item_sub['menu_item_icon'], 0, 3) == 'fa-') { // font awesome icon - $menu_sub_icon = ""; + $menu_sub_icon = ""; } else { $menu_sub_icon = null; diff --git a/resources/fontawesome/fa_icons.php b/resources/fontawesome/fa_icons.php index 9b2e128fed..558cea25d0 100644 --- a/resources/fontawesome/fa_icons.php +++ b/resources/fontawesome/fa_icons.php @@ -113,6 +113,6 @@ if ( !empty($font_awesome_icons) && is_array($font_awesome_icons) ) { foreach ($font_awesome_icons as $icon) { - echo "\n"; + echo "\n"; } } \ No newline at end of file diff --git a/themes/default/css.php b/themes/default/css.php index b2d13c6882..746d7a87f4 100644 --- a/themes/default/css.php +++ b/themes/default/css.php @@ -772,7 +772,6 @@ else { //default: white display: inline-block; font-size: 8pt; margin: 0 0 0 8px; - opacity: 0.30; } div.menu_side_sub > a.menu_side_item_sub > span.fas, From 150eeccd5e0a175e55cab6ba1caa09eabb5332ea Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 3 Mar 2025 18:43:29 -0700 Subject: [PATCH 38/88] Add grandstream_transfer_mode_via_vpk --- resources/templates/provision/grandstream/gxp2170/{$mac}.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/templates/provision/grandstream/gxp2170/{$mac}.xml b/resources/templates/provision/grandstream/gxp2170/{$mac}.xml index 282c33c4d4..a7e742435a 100644 --- a/resources/templates/provision/grandstream/gxp2170/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2170/{$mac}.xml @@ -2138,7 +2138,11 @@ + {if isset($grandstream_transfer_mode_via_vpk)} + {$grandstream_transfer_mode_via_vpk} + {else} BlindTransfer + {/if} Yes From 6baa6973f36fcc91ea3460030646f33799d195d1 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 3 Mar 2025 18:47:28 -0700 Subject: [PATCH 39/88] Add grandstream_transfer_mode_via_vpk --- resources/templates/provision/grandstream/gxp2160/{$mac}.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/templates/provision/grandstream/gxp2160/{$mac}.xml b/resources/templates/provision/grandstream/gxp2160/{$mac}.xml index 6ece8ae8f7..5241c940a7 100644 --- a/resources/templates/provision/grandstream/gxp2160/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2160/{$mac}.xml @@ -2138,7 +2138,11 @@ + {if isset($grandstream_transfer_mode_via_vpk)} + {$grandstream_transfer_mode_via_vpk} + {else} BlindTransfer + {/if} Yes From 9fcfc7276a3fc6c57998196a27f22a2664a029ff Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 3 Mar 2025 18:50:44 -0700 Subject: [PATCH 40/88] Add grandstream_transfer_mode_via_vpk --- resources/templates/provision/grandstream/gxp2140/{$mac}.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/templates/provision/grandstream/gxp2140/{$mac}.xml b/resources/templates/provision/grandstream/gxp2140/{$mac}.xml index ca8998d462..bfea8b4834 100644 --- a/resources/templates/provision/grandstream/gxp2140/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2140/{$mac}.xml @@ -2138,7 +2138,11 @@ + {if isset($grandstream_transfer_mode_via_vpk)} + {$grandstream_transfer_mode_via_vpk} + {else} BlindTransfer + {/if} Yes From c47eac110ac28246b1483cade1c65b6ecd8d6ae9 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 3 Mar 2025 18:50:58 -0700 Subject: [PATCH 41/88] Add grandstream_transfer_mode_via_vpk --- resources/templates/provision/grandstream/gxp2135/{$mac}.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/templates/provision/grandstream/gxp2135/{$mac}.xml b/resources/templates/provision/grandstream/gxp2135/{$mac}.xml index 3038d56bbb..e0d1b4748f 100644 --- a/resources/templates/provision/grandstream/gxp2135/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2135/{$mac}.xml @@ -2138,7 +2138,11 @@ + {if isset($grandstream_transfer_mode_via_vpk)} {$grandstream_transfer_mode_via_vpk} + {else} + BlindTransfer + {/if} Yes From bb02c97c64a79cca7d866319bc6d1bc683102a81 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 3 Mar 2025 18:51:19 -0700 Subject: [PATCH 42/88] Add grandstream_transfer_mode_via_vpk --- resources/templates/provision/grandstream/gxp2130/{$mac}.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/templates/provision/grandstream/gxp2130/{$mac}.xml b/resources/templates/provision/grandstream/gxp2130/{$mac}.xml index 4de008c7a4..efb75a3402 100644 --- a/resources/templates/provision/grandstream/gxp2130/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2130/{$mac}.xml @@ -2138,7 +2138,11 @@ + {if isset($grandstream_transfer_mode_via_vpk)} + {$grandstream_transfer_mode_via_vpk} + {else} BlindTransfer + {/if} Yes From 1b19e40be4a17689024510062a660618e45d6ee8 Mon Sep 17 00:00:00 2001 From: Antonio Fernandez Date: Tue, 4 Mar 2025 12:53:23 -0500 Subject: [PATCH 43/88] Consistent email wording (#7283) --- app/extensions/app_languages.php | 52 ++++++++++++++++---------------- app/voicemails/app_languages.php | 52 ++++++++++++++++---------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/app/extensions/app_languages.php b/app/extensions/app_languages.php index ee1eee2d55..36b623abf6 100644 --- a/app/extensions/app_languages.php +++ b/app/extensions/app_languages.php @@ -2698,32 +2698,32 @@ $text['description-voicemail_password']['zh-cn'] = "在此处输入数字语音 $text['description-voicemail_password']['ja-jp'] = "ここに数値のボイスメール パスワードを入力します。"; $text['description-voicemail_password']['ko-kr'] = "여기에 숫자 음성사서함 암호를 입력합니다."; -$text['description-voicemail_mail_to']['en-us'] = "Enter the email address to send voicemail to (optional)."; -$text['description-voicemail_mail_to']['en-gb'] = "Enter the email address to send voicemail to (optional)."; -$text['description-voicemail_mail_to']['ar-eg'] = "أدخل العنوان الإلكتروني لإرسال البريد الصوتي إلى (اختياري)."; -$text['description-voicemail_mail_to']['de-at'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['de-ch'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['de-de'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['el-gr'] = "Εισαγάγετε τη διεύθυνση email στην οποία θα στείλετε αυτόματο τηλεφωνητή (προαιρετικό)."; -$text['description-voicemail_mail_to']['es-cl'] = "Ingrese una dirección de correo electrónico para enviar el correo de voz (opcional)."; -$text['description-voicemail_mail_to']['es-mx'] = "Ingrese una dirección de correo electrónico para enviar el correo de voz (opcional)."; -$text['description-voicemail_mail_to']['fr-ca'] = "Insérer le courriel où sera envoyé le message de notification (optionnel)."; -$text['description-voicemail_mail_to']['fr-fr'] = "Insérer le courriel où sera envoyé le message de notification (optionnel)."; -$text['description-voicemail_mail_to']['he-il'] = "היכנס לכתובת הדואר האלקטרוני כדי לשלוח הודעות קוליות (אופציונלי)."; -$text['description-voicemail_mail_to']['it-it'] = "Inserire l'indirizzo email a cui recapitare i messaggi vocali (opzionale)."; -$text['description-voicemail_mail_to']['ka-ge'] = "შეიყვანეთ ელფოსტის მისამართი, რომელზეც ხმოვანი ფოსტა გამოიგზავნება (არასავალდებულო)."; -$text['description-voicemail_mail_to']['nl-nl'] = "Voer het E-mail adres om de voicemail naar te sturen (optioneel)."; -$text['description-voicemail_mail_to']['pl-pl'] = "Dodaj adres email na który będą wysyłane pliki poczty głosowej"; -$text['description-voicemail_mail_to']['pt-br'] = "Insira o endereço de email para enviar o correio de voz (opcional)."; -$text['description-voicemail_mail_to']['pt-pt'] = "Introduza o endereço de email para enviar o correio de voz (opcional)."; -$text['description-voicemail_mail_to']['ro-ro'] = "Introduceți adresa de e-mail la care trimiteți mesajul vocal (opțional)."; -$text['description-voicemail_mail_to']['ru-ru'] = "Введите адрес электронной почты, чтобы отправить голосовую почту (опционально)."; -$text['description-voicemail_mail_to']['sv-se'] = "Ange E-post adressen för röstbrevlådan (valfritt)."; -$text['description-voicemail_mail_to']['uk-ua'] = "Введіть адресу електронної пошти для відправки голосового повідомлення (за бажанням)."; -$text['description-voicemail_mail_to']['tr-tr'] = "Sesli mesajın gönderileceği e-posta adresini girin (isteğe bağlı)."; -$text['description-voicemail_mail_to']['zh-cn'] = "输入要向其发送语音邮件的电子邮件地址(可选)。"; -$text['description-voicemail_mail_to']['ja-jp'] = "ボイスメールの送信先の電子メール アドレスを入力します (オプション)。"; -$text['description-voicemail_mail_to']['ko-kr'] = "음성 메일을 보낼 이메일 주소를 입력합니다(선택 사항)."; +$text['description-voicemail_mail_to']['en-us'] = "Enter the email address to send voicemail to (optional). Multiple addresses may be separated by commas."; +$text['description-voicemail_mail_to']['en-gb'] = "Enter the email address to send voicemail to (optional). Multiple addresses may be separated by commas."; +$text['description-voicemail_mail_to']['ar-eg'] = "أدخل عنوان البريد الإلكتروني لإرسال البريد الصوتي إليه (اختياري). يمكن فصل العناوين المتعددة بفواصل."; +$text['description-voicemail_mail_to']['de-at'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['de-ch'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['de-de'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['el-gr'] = "Εισαγάγετε τη διεύθυνση email για αποστολή του φωνητικού μηνύματος (προαιρετικό). Πολλαπλές διευθύνσεις μπορούν να διαχωριστούν με κόμματα."; +$text['description-voicemail_mail_to']['es-cl'] = "Ingrese la dirección de correo electrónico para enviar el correo de voz (opcional). Se pueden separar múltiples direcciones con comas."; +$text['description-voicemail_mail_to']['es-mx'] = "Ingrese la dirección de correo electrónico para enviar el correo de voz (opcional). Se pueden separar múltiples direcciones con comas."; +$text['description-voicemail_mail_to']['fr-ca'] = "Entrez l'adresse e-mail à laquelle envoyer la messagerie vocale (facultatif). Plusieurs adresses peuvent être séparées par des virgules."; +$text['description-voicemail_mail_to']['fr-fr'] = "Entrez l'adresse e-mail à laquelle envoyer la messagerie vocale (facultatif). Plusieurs adresses peuvent être séparées par des virgules."; +$text['description-voicemail_mail_to']['he-il'] = "הזן את כתובת האימייל לשליחת הדואר הקולי (אופציונלי). ניתן להפריד בין כתובות מרובות באמצעות פסיקים."; +$text['description-voicemail_mail_to']['it-it'] = "Inserisci l'indirizzo email a cui inviare la segreteria telefonica (opzionale). Più indirizzi possono essere separati da virgole."; +$text['description-voicemail_mail_to']['ka-ge'] = "შეიყვანეთ ელ.ფოსტის მისამართი, რომელზეც გაიგზავნება ხმოვანი ფოსტა (არასავალდებულო). შესაძლებელია მრავალი მისამართის მძიმით გამოყოფა."; +$text['description-voicemail_mail_to']['nl-nl'] = "Voer het e-mailadres in om de voicemail naartoe te sturen (optioneel). Meerdere adressen kunnen worden gescheiden door komma's."; +$text['description-voicemail_mail_to']['pl-pl'] = "Wprowadź adres e-mail, na który ma zostać wysłana poczta głosowa (opcjonalnie). Wiele adresów można oddzielić przecinkami."; +$text['description-voicemail_mail_to']['pt-br'] = "Digite o endereço de e-mail para enviar o correio de voz (opcional). Vários endereços podem ser separados por vírgulas."; +$text['description-voicemail_mail_to']['pt-pt'] = "Digite o endereço de e-mail para enviar o correio de voz (opcional). Vários endereços podem ser separados por vírgulas."; +$text['description-voicemail_mail_to']['ro-ro'] = "Introduceți adresa de e-mail la care se va trimite mesageria vocală (opțional). Mai multe adrese pot fi separate prin virgule."; +$text['description-voicemail_mail_to']['ru-ru'] = "Введите адрес электронной почты для отправки голосовой почты (необязательно). Несколько адресов можно разделять запятыми."; +$text['description-voicemail_mail_to']['sv-se'] = "Ange e-postadressen som röstbrevet ska skickas till (valfritt). Flera adresser kan separeras med kommatecken."; +$text['description-voicemail_mail_to']['uk-ua'] = "Введіть адресу електронної пошти для надсилання голосової пошти (необов’язково). Декілька адрес можна розділити комами."; +$text['description-voicemail_mail_to']['tr-tr'] = "Sesli mesajın gönderileceği e-posta adresini girin (isteğe bağlı). Birden fazla adres virgülle ayrılabilir."; +$text['description-voicemail_mail_to']['zh-cn'] = "输入要发送语音邮件的电子邮件地址(可选)。多个地址可用逗号分隔。"; +$text['description-voicemail_mail_to']['ja-jp'] = "ボイスメールを送信するメールアドレスを入力してください(オプション)。複数のアドレスはコンマで区切ることができます。"; +$text['description-voicemail_mail_to']['ko-kr'] = "보이스메일을 보낼 이메일 주소를 입력하세요(선택 사항). 여러 개의 주소는 쉼표로 구분할 수 있습니다."; $text['description-voicemail_local_after_email']['en-us'] = "Choose whether to keep the voicemail in the system after sending the email notification."; $text['description-voicemail_local_after_email']['en-gb'] = "Choose whether to keep the voicemail in the system after sending the email notification."; diff --git a/app/voicemails/app_languages.php b/app/voicemails/app_languages.php index 6c0ec4839a..0b1f9520e6 100644 --- a/app/voicemails/app_languages.php +++ b/app/voicemails/app_languages.php @@ -1755,32 +1755,32 @@ $text['description-voicemail_alternate_greet_id']['zh-cn'] = "默认问候语中 $text['description-voicemail_alternate_greet_id']['ja-jp'] = "デフォルトのグリーティングで使用される代替グリーティング ID。"; $text['description-voicemail_alternate_greet_id']['ko-kr'] = "기본 인사말에 사용되는 대체 인사말 ID입니다."; -$text['description-voicemail_mail_to']['en-us'] = "Enter the email address to send voicemail to. Multiple addresses may be separated by commas."; -$text['description-voicemail_mail_to']['en-gb'] = "Enter the email address to send voicemail to. Multiple addresses may be separated by commas."; -$text['description-voicemail_mail_to']['ar-eg'] = "أدخل عنوان البريد الإلكتروني لإرسال بريد صوتي إليه. يمكن فصل العناوين المتعددة بفاصلات."; -$text['description-voicemail_mail_to']['de-at'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['de-ch'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['de-de'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['el-gr'] = "Εισαγάγετε τη διεύθυνση email στην οποία θα στείλετε αυτόματο τηλεφωνητή. Πολλές διευθύνσεις μπορούν να διαχωριστούν με κόμμα."; -$text['description-voicemail_mail_to']['es-cl'] = "Ingrese las direcciones de correo a quien desee enviar el correo de voz."; -$text['description-voicemail_mail_to']['es-mx'] = "Ingrese las direcciones de correo a quien desee enviar el correo de voz."; -$text['description-voicemail_mail_to']['fr-ca'] = "Saisissez l'adresse e-mail à laquelle envoyer le message vocal. Plusieurs adresses peuvent être séparées par des virgules."; -$text['description-voicemail_mail_to']['fr-fr'] = "Saisissez l'adresse e-mail à laquelle envoyer le message vocal. Plusieurs adresses peuvent être séparées par des virgules."; -$text['description-voicemail_mail_to']['he-il'] = "הזן את כתובת הדואר האלקטרוני שאליה יש לשלוח דואר קולי. כתובות מרובות עשויות להיות מופרדות בפסיקים."; -$text['description-voicemail_mail_to']['it-it'] = "Inserire l'indirizzo email a cui spedire i messaggi vocali."; -$text['description-voicemail_mail_to']['ka-ge'] = "შეიყვანეთ ელფოსტის მისამართი, სადაც ხმოვანი ფოსტა გაიგზავნება. ერთზე მეტი მისამართი მძიმით უნდა გამოჰყოთ."; -$text['description-voicemail_mail_to']['nl-nl'] = "Voer het E-mail adres om de boodschap naar te sturen."; -$text['description-voicemail_mail_to']['pl-pl'] = "Dodaj adres email na który będą wysyłane pliki poczty głosowej"; -$text['description-voicemail_mail_to']['pt-br'] = "Insira o endereço de email para enviar o correio de voz (opcional)"; -$text['description-voicemail_mail_to']['pt-pt'] = "Introduza o endereço de email para enviar o correio de voz."; -$text['description-voicemail_mail_to']['ro-ro'] = "Introduceți adresa de e-mail la care trimiteți mesajul vocal. Adresele multiple pot fi separate prin virgule."; -$text['description-voicemail_mail_to']['ru-ru'] = "Введите адрес электронной почты для отправки голосовой почты."; -$text['description-voicemail_mail_to']['sv-se'] = "Ange E-post adressen dit meddelande skall skickas."; -$text['description-voicemail_mail_to']['uk-ua'] = "Введіть адресу E-Mail на яку надіслати голосове повідомлення"; -$text['description-voicemail_mail_to']['tr-tr'] = "Sesli mesajın gönderileceği e-posta adresini girin. Birden fazla adres virgülle ayrılabilir."; -$text['description-voicemail_mail_to']['zh-cn'] = "输入要向其发送语音邮件的电子邮件地址。 多个地址可以用逗号分隔。"; -$text['description-voicemail_mail_to']['ja-jp'] = "ボイスメールの送信先の電子メール アドレスを入力します。 複数のアドレスはカンマで区切ることができます。"; -$text['description-voicemail_mail_to']['ko-kr'] = "음성 메일을 보낼 이메일 주소를 입력합니다. 여러 주소는 쉼표로 구분할 수 있습니다."; +$text['description-voicemail_mail_to']['en-us'] = "Enter the email address to send voicemail to (optional). Multiple addresses may be separated by commas."; +$text['description-voicemail_mail_to']['en-gb'] = "Enter the email address to send voicemail to (optional). Multiple addresses may be separated by commas."; +$text['description-voicemail_mail_to']['ar-eg'] = "أدخل عنوان البريد الإلكتروني لإرسال البريد الصوتي إليه (اختياري). يمكن فصل العناوين المتعددة بفواصل."; +$text['description-voicemail_mail_to']['de-at'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['de-ch'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['de-de'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['el-gr'] = "Εισαγάγετε τη διεύθυνση email για αποστολή του φωνητικού μηνύματος (προαιρετικό). Πολλαπλές διευθύνσεις μπορούν να διαχωριστούν με κόμματα."; +$text['description-voicemail_mail_to']['es-cl'] = "Ingrese la dirección de correo electrónico para enviar el correo de voz (opcional). Se pueden separar múltiples direcciones con comas."; +$text['description-voicemail_mail_to']['es-mx'] = "Ingrese la dirección de correo electrónico para enviar el correo de voz (opcional). Se pueden separar múltiples direcciones con comas."; +$text['description-voicemail_mail_to']['fr-ca'] = "Entrez l'adresse e-mail à laquelle envoyer la messagerie vocale (facultatif). Plusieurs adresses peuvent être séparées par des virgules."; +$text['description-voicemail_mail_to']['fr-fr'] = "Entrez l'adresse e-mail à laquelle envoyer la messagerie vocale (facultatif). Plusieurs adresses peuvent être séparées par des virgules."; +$text['description-voicemail_mail_to']['he-il'] = "הזן את כתובת האימייל לשליחת הדואר הקולי (אופציונלי). ניתן להפריד בין כתובות מרובות באמצעות פסיקים."; +$text['description-voicemail_mail_to']['it-it'] = "Inserisci l'indirizzo email a cui inviare la segreteria telefonica (opzionale). Più indirizzi possono essere separati da virgole."; +$text['description-voicemail_mail_to']['ka-ge'] = "შეიყვანეთ ელ.ფოსტის მისამართი, რომელზეც გაიგზავნება ხმოვანი ფოსტა (არასავალდებულო). შესაძლებელია მრავალი მისამართის მძიმით გამოყოფა."; +$text['description-voicemail_mail_to']['nl-nl'] = "Voer het e-mailadres in om de voicemail naartoe te sturen (optioneel). Meerdere adressen kunnen worden gescheiden door komma's."; +$text['description-voicemail_mail_to']['pl-pl'] = "Wprowadź adres e-mail, na który ma zostać wysłana poczta głosowa (opcjonalnie). Wiele adresów można oddzielić przecinkami."; +$text['description-voicemail_mail_to']['pt-br'] = "Digite o endereço de e-mail para enviar o correio de voz (opcional). Vários endereços podem ser separados por vírgulas."; +$text['description-voicemail_mail_to']['pt-pt'] = "Digite o endereço de e-mail para enviar o correio de voz (opcional). Vários endereços podem ser separados por vírgulas."; +$text['description-voicemail_mail_to']['ro-ro'] = "Introduceți adresa de e-mail la care se va trimite mesageria vocală (opțional). Mai multe adrese pot fi separate prin virgule."; +$text['description-voicemail_mail_to']['ru-ru'] = "Введите адрес электронной почты для отправки голосовой почты (необязательно). Несколько адресов можно разделять запятыми."; +$text['description-voicemail_mail_to']['sv-se'] = "Ange e-postadressen som röstbrevet ska skickas till (valfritt). Flera adresser kan separeras med kommatecken."; +$text['description-voicemail_mail_to']['uk-ua'] = "Введіть адресу електронної пошти для надсилання голосової пошти (необов’язково). Декілька адрес можна розділити комами."; +$text['description-voicemail_mail_to']['tr-tr'] = "Sesli mesajın gönderileceği e-posta adresini girin (isteğe bağlı). Birden fazla adres virgülle ayrılabilir."; +$text['description-voicemail_mail_to']['zh-cn'] = "输入要发送语音邮件的电子邮件地址(可选)。多个地址可用逗号分隔。"; +$text['description-voicemail_mail_to']['ja-jp'] = "ボイスメールを送信するメールアドレスを入力してください(オプション)。複数のアドレスはコンマで区切ることができます。"; +$text['description-voicemail_mail_to']['ko-kr'] = "보이스메일을 보낼 이메일 주소를 입력하세요(선택 사항). 여러 개의 주소는 쉼표로 구분할 수 있습니다."; $text['description-voicemail_local_after_email']['en-us'] = "Choose whether to keep the voicemail in the system after sending the email notification."; $text['description-voicemail_local_after_email']['en-gb'] = "Choose whether to keep the voicemail in the system after sending the email notification."; From d529021b3fd2e51c8958e9d04d1733f7e5577554 Mon Sep 17 00:00:00 2001 From: frytimo Date: Tue, 4 Mar 2025 14:25:47 -0400 Subject: [PATCH 44/88] Use boolean setting as true boolean (#7284) * use boolean setting as true boolean * Update settings class to use the php filter_var function for boolean Using the built-in filter type for boolean seems like a better option as they are faster, already hardened, and more widely tested. I found this better method used originally by Mark J. Crane in 2022 in the content.php page so I included it here. * Update settings class to use the php filter_var function for boolean Using the built-in filter type for boolean seems like a better option as they are faster, already hardened, and more widely tested. I found this better method used originally by Mark J. Crane in 2022 in the content.php page so I included it here. --- .../resources/content.php | 4 +- app/bridges/bridges.php | 6 +-- app/call_block/call_block.php | 6 +-- app/call_broadcast/call_broadcast.php | 6 +-- app/call_centers/call_center_agents.php | 6 +-- app/call_centers/call_center_queues.php | 6 +-- app/call_centers/waveform.php | 4 +- app/call_flows/call_flows.php | 6 +-- app/call_flows/waveform.php | 4 +- app/call_forward/call_forward.php | 6 +-- app/call_forward/call_forward_edit.php | 6 +-- .../resources/classes/call_forward.php | 2 +- .../resources/classes/do_not_disturb.php | 2 +- .../resources/classes/follow_me.php | 2 +- app/call_recordings/waveform.php | 4 +- app/conference_centers/conference_centers.php | 6 +-- app/conference_centers/conference_rooms.php | 6 +-- .../conference_session_details.php | 6 +-- .../conference_sessions.php | 6 +-- app/conference_centers/waveform.php | 4 +- .../conference_control_details.php | 6 +-- .../conference_controls.php | 6 +-- .../conference_profile_params.php | 6 +-- .../conference_profiles.php | 6 +-- app/conferences/conferences.php | 6 +-- .../conferences_active_inc.php | 2 +- .../database_transactions.php | 6 +-- app/destinations/destination_imports.php | 2 +- app/destinations/destinations.php | 8 ++-- app/devices/device_profiles.php | 4 +- app/devices/device_vendor_functions.php | 4 +- app/devices/device_vendors.php | 4 +- app/dialplans/dialplan_xml.php | 6 +-- app/dialplans/dialplans.php | 22 +++++------ app/email_queue/email_queue.php | 4 +- app/email_queue/email_queue_edit.php | 8 ++-- app/event_guard/event_guard_logs.php | 4 +- app/extension_settings/extension_settings.php | 6 +-- app/extensions/extensions.php | 4 +- app/fax/fax.php | 4 +- app/fax/fax_logs.php | 4 +- app/gateways/gateways.php | 8 ++-- app/ivr_menus/ivr_menu_edit.php | 2 +- app/ivr_menus/ivr_menus.php | 6 +-- app/ivr_menus/waveform.php | 4 +- app/modules/modules.php | 6 +-- app/music_on_hold/waveform.php | 4 +- .../number_translations.php | 6 +-- app/phrases/phrases.php | 4 +- app/pin_numbers/pin_numbers.php | 4 +- app/recordings/waveform.php | 4 +- app/registrations/registrations.php | 6 +-- app/ring_groups/ring_groups.php | 4 +- app/ring_groups/waveform.php | 4 +- app/sip_profiles/sip_profiles.php | 6 +-- .../sofia_global_settings.php | 6 +-- app/streams/streams.php | 4 +- .../resources/dashboard/system_counts.php | 4 +- app/system/system.php | 6 +-- app/time_conditions/time_conditions.php | 4 +- app/vars/vars.php | 6 +-- .../voicemail_greetings.php | 4 +- app/voicemail_greetings/waveform.php | 4 +- app/voicemails/voicemail_edit.php | 16 ++++---- app/voicemails/waveform.php | 4 +- app/xml_cdr/resources/classes/xml_cdr.php | 2 +- .../resources/dashboard/missed_calls.php | 4 +- .../resources/dashboard/recent_calls.php | 4 +- app/xml_cdr/waveform.php | 4 +- app/xml_cdr/xml_cdr_inc.php | 2 +- core/contacts/contact_addresses.php | 2 +- core/contacts/contact_attachments.php | 2 +- core/contacts/contact_edit.php | 4 +- core/contacts/contact_emails.php | 6 +-- core/contacts/contact_extensions.php | 6 +-- core/contacts/contact_phones.php | 4 +- core/contacts/contact_relations.php | 6 +-- core/contacts/contact_settings.php | 6 +-- core/contacts/contact_times.php | 6 +-- core/contacts/contact_urls.php | 4 +- core/contacts/contacts.php | 6 +-- core/dashboard/dashboard.php | 4 +- core/databases/databases.php | 6 +-- core/default_settings/default_settings.php | 6 +-- core/domain_settings/domain_settings.php | 6 +-- core/domains/domains.php | 6 +-- core/email_templates/email_template_edit.php | 6 +-- core/email_templates/email_templates.php | 6 +-- core/groups/groups.php | 6 +-- core/menu/menu.php | 8 ++-- core/menu/menu_item_list.php | 8 ++-- core/user_settings/user_settings.php | 6 +-- core/users/user_edit.php | 8 ++-- core/users/users.php | 6 +-- logout.php | 2 +- resources/classes/settings.php | 38 ++----------------- resources/footer.php | 4 +- resources/php.php | 2 +- themes/default/css.php | 18 ++++----- 99 files changed, 265 insertions(+), 295 deletions(-) diff --git a/app/basic_operator_panel/resources/content.php b/app/basic_operator_panel/resources/content.php index 341a59e444..db831c2a64 100644 --- a/app/basic_operator_panel/resources/content.php +++ b/app/basic_operator_panel/resources/content.php @@ -353,7 +353,7 @@ if (is_array($activity)) { } else { //unregistered extension - if (!empty($_SESSION['operator_panel']['show_unregistered']['boolean']) && $_SESSION['operator_panel']['show_unregistered']['boolean'] == 'true') { + if (filter_var($_SESSION['operator_panel']['show_unregistered']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { $css_class = "ur_ext"; } else { @@ -551,7 +551,7 @@ if (is_array($activity)) { if (in_array($extension, $_SESSION['user']['extensions'])) { $user_extensions[] = $block; - } elseif (!empty($ext['call_group']) && filter_var($_SESSION['operator_panel']['group_extensions']['boolean'], FILTER_VALIDATE_BOOLEAN)) { + } elseif (!empty($ext['call_group']) && filter_var($_SESSION['operator_panel']['group_extensions']['boolean'] ?? false, FILTER_VALIDATE_BOOLEAN)) { $grouped_extensions[$ext['call_group']][] = $block; } else { $other_extensions[] = $block; diff --git a/app/bridges/bridges.php b/app/bridges/bridges.php index 95cf85dcef..0b263b3e60 100644 --- a/app/bridges/bridges.php +++ b/app/bridges/bridges.php @@ -47,7 +47,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get the http post data if (!empty($_POST['bridges'])) { @@ -226,7 +226,7 @@ echo th_order_by('bridge_destination', $text['label-bridge_destination'], $order_by, $order); echo th_order_by('bridge_enabled', $text['label-bridge_enabled'], $order_by, $order, null, "class='center'"); echo " ".$text['label-bridge_description']." 
".escape($row['bridge_description'])."\n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " ".$text['label-description']." 
".$row['date_formatted']." ".$row['time_formatted']."".escape($row['call_block_description']).""; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo "  
".escape($broadcast_start_time ?? '')."".escape($row['broadcast_description']).""; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo "  
".$row[agent_wrap_up_time]."".$row[agent_reject_delay_time]."".$row[agent_busy_delay_time].""; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo "  
".escape($row[queue_abandoned_resume_allowed])." ".escape($row[queue_tier_rule_wait_multiply_level])." ".escape($row['queue_description']).""; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo "  
".escape($row['call_flow_description'])." "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " " . $text['label-dnd'] . "" . $text['label-description'] . " 
" . escape($row['description']) . " "; echo button::create(['type' => 'button', 'title' => $text['button-edit'], 'icon' => $_SESSION['theme']['button_icon_edit'], 'link' => $list_row_url]); echo " \n"; - require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $options = ''; $moh = new switch_music_on_hold; echo $moh->select('hold_music', $hold_music ?? '', $options); diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php index 8a8eab1afa..53d0f9f90a 100644 --- a/app/extensions/resources/classes/extension.php +++ b/app/extensions/resources/classes/extension.php @@ -25,7 +25,6 @@ */ //define the directory class -if (!class_exists('extension')) { class extension { /** @@ -795,6 +794,3 @@ if (!class_exists('extension')) { } } -} - -?> diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index a22080e67c..8a52178671 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -29,7 +29,6 @@ require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/functions/object_to_array.php"; require_once "resources/functions/parse_message.php"; -require_once "resources/classes/text.php"; //get accounts to monitor $sql = "select d.domain_name, f.* "; diff --git a/app/fax/resources/classes/fax.php b/app/fax/resources/classes/fax.php index d3b6b8748d..e1a24157ce 100644 --- a/app/fax/resources/classes/fax.php +++ b/app/fax/resources/classes/fax.php @@ -25,7 +25,6 @@ */ //define the fax class -if (!class_exists('fax')) { class fax { /** @@ -725,7 +724,6 @@ if (!class_exists('fax')) { } } //class -} /* $o = new fax; @@ -738,5 +736,3 @@ $c->destination_number = $fax_destination_number; $c->fax_description = $fax_description; $c->dialplan(); */ - -?> \ No newline at end of file diff --git a/app/fax_queue/resources/classes/fax_queue.php b/app/fax_queue/resources/classes/fax_queue.php index f5d2897ef1..0f2378a066 100644 --- a/app/fax_queue/resources/classes/fax_queue.php +++ b/app/fax_queue/resources/classes/fax_queue.php @@ -26,12 +26,7 @@ /** * fax_queue class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('fax_queue')) { class fax_queue { /** @@ -274,6 +269,3 @@ if (!class_exists('fax_queue')) { } } } -} - -?> diff --git a/app/fax_queue/resources/service/fax_queue.php b/app/fax_queue/resources/service/fax_queue.php index 6084254ebf..db9eb1e654 100644 --- a/app/fax_queue/resources/service/fax_queue.php +++ b/app/fax_queue/resources/service/fax_queue.php @@ -8,7 +8,6 @@ //includes files require_once dirname(__DIR__, 4) . "/resources/require.php"; require_once "resources/pdo.php"; - include "resources/classes/permissions.php"; //increase limits set_time_limit(0); diff --git a/app/fifo/resources/classes/fifo.php b/app/fifo/resources/classes/fifo.php index 4338f3f48e..450f5cd4c3 100644 --- a/app/fifo/resources/classes/fifo.php +++ b/app/fifo/resources/classes/fifo.php @@ -2,12 +2,7 @@ /** * fifo class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('fifo')) { class fifo { /** @@ -283,6 +278,3 @@ if (!class_exists('fifo')) { } } -} - -?> \ No newline at end of file diff --git a/app/gateways/resources/classes/gateways.php b/app/gateways/resources/classes/gateways.php index cbfba52633..83ab122ad9 100644 --- a/app/gateways/resources/classes/gateways.php +++ b/app/gateways/resources/classes/gateways.php @@ -25,7 +25,6 @@ */ //define the gateways class -if (!class_exists('gateways')) { class gateways { /** @@ -583,6 +582,3 @@ if (!class_exists('gateways')) { } } -} - -?> \ No newline at end of file diff --git a/app/ivr_menus/resources/classes/ivr_menu.php b/app/ivr_menus/resources/classes/ivr_menu.php index 50a0fde239..2d91d84c15 100644 --- a/app/ivr_menus/resources/classes/ivr_menu.php +++ b/app/ivr_menus/resources/classes/ivr_menu.php @@ -25,7 +25,6 @@ */ //define the ivr_menu class -if (!class_exists('ivr_menu')) { class ivr_menu { /** @@ -489,6 +488,3 @@ if (!class_exists('ivr_menu')) { } } -} - -?> diff --git a/app/ivr_menus/waveform.php b/app/ivr_menus/waveform.php index 0c93872262..8b760cd949 100644 --- a/app/ivr_menus/waveform.php +++ b/app/ivr_menus/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/modules/resources/classes/modules.php b/app/modules/resources/classes/modules.php index 28b83949e0..8559b657b4 100644 --- a/app/modules/resources/classes/modules.php +++ b/app/modules/resources/classes/modules.php @@ -25,7 +25,6 @@ */ //define the modules class -if (!class_exists('modules')) { class modules { /** @@ -1101,10 +1100,8 @@ if (!class_exists('modules')) { } //class -} /* -require_once "resources/classes/modules.php"; $mod = new modules; $mod->dir = $_SESSION['switch']['mod']['dir']; echo $mod->dir."\n"; @@ -1138,5 +1135,3 @@ echo $mod->dir."\n"; //print_r($result); //echo "\n"; */ - -?> diff --git a/app/music_on_hold/music_on_hold.php b/app/music_on_hold/music_on_hold.php index 95c4443a81..ae92335afb 100644 --- a/app/music_on_hold/music_on_hold.php +++ b/app/music_on_hold/music_on_hold.php @@ -308,7 +308,6 @@ $cache = new cache; $cache->delete("configuration:local_stream.conf"); - //require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $music = new switch_music_on_hold; $music->reload(); diff --git a/app/music_on_hold/resources/classes/switch_music_on_hold.php b/app/music_on_hold/resources/classes/switch_music_on_hold.php index 71d628eca2..55d90e86b1 100644 --- a/app/music_on_hold/resources/classes/switch_music_on_hold.php +++ b/app/music_on_hold/resources/classes/switch_music_on_hold.php @@ -27,7 +27,6 @@ */ //define the switch_music_on_hold class -if (!class_exists('switch_music_on_hold')) { class switch_music_on_hold { /** @@ -85,7 +84,6 @@ if (!class_exists('switch_music_on_hold')) { } //recordings if (is_dir($_SERVER["PROJECT_ROOT"].'/app/recordings')) { - require_once "app/recordings/resources/classes/switch_recordings.php"; $recordings_c = new switch_recordings; $recordings = $recordings_c->list_recordings(); if (is_array($recordings) && sizeof($recordings) > 0) { @@ -447,12 +445,9 @@ if (!class_exists('switch_music_on_hold')) { } //method } //class -} + //build and save the XML - //require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; //$moh = new switch_music_on_hold; //$moh->xml(); //$moh->save(); - -?> \ No newline at end of file diff --git a/app/music_on_hold/waveform.php b/app/music_on_hold/waveform.php index 68087e5dde..47fafbd10c 100644 --- a/app/music_on_hold/waveform.php +++ b/app/music_on_hold/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/number_translations/resources/classes/number_translations.php b/app/number_translations/resources/classes/number_translations.php index 22a2836401..c0abf97057 100644 --- a/app/number_translations/resources/classes/number_translations.php +++ b/app/number_translations/resources/classes/number_translations.php @@ -25,7 +25,6 @@ */ //define the number translations class -if (!class_exists('number_translations')) { class number_translations { /** @@ -414,11 +413,8 @@ if (!class_exists('number_translations')) { } //method } //class -} /* $obj = new number_translations; $obj->delete(); */ - -?> \ No newline at end of file diff --git a/app/phrases/resources/classes/phrases.php b/app/phrases/resources/classes/phrases.php index 2ed6f0f893..8fa677fe8a 100644 --- a/app/phrases/resources/classes/phrases.php +++ b/app/phrases/resources/classes/phrases.php @@ -25,7 +25,6 @@ */ //define the phrases class -if (!class_exists('phrases')) { class phrases { /** @@ -431,6 +430,3 @@ if (!class_exists('phrases')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/app/pin_numbers/resources/classes/pin_numbers.php b/app/pin_numbers/resources/classes/pin_numbers.php index c0be87493e..817f21caab 100644 --- a/app/pin_numbers/resources/classes/pin_numbers.php +++ b/app/pin_numbers/resources/classes/pin_numbers.php @@ -25,7 +25,6 @@ */ //define the pin numbers class -if (!class_exists('pin_numbers')) { class pin_numbers { /** @@ -245,6 +244,3 @@ if (!class_exists('pin_numbers')) { } } -} - -?> \ No newline at end of file diff --git a/app/recordings/resources/classes/switch_recordings.php b/app/recordings/resources/classes/switch_recordings.php index dc3988ef67..f50fa1e80e 100644 --- a/app/recordings/resources/classes/switch_recordings.php +++ b/app/recordings/resources/classes/switch_recordings.php @@ -26,7 +26,6 @@ */ //define the switch_recordings class -if (!class_exists('switch_recordings')) { class switch_recordings { /** @@ -158,6 +157,3 @@ if (!class_exists('switch_recordings')) { } //method } //class -} - -?> diff --git a/app/recordings/waveform.php b/app/recordings/waveform.php index f5136b2927..07a15a5555 100644 --- a/app/recordings/waveform.php +++ b/app/recordings/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/registrations/registrations.php b/app/registrations/registrations.php index 8840050198..18720eb38d 100644 --- a/app/registrations/registrations.php +++ b/app/registrations/registrations.php @@ -88,7 +88,6 @@ $registrations = $obj->get($profile ?? null); //order the array - require_once "resources/classes/array_order.php"; $order = new array_order(); $registrations = $order->sort($registrations, 'sip-auth-realm', 'user'); diff --git a/app/ring_groups/resources/classes/ring_groups.php b/app/ring_groups/resources/classes/ring_groups.php index ceab17b711..5a9786e256 100644 --- a/app/ring_groups/resources/classes/ring_groups.php +++ b/app/ring_groups/resources/classes/ring_groups.php @@ -25,7 +25,6 @@ */ //define the ring groups class -if (!class_exists('ring_groups')) { class ring_groups { /** @@ -512,6 +511,3 @@ if (!class_exists('ring_groups')) { } } -} - -?> diff --git a/app/ring_groups/waveform.php b/app/ring_groups/waveform.php index 0c93872262..8b760cd949 100644 --- a/app/ring_groups/waveform.php +++ b/app/ring_groups/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/sip_profiles/resources/classes/sip_profiles.php b/app/sip_profiles/resources/classes/sip_profiles.php index 5d90bb5de8..2ab414a2c3 100644 --- a/app/sip_profiles/resources/classes/sip_profiles.php +++ b/app/sip_profiles/resources/classes/sip_profiles.php @@ -25,7 +25,6 @@ */ //define the sip profiles class -if (!class_exists('sip_profiles')) { class sip_profiles { /** @@ -434,6 +433,3 @@ if (!class_exists('sip_profiles')) { } } -} - -?> \ No newline at end of file diff --git a/app/sofia_global_settings/resources/classes/sofia_global_settings.php b/app/sofia_global_settings/resources/classes/sofia_global_settings.php index 289efda183..f9a1c838b3 100644 --- a/app/sofia_global_settings/resources/classes/sofia_global_settings.php +++ b/app/sofia_global_settings/resources/classes/sofia_global_settings.php @@ -26,12 +26,7 @@ /** * sofia_global_settings class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('sofia_global_settings')) { class sofia_global_settings { /** @@ -247,6 +242,3 @@ if (!class_exists('sofia_global_settings')) { } } -} - -?> \ No newline at end of file diff --git a/app/streams/resources/classes/streams.php b/app/streams/resources/classes/streams.php index 05340cdfee..2256892d8f 100644 --- a/app/streams/resources/classes/streams.php +++ b/app/streams/resources/classes/streams.php @@ -25,7 +25,6 @@ */ //define the streams class -if (!class_exists('streams')) { class streams { /** @@ -244,6 +243,3 @@ if (!class_exists('streams')) { } } -} - -?> \ No newline at end of file diff --git a/app/switch/resources/classes/presence.php b/app/switch/resources/classes/presence.php index b455c24a6d..c645f8eac4 100644 --- a/app/switch/resources/classes/presence.php +++ b/app/switch/resources/classes/presence.php @@ -23,12 +23,7 @@ /** * presence class - * - * @method boolean active - * @method array show */ - -if (!class_exists('presence')) { class presence { /** @@ -84,7 +79,6 @@ if (!class_exists('presence')) { return $array; } } -} //examples /* @@ -97,11 +91,9 @@ if (!class_exists('presence')) { echo "active: true\n"; } else { - echo "active: false\n"; + echo "active: false\n"; } //show active the presence $presence = new presence; $array = $presence->show(); */ - -?> diff --git a/app/switch/resources/classes/ringbacks.php b/app/switch/resources/classes/ringbacks.php index db05aeb98a..d206eac70b 100644 --- a/app/switch/resources/classes/ringbacks.php +++ b/app/switch/resources/classes/ringbacks.php @@ -25,7 +25,6 @@ Matthew Vale */ -if (!class_exists('ringbacks')) { class ringbacks { //define variables @@ -85,18 +84,15 @@ if (!class_exists('ringbacks')) { */ //get the tones - require_once "resources/classes/tones.php"; $tones = new tones; $this->tones_list = $tones->tones_list(); //get music on hold and recordings if (is_dir($_SERVER["PROJECT_ROOT"].'/app/music_on_hold')) { - require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $music = new switch_music_on_hold; $this->music_list = $music->get(); } if (is_dir($_SERVER["PROJECT_ROOT"].'/app/recordings')) { - require_once "app/recordings/resources/classes/switch_recordings.php"; $recordings = new switch_recordings; $this->recordings_list = $recordings->list_recordings(); } @@ -232,6 +228,3 @@ if (!class_exists('ringbacks')) { return $select; } } -} - -?> diff --git a/app/switch/resources/classes/switch_files.php b/app/switch/resources/classes/switch_files.php index 80b1b24436..c98091a624 100644 --- a/app/switch/resources/classes/switch_files.php +++ b/app/switch/resources/classes/switch_files.php @@ -26,12 +26,7 @@ /** * switch class provides methods for copying switch_files - * - * @method string correct_path - * @method string copy_scripts - * @method string copy_languages */ -if (!class_exists('switch_files')) { class switch_files { /** @@ -158,7 +153,6 @@ if (!class_exists('switch_files')) { } } -} /* //example use @@ -168,5 +162,3 @@ if (!class_exists('switch_files')) { $obj->copy_scripts(); $obj->copy_languages(); */ - -?> diff --git a/app/time_conditions/resources/classes/time_conditions.php b/app/time_conditions/resources/classes/time_conditions.php index 98a5e757df..c4be826b78 100644 --- a/app/time_conditions/resources/classes/time_conditions.php +++ b/app/time_conditions/resources/classes/time_conditions.php @@ -25,7 +25,6 @@ */ //define the time conditions class - if (!class_exists('time_conditions')) { class time_conditions { /** @@ -346,6 +345,3 @@ } //class - } - -?> diff --git a/app/vars/resources/classes/vars.php b/app/vars/resources/classes/vars.php index 3f137327d5..7018b3da36 100644 --- a/app/vars/resources/classes/vars.php +++ b/app/vars/resources/classes/vars.php @@ -25,7 +25,6 @@ */ //define the vars class -if (!class_exists('vars')) { class vars { /** @@ -258,6 +257,3 @@ if (!class_exists('vars')) { } } -} - -?> \ No newline at end of file diff --git a/app/voicemail_greetings/resources/classes/voicemail_greetings.php b/app/voicemail_greetings/resources/classes/voicemail_greetings.php index b8ae36fb28..74b50cd0d2 100644 --- a/app/voicemail_greetings/resources/classes/voicemail_greetings.php +++ b/app/voicemail_greetings/resources/classes/voicemail_greetings.php @@ -25,7 +25,6 @@ */ //define the voicemail greetings class -if (!class_exists('voicemail_greetings')) { class voicemail_greetings { /** @@ -166,6 +165,3 @@ if (!class_exists('voicemail_greetings')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/app/voicemail_greetings/waveform.php b/app/voicemail_greetings/waveform.php index 59e8032d78..78325752ef 100644 --- a/app/voicemail_greetings/waveform.php +++ b/app/voicemail_greetings/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index 771d07ed97..cfeca41e78 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -1581,7 +1581,6 @@ } //example voicemail messages - //require_once "app/voicemails/resources/classes/voicemail.php"; //$voicemail = new voicemail; //$voicemail->voicemail_uuid = $voicemail_uuid; //$voicemail->order_by = $order_by; diff --git a/app/voicemails/resources/dashboard/voicemails.php b/app/voicemails/resources/dashboard/voicemails.php index a8e88448c4..6f062a54ca 100644 --- a/app/voicemails/resources/dashboard/voicemails.php +++ b/app/voicemails/resources/dashboard/voicemails.php @@ -23,9 +23,6 @@ //voicemail echo "
\n"; -//required class - require_once "app/voicemails/resources/classes/voicemail.php"; - //get the voicemail $vm = new voicemail; $vm->domain_uuid = $_SESSION['domain_uuid']; diff --git a/app/voicemails/voicemail_message_toggle.php b/app/voicemails/voicemail_message_toggle.php index 46227bbd55..da1afc7c0c 100644 --- a/app/voicemails/voicemail_message_toggle.php +++ b/app/voicemails/voicemail_message_toggle.php @@ -47,7 +47,6 @@ //toggle the voicemail message $toggled = 0; if (is_array($voicemail_messages) && sizeof($voicemail_messages) > 0) { - require_once "resources/classes/voicemail.php"; foreach ($voicemail_messages as $voicemail_uuid => $voicemail_message_uuids) { foreach ($voicemail_message_uuids as $voicemail_message_uuid) { if (is_uuid($voicemail_uuid) && is_uuid($voicemail_message_uuid)) { diff --git a/app/voicemails/waveform.php b/app/voicemails/waveform.php index 645ef6c003..effb3842f5 100644 --- a/app/voicemails/waveform.php +++ b/app/voicemails/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 8996ca6e9d..432570f92d 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -26,10 +26,7 @@ /** * xml_cdr class provides methods for adding cdr records to the database - * - * @method boolean add */ -if (!class_exists('xml_cdr')) { class xml_cdr { /** @@ -2370,4 +2367,3 @@ if (!class_exists('xml_cdr')) { } } //class -} diff --git a/app/xml_cdr/waveform.php b/app/xml_cdr/waveform.php index b37c596109..885087ec78 100644 --- a/app/xml_cdr/waveform.php +++ b/app/xml_cdr/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/core/authentication/resources/classes/authentication.php b/core/authentication/resources/classes/authentication.php index 790f319709..9cdc02ebae 100644 --- a/core/authentication/resources/classes/authentication.php +++ b/core/authentication/resources/classes/authentication.php @@ -96,7 +96,6 @@ class authentication { //process the plugin if (file_exists($plugin)) { //run the plugin - include_once $plugin; $object = new $class_name(); $object->domain_name = $this->domain_name; $object->domain_uuid = $this->domain_uuid; diff --git a/core/authentication/resources/classes/plugins/email.php b/core/authentication/resources/classes/plugins/email.php index 900c467b36..aa0bfd4a38 100644 --- a/core/authentication/resources/classes/plugins/email.php +++ b/core/authentication/resources/classes/plugins/email.php @@ -26,8 +26,6 @@ /** * plugin_email - * - * @method email time based one time password authenticate the user */ class plugin_email { @@ -521,5 +519,3 @@ class plugin_email { } } - -?> diff --git a/core/authentication/resources/classes/plugins/ldap.php b/core/authentication/resources/classes/plugins/ldap.php index dfd499602f..de85f39089 100644 --- a/core/authentication/resources/classes/plugins/ldap.php +++ b/core/authentication/resources/classes/plugins/ldap.php @@ -209,5 +209,3 @@ class plugin_ldap { return $result; } } - -?> \ No newline at end of file diff --git a/core/authentication/resources/classes/plugins/totp.php b/core/authentication/resources/classes/plugins/totp.php index 0524335a63..ccf7b8b410 100644 --- a/core/authentication/resources/classes/plugins/totp.php +++ b/core/authentication/resources/classes/plugins/totp.php @@ -439,5 +439,3 @@ class plugin_totp { } } - -?> diff --git a/core/contacts/contacts_vcard.php b/core/contacts/contacts_vcard.php index 59dcb42b97..f9434275df 100644 --- a/core/contacts/contacts_vcard.php +++ b/core/contacts/contacts_vcard.php @@ -42,7 +42,6 @@ if (!empty($_GET)) { $text = $language->get(); //create the vcard object - require_once "resources/classes/vcard.php"; $vcard = new vcard(); //get the contact id diff --git a/core/contacts/resources/classes/contacts.php b/core/contacts/resources/classes/contacts.php index c29f0243a8..cd3de9d6d7 100644 --- a/core/contacts/resources/classes/contacts.php +++ b/core/contacts/resources/classes/contacts.php @@ -25,7 +25,6 @@ */ //define the contacts class -if (!class_exists('contacts')) { class contacts { const APP_NAME = "contacts"; @@ -277,6 +276,3 @@ if (!class_exists('contacts')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/core/dashboard/resources/classes/dashboard.php b/core/dashboard/resources/classes/dashboard.php index 34f973bd95..6ecb1ba8fa 100644 --- a/core/dashboard/resources/classes/dashboard.php +++ b/core/dashboard/resources/classes/dashboard.php @@ -26,12 +26,7 @@ /** * dashboard class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('dashboard')) { class dashboard { /** @@ -247,6 +242,3 @@ if (!class_exists('dashboard')) { } } -} - -?> diff --git a/core/databases/resources/classes/databases.php b/core/databases/resources/classes/databases.php index 8b9edee5e2..0b5a29d78c 100644 --- a/core/databases/resources/classes/databases.php +++ b/core/databases/resources/classes/databases.php @@ -25,7 +25,6 @@ */ //define the databases class -if (!class_exists('databases')) { class databases { /** @@ -169,6 +168,3 @@ if (!class_exists('databases')) { } } -} - -?> \ No newline at end of file diff --git a/core/default_settings/resources/classes/default_settings.php b/core/default_settings/resources/classes/default_settings.php index 499614b5b3..73deb9801d 100644 --- a/core/default_settings/resources/classes/default_settings.php +++ b/core/default_settings/resources/classes/default_settings.php @@ -26,12 +26,7 @@ /** * default_settings class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('default_settings')) { class default_settings { /** @@ -327,6 +322,3 @@ if (!class_exists('default_settings')) { } //method } //class -} - -?> diff --git a/core/domain_settings/resources/classes/domain_settings.php b/core/domain_settings/resources/classes/domain_settings.php index 04a7c66626..b384ab062d 100644 --- a/core/domain_settings/resources/classes/domain_settings.php +++ b/core/domain_settings/resources/classes/domain_settings.php @@ -25,7 +25,6 @@ */ //define the domain settings class -if (!class_exists('domain_settings')) { class domain_settings { /** @@ -386,6 +385,3 @@ if (!class_exists('domain_settings')) { } //method } //class -} - -?> diff --git a/core/domains/domain_edit.php b/core/domains/domain_edit.php index bc40710efb..760b8f90ba 100644 --- a/core/domains/domain_edit.php +++ b/core/domains/domain_edit.php @@ -486,7 +486,6 @@ //recreate dialplan and extension xml files if (is_readable($_SESSION['switch']['extensions']['dir'])) { - require_once $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/resources/classes/extension.php"; $extension = new extension; $extension->xml(); } diff --git a/core/email_templates/resources/classes/email_templates.php b/core/email_templates/resources/classes/email_templates.php index 027e76ee03..af7240421a 100644 --- a/core/email_templates/resources/classes/email_templates.php +++ b/core/email_templates/resources/classes/email_templates.php @@ -25,7 +25,6 @@ */ //define the email templates class -if (!class_exists('email_templates')) { class email_templates { /** @@ -244,6 +243,3 @@ if (!class_exists('email_templates')) { } } -} - -?> \ No newline at end of file diff --git a/core/events/resources/classes/events.php b/core/events/resources/classes/events.php index e3fbb373cb..dd72242c6d 100644 --- a/core/events/resources/classes/events.php +++ b/core/events/resources/classes/events.php @@ -2,9 +2,6 @@ /** * events class provides an event system - * - * @method void load_plugins - * @method dynamic __call */ class events { @@ -31,11 +28,7 @@ class events { //create the database connection //includes files - require_once dirname(__DIR__, 4) . "/resources/require.php"; - - //includes files - require_once "resources/classes/database.php"; - $database = new database; + $database = database::new(); $database->connect(); $this->db = $database->db; return $this->db = $database->db; diff --git a/core/groups/permissions_default.php b/core/groups/permissions_default.php index 30a17c6f7e..4b5b41f02e 100644 --- a/core/groups/permissions_default.php +++ b/core/groups/permissions_default.php @@ -43,7 +43,6 @@ $text = $language->get(); //permission restore default - require_once "core/groups/resources/classes/permission.php"; $permission = new permission; $permission->restore(); diff --git a/core/install/resources/classes/install.php b/core/install/resources/classes/install.php index cd9b089cb7..221d7b4c38 100644 --- a/core/install/resources/classes/install.php +++ b/core/install/resources/classes/install.php @@ -1,6 +1,5 @@ diff --git a/core/menu/menu_restore_default.php b/core/menu/menu_restore_default.php index ef46c1e998..df0c5f3c1a 100644 --- a/core/menu/menu_restore_default.php +++ b/core/menu/menu_restore_default.php @@ -51,7 +51,6 @@ } //menu restore default - //require_once "resources/classes/menu.php"; $menu = new menu; $menu->menu_uuid = $menu_uuid; $menu->menu_language = $menu_language; diff --git a/core/software/resources/classes/software.php b/core/software/resources/classes/software.php index 7a84332caf..16f8bac3d0 100644 --- a/core/software/resources/classes/software.php +++ b/core/software/resources/classes/software.php @@ -2,10 +2,7 @@ /** * software class - * - * @method string version */ -if (!class_exists('software')) { class software { /** @@ -25,6 +22,3 @@ if (!class_exists('software')) { } } -} - -?> diff --git a/core/upgrade/index.php b/core/upgrade/index.php index eb56ed9fce..5d7f1499eb 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -133,7 +133,6 @@ //load an array of the database schema and compare it with the active database if (!empty($action["upgrade_schema"]) && permission_exists("upgrade_schema")) { - require_once "resources/classes/schema.php"; $obj = new schema(); if (isset($action["data_types"]) && $action["data_types"] == 'true') { $obj->data_types = true; diff --git a/core/upgrade/upgrade.php b/core/upgrade/upgrade.php index 376c3b0a22..7fb56cc9d0 100644 --- a/core/upgrade/upgrade.php +++ b/core/upgrade/upgrade.php @@ -189,8 +189,6 @@ //run all app_defaults.php files if ($upgrade_type == 'domains') { - require_once "resources/classes/config.php"; - require_once "resources/classes/domains.php"; $domain = new domains; $domain->display_type = $display_type; $domain->upgrade(); @@ -199,7 +197,6 @@ //upgrade schema and/or data_types if ($upgrade_type == 'schema') { //get the database schema put it into an array then compare and update the database as needed. - require_once "resources/classes/schema.php"; $obj = new schema; if (isset($argv[2]) && $argv[2] == 'data_types') { $obj->data_types = true; diff --git a/core/upgrade/upgrade_domains.php b/core/upgrade/upgrade_domains.php index 99931b27a1..e2d1692b0a 100644 --- a/core/upgrade/upgrade_domains.php +++ b/core/upgrade/upgrade_domains.php @@ -46,8 +46,6 @@ } //run all app_defaults.php files - require_once "resources/classes/config.php"; - require_once "resources/classes/domains.php"; $domain = new domains; $domain->display_type = $display_type; $domain->upgrade(); diff --git a/core/upgrade/upgrade_menu.php b/core/upgrade/upgrade_menu.php index e2497f80f9..f44373c479 100644 --- a/core/upgrade/upgrade_menu.php +++ b/core/upgrade/upgrade_menu.php @@ -273,8 +273,6 @@ function do_upgrade_code_submodules() { * Execute all app_defaults.php files */ function do_upgrade_domains() { - require_once dirname(__DIR__, 2) . "/resources/classes/config.php"; - require_once dirname(__DIR__, 2) . "/resources/classes/domains.php"; $domain = new domains; $domain->display_type = 'text'; $domain->upgrade(); @@ -285,7 +283,6 @@ function do_upgrade_domains() { */ function do_upgrade_schema(bool $data_types = false) { //get the database schema put it into an array then compare and update the database as needed. - require_once dirname(__DIR__, 2) . "/resources/classes/schema.php"; $obj = new schema; $obj->data_types = $data_types; echo $obj->schema('text'); diff --git a/core/upgrade/upgrade_schema.php b/core/upgrade/upgrade_schema.php index aa60ffef8a..807631d935 100644 --- a/core/upgrade/upgrade_schema.php +++ b/core/upgrade/upgrade_schema.php @@ -59,7 +59,6 @@ $text = $language->get(); //get the database schema put it into an array then compare and update the database as needed. - require_once "resources/classes/schema.php"; $obj = new schema; if (isset($argv[1]) && $argv[1] == 'data_types') { $obj->data_types = true; diff --git a/core/user_logs/resources/classes/user_logs.php b/core/user_logs/resources/classes/user_logs.php index 041603f66f..659e3976f2 100644 --- a/core/user_logs/resources/classes/user_logs.php +++ b/core/user_logs/resources/classes/user_logs.php @@ -26,12 +26,7 @@ /** * user_logs class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('user_logs')) { class user_logs { /** @@ -151,6 +146,3 @@ if (!class_exists('user_logs')) { } } -} - -?> diff --git a/core/user_settings/resources/classes/user_settings.php b/core/user_settings/resources/classes/user_settings.php index dea8b87ab3..8819ae58b0 100644 --- a/core/user_settings/resources/classes/user_settings.php +++ b/core/user_settings/resources/classes/user_settings.php @@ -25,7 +25,6 @@ */ //define the user settings class -if (!class_exists('user_settings')) { class user_settings { /** @@ -181,6 +180,3 @@ if (!class_exists('user_settings')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/core/user_settings/user_setting_set.php b/core/user_settings/user_setting_set.php index 90dc47ed26..ef9dc20c86 100644 --- a/core/user_settings/user_setting_set.php +++ b/core/user_settings/user_setting_set.php @@ -107,7 +107,6 @@ Mark J Crane //revoke temporary permissions $p->delete('user_setting_delete', 'temp'); //reset session variables to default - require "resources/classes/domains.php"; $domain = new domains(); $domain->set(); } diff --git a/core/users/resources/classes/users.php b/core/users/resources/classes/users.php index 734ce273d9..f7424b734e 100644 --- a/core/users/resources/classes/users.php +++ b/core/users/resources/classes/users.php @@ -26,12 +26,7 @@ /** * users class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('users')) { class users { /** @@ -315,6 +310,3 @@ if (!class_exists('users')) { } } } -} - -?> diff --git a/resources/classes/auto_loader.php b/resources/classes/auto_loader.php index 1b5ed65549..74aed053e7 100644 --- a/resources/classes/auto_loader.php +++ b/resources/classes/auto_loader.php @@ -1,29 +1,37 @@ - Portions created by the Initial Developer are Copyright (C) 2008-2024 - the Initial Developer. All Rights Reserved. + The Initial Developer of the Original Code is + Mark J Crane + Portions created by the Initial Developer are Copyright (C) 2008-2024 + the Initial Developer. All Rights Reserved. - Contributor(s): - Mark J Crane -*/ + Contributor(s): + Mark J Crane + */ +/** + * Auto Loader class + * Searches for project files when a class is required. Debugging mode can be set using: + * - export DEBUG=1 + * OR + * - debug=true is appended to the url + */ class auto_loader { const FILE = 'autoloader_cache.php'; @@ -37,11 +45,20 @@ class auto_loader { */ private $apcu_enabled; + /** + * Cache path and file name + * @var string + */ + private static $cache_file = null; + public function __construct($project_path = '') { //set if we can use RAM cache $this->apcu_enabled = function_exists('apcu_enabled') && apcu_enabled(); + //set cache location + self::$cache_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . self::FILE; + //classes must be loaded before this object is registered if (!$this->load_cache()) { //cache miss so load them @@ -61,12 +78,14 @@ class auto_loader { //update RAM cache when available if ($this->apcu_enabled) { - apcu_store(self::CACHE_KEY, $this->classes); + $success = apcu_store(self::CACHE_KEY, $this->classes); + //do not save to drive when we are using apcu + if ($success) return true; } //ensure we have somewhere to put the file if (empty($file)) { - $file = sys_get_temp_dir() . '/' . self::FILE; + $file = self::$cache_file; } //export the classes array using PHP engine @@ -77,13 +96,10 @@ class auto_loader { if ($result !== false) { return true; } + + //file failed to save - send error to syslog when debugging $error_array = error_get_last(); - //send to syslog when debugging - if (!empty($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') { - openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); - syslog(LOG_WARNING, "[php][auto_loader] " . $error_array['message']); - closelog(); - } + self::log(LOG_WARNING, $error_array['message'] ?? ''); return false; } @@ -99,21 +115,21 @@ class auto_loader { //use a standard file if (empty($file)) { - $file = sys_get_temp_dir() . '/'. self::FILE; + $file = self::$cache_file; } + //use PHP engine to parse it if (file_exists($file)) { $this->classes = include $file; } - //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; + + //catch edge case of first time using apcu cache + if ($this->apcu_enabled) { + apcu_store(self::CACHE_KEY, $this->classes); } - return false; + + //return true when we have classes and false if the array is still empty + return !empty($this->classes); } public function reload_classes($project_path = '') { @@ -122,26 +138,87 @@ class auto_loader { $project_path = dirname(__DIR__, 2); } - //build the array of all classes - $search_path = []; - $search_path = array_merge($search_path, glob($project_path . '/resources/classes/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/resources/interfaces/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/resources/traits/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/*/*/resources/classes/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/*/*/resources/interfaces/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/*/*/resources/traits/*.php')); + //build the array of all locations for classes in specific order + $search_path = [ + $project_path . '/resources/interfaces/*.php', + $project_path . '/resources/traits/*.php', + $project_path . '/resources/classes/*.php', + $project_path . '/*/*/resources/interfaces/*.php', + $project_path . '/*/*/resources/traits/*.php', + $project_path . '/*/*/resources/classes/*.php', + $project_path . '/core/authentication/resources/classes/plugins/*.php', + ]; + + //get all php files for each path + $files = []; + foreach ($search_path as $path) { + $files = array_merge($files, glob($path)); + } //reset the current array $this->classes = []; - //store the class name (key) and the path (value) - foreach ($search_path as $path) { - $this->classes[basename($path, '.php')] = $path; - } + //store PHP language declared classes, interfaces, and traits + $curr_classes = get_declared_classes(); + $curr_interfaces = get_declared_interfaces(); + $curr_traits = get_declared_traits(); + //store the class name (key) and the path (value) + foreach ($files as $file) { + + //include the new class + try { + include_once $file; + } catch (Exception $e) { + //report the error + self::log(LOG_ERR, "Exception while trying to include file '$file': " . $e->getMessage()); + continue; + } + + //get the new classes + $new_classes = get_declared_classes(); + $new_interfaces = get_declared_interfaces(); + $new_traits = get_declared_traits(); + + //check for a new class + $classes = array_diff($new_classes, $curr_classes); + if (!empty($classes)) { + foreach ($classes as $class) { + $this->classes[$class] = $file; + } + //overwrite previous array with new values + $curr_classes = $new_classes; + } + + //check for a new interface + $interfaces = array_diff($new_interfaces, $curr_interfaces); + if (!empty($interfaces)) { + foreach ($interfaces as $interface) { + $this->classes[$interface] = $file; + } + //overwrite previous array with new values + $curr_interfaces = $new_interfaces; + } + + //check for a new trait + $traits = array_diff($new_traits, $curr_traits); + if (!empty($traits)) { + foreach ($traits as $trait) { + $this->classes[$trait] = $file; + } + //overwrite previous array with new values + $curr_traits = $new_traits; + } + } } - private function loader($class_name) : bool { + /** + * The loader is set to private because only the PHP engine should be calling this method + * @param string $class_name The class name that needs to be loaded + * @return bool True if the class is loaded or false when the class is not found + * @access private + */ + private function loader($class_name): bool { //sanitize the class name $class_name = preg_replace('[^a-zA-Z0-9_]', '', $class_name); @@ -161,32 +238,29 @@ class auto_loader { } //cache miss - if (!empty($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') { - openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); - syslog(LOG_WARNING, "[php][auto_loader] class not found in cache: ".$class_name); - closelog(); - } + self::log(LOG_WARNING, "class '$class_name' not found in cache"); //set project path using magic dir constant $project_path = dirname(__DIR__, 2); //build the search path array - $search_path[] = glob($project_path . "/resources/classes/".$class_name.".php"); - $search_path[] = glob($project_path . "/resources/interfaces/".$class_name.".php"); - $search_path[] = glob($project_path . "/resources/traits/".$class_name.".php"); - $search_path[] = glob($project_path . "/*/*/resources/classes/".$class_name.".php"); - $search_path[] = glob($project_path . "/*/*/resources/interfaces/".$class_name.".php"); - $search_path[] = glob($project_path . "/*/*/resources/traits/".$class_name.".php"); + $search_path[] = glob($project_path . "/resources/interfaces/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/resources/traits/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/resources/classes/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/*/*/resources/interfaces/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/*/*/resources/traits/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/*/*/resources/classes/" . $class_name . ".php"); - //find the path - $path = self::autoload_search($search_path); - if (!empty($path)) { + //collapse all entries to only the matched entry + $matches = array_filter($search_path); + if (!empty($matches)) { + $path = array_pop($matches)[0]; - //include the class or interface - include $path; + //include the class, interface, or trait + include_once $path; - //make sure to reload the cache after we found a new class - $this->reload_classes(); + //inject the class in to the array + $this->classes[$class_name] = $path; //update the cache with new classes $this->update_cache(); @@ -196,35 +270,54 @@ class auto_loader { } //send to syslog when debugging - if (!empty($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') { - openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); - syslog(LOG_WARNING, "[php][auto_loader] class not found name: ".$class_name); - closelog(); - } + self::log(LOG_ERR, "class '$class_name' not found name"); //return boolean return false; } - public static function autoload_search($array) : string { - foreach($array as $path) { - if (is_array($path) && count($path) != 0) { - foreach($path as $sub_path) { - if (!empty($sub_path) && file_exists($sub_path)) { - return $sub_path; - } - } - } - elseif (!empty($path) && file_exists($path)) { - return $path; - } + /** + * Returns a list of classes loaded by the auto_loader. If no classes have been loaded an empty array is returned. + * @return array List of classes loaded by the auto_loader or empty array + */ + public function get_class_list(): array { + if (!empty($this->classes)) { + return $this->classes; } - return ''; + return []; } - public static function clear_cache() { + public static function clear_cache(string $file = '') { + + //check for apcu cache if (function_exists('apcu_enabled') && apcu_enabled()) { apcu_delete(self::CACHE_KEY); } + + //set default file + if (empty(self::$cache_file)) { + self::$cache_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . self::FILE; + } + + //set file to clear + if (empty($file)) { + $file = self::$cache_file; + } + + //remove the file when it exists + if (file_exists($file)) { + @unlink($file); + $error_array = error_get_last(); + //send to syslog when debugging with either environment variable or debug in the url + self::log(LOG_WARNING, $error_array['message'] ?? ''); + } + } + + private static function log(int $level, string $message): void { + if (filter_var($_REQUEST['debug'] ?? false, FILTER_VALIDATE_BOOL) || filter_var(getenv('DEBUG') ?? false, FILTER_VALIDATE_BOOL)) { + openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); + syslog($level, "[auto_loader] " . $message); + closelog(); + } } } diff --git a/resources/classes/button.php b/resources/classes/button.php index c82b34551b..d7786d7418 100644 --- a/resources/classes/button.php +++ b/resources/classes/button.php @@ -25,7 +25,6 @@ Mark J Crane */ -if (!class_exists('button')) { class button { public static $collapse = 'hide-md-dn'; @@ -127,7 +126,6 @@ if (!class_exists('button')) { $button = $anchor.$button.""; } return $button; - unset($button); } private static function quote($value) { @@ -135,7 +133,6 @@ if (!class_exists('button')) { } } -} /* @@ -236,5 +233,3 @@ if (!class_exists('button')) { */ - -?> \ No newline at end of file diff --git a/resources/classes/database.php b/resources/classes/database.php index f745b8a489..28ceade452 100644 --- a/resources/classes/database.php +++ b/resources/classes/database.php @@ -3279,7 +3279,7 @@ * @see database::__construct() * @see database::connect() */ - public static function new(array $params = []) { + public static function new(array $params = []): static { if (self::$database === null) { self::$database = new database($params); if (!self::$database->is_connected()) { @@ -3326,7 +3326,6 @@ /* //example usage //find - require_once "resources/classes/database.php"; $database = new database; $database->domain_uuid = $_SESSION["domain_uuid"]; $database->type = $db_type; @@ -3343,7 +3342,6 @@ $database->find(); print_r($database->result); //insert - require_once "resources/classes/database.php"; $database = new database; $database->domain_uuid = $_SESSION["domain_uuid"]; $database->table = "v_ivr_menus"; diff --git a/resources/classes/domains.php b/resources/classes/domains.php index 2875616cdd..edb1932425 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -28,11 +28,7 @@ /** * domains class * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('domains')) { class domains { /** @@ -786,6 +782,3 @@ if (!class_exists('domains')) { } } -} - -?> diff --git a/resources/classes/email.php b/resources/classes/email.php index dc419897b0..9b046505d6 100644 --- a/resources/classes/email.php +++ b/resources/classes/email.php @@ -27,9 +27,7 @@ /** * email class * - * @method boolean send */ -if (!class_exists('email')) { class email { /** @@ -625,7 +623,7 @@ if (!class_exists('email')) { } } -} + /* $email = new email; diff --git a/resources/classes/groups.php b/resources/classes/groups.php index 2bf85c4e63..138671f38b 100644 --- a/resources/classes/groups.php +++ b/resources/classes/groups.php @@ -27,11 +27,7 @@ /** * groups class provides methods for add, delete groups, and add default groups * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('groups')) { class groups { /** @@ -534,6 +530,3 @@ if (!class_exists('groups')) { $_SESSION["user"]["group_level"] = $this->group_level; } } -} - -?> \ No newline at end of file diff --git a/resources/classes/menu.php b/resources/classes/menu.php index 9df1c94320..04489265a9 100644 --- a/resources/classes/menu.php +++ b/resources/classes/menu.php @@ -27,7 +27,6 @@ /** * menu class */ -if (!class_exists('menu')) { class menu { /** @@ -1339,4 +1338,3 @@ if (!class_exists('menu')) { } } -} diff --git a/resources/classes/message.php b/resources/classes/message.php index 936f4edd46..61e017753b 100644 --- a/resources/classes/message.php +++ b/resources/classes/message.php @@ -25,7 +25,6 @@ Matthew Vale */ -if (!class_exists('message')) { class message { static function add($message, $mood = null, $delay = null) { @@ -71,6 +70,3 @@ if (!class_exists('message')) { return $html; } } -} - -?> diff --git a/resources/classes/modal.php b/resources/classes/modal.php index e5d61a9f68..0629c4fa69 100644 --- a/resources/classes/modal.php +++ b/resources/classes/modal.php @@ -25,7 +25,6 @@ Mark J Crane */ -if (!class_exists('modal')) { class modal { static function create($array) { @@ -65,11 +64,7 @@ if (!class_exists('modal')) { $modal .= "
"; return $modal; - unset($modal); } } -} - -?> \ No newline at end of file diff --git a/resources/classes/schema.php b/resources/classes/schema.php index 3ec6c2c57f..1bd01703ff 100644 --- a/resources/classes/schema.php +++ b/resources/classes/schema.php @@ -26,8 +26,6 @@ */ //define the schema class -if (!class_exists('schema')) { - class schema { //define variables @@ -473,7 +471,6 @@ if (!class_exists('schema')) { } //get the db variables - //require_once "resources/classes/config.php"; //$config = new config; //$config_exists = $config->exists(); //$config_path = $config->find(); @@ -908,13 +905,10 @@ if (!class_exists('schema')) { } //end function } -} //example use -//require_once "resources/classes/schema.php"; //$obj = new schema; //$obj->db_type = $db_type; //$obj->schema(); //$result_array = $schema->obj['sql']; //print_r($result_array); -?> diff --git a/resources/classes/switch_settings.php b/resources/classes/switch_settings.php index 3457dba41e..e1822954cc 100644 --- a/resources/classes/switch_settings.php +++ b/resources/classes/switch_settings.php @@ -5,7 +5,6 @@ * * @method settings will add missing switch directories to default settings */ -if (!class_exists('switch_settings')) { class switch_settings { public $event_socket_ip_address; @@ -276,6 +275,3 @@ if (!class_exists('switch_settings')) { unset($array); } } -} - -?> diff --git a/resources/classes/template.php b/resources/classes/template.php index 0c932163e3..3b3d2c57f4 100644 --- a/resources/classes/template.php +++ b/resources/classes/template.php @@ -25,7 +25,6 @@ */ //define the template class - if (!class_exists('template')) { class template { public $engine; @@ -90,6 +89,3 @@ } } } - } - -?> \ No newline at end of file diff --git a/resources/classes/tones.php b/resources/classes/tones.php index 397348e660..90a8f9a08d 100644 --- a/resources/classes/tones.php +++ b/resources/classes/tones.php @@ -25,7 +25,6 @@ Matthew Vale */ -if (!class_exists('tones')) { class tones { //define variables @@ -33,7 +32,7 @@ if (!class_exists('tones')) { private $music_list; private $recordings_list; private $default_tone_label; - + //class constructor public function __construct() { //add multi-lingual support @@ -61,11 +60,8 @@ if (!class_exists('tones')) { $this->tones = $tone_list ?? ''; unset($sql, $tones, $tone, $tone_list); } - + public function tones_list() { return $this->tones; } } -} - -?> diff --git a/resources/classes/xml.php b/resources/classes/xml.php index 582595f15a..ac7d883297 100644 --- a/resources/classes/xml.php +++ b/resources/classes/xml.php @@ -1,6 +1,5 @@ diff --git a/resources/switch.php b/resources/switch.php index 906942b404..fa72e0ba13 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -948,7 +948,6 @@ if (!function_exists('save_switch_xml')) { function save_switch_xml() { if (is_readable($_SESSION['switch']['extensions']['dir'])) { if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/resources/classes/extension.php")) { - require_once $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."app/extensions/resources/classes/extension.php"; $extension = new extension; $extension->xml(); } @@ -958,7 +957,6 @@ if (!function_exists('save_switch_xml')) { save_setting_xml(); } if (file_exists($_SERVER["PROJECT_ROOT"]."/app/modules/app_config.php")) { - require_once $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/modules/resources/classes/modules.php"; $module = new modules; $module->xml(); //$msg = $module->msg; diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index a4a3525ddd..50e3f282ac 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -201,9 +201,8 @@ if (!function_exists('fax_split_dtmf')) { //includes files require_once dirname(__DIR__) . "/resources/require.php"; - include "resources/classes/event_socket.php"; - include "resources/phpmailer/class.phpmailer.php"; - include "resources/phpmailer/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded + include_once "resources/phpmailer/class.phpmailer.php"; + include_once "resources/phpmailer/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded //set php ini values ini_set('max_execution_time', 900); //15 minutes From 7897ff5b9e64c95459415b8592d66cfc2a570b99 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 12 Mar 2025 14:42:50 -0600 Subject: [PATCH 84/88] Clear the cache --- core/upgrade/upgrade.php | 1 + 1 file changed, 1 insertion(+) diff --git a/core/upgrade/upgrade.php b/core/upgrade/upgrade.php index 7fb56cc9d0..0d999aea99 100644 --- a/core/upgrade/upgrade.php +++ b/core/upgrade/upgrade.php @@ -181,6 +181,7 @@ $auto_loader = new auto_loader(); $auto_loader->reload_classes(); $auto_loader->update_cache(); + $auto_loader->clear_cache(); //get the version of the software if ($upgrade_type == 'version') { From 31a88e3a15d7399fcf198adee00cfa4891336003 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 12 Mar 2025 14:48:33 -0600 Subject: [PATCH 85/88] Update auto_loader.php --- resources/classes/auto_loader.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/classes/auto_loader.php b/resources/classes/auto_loader.php index 74aed053e7..7befa402e8 100644 --- a/resources/classes/auto_loader.php +++ b/resources/classes/auto_loader.php @@ -159,9 +159,9 @@ class auto_loader { $this->classes = []; //store PHP language declared classes, interfaces, and traits - $curr_classes = get_declared_classes(); - $curr_interfaces = get_declared_interfaces(); - $curr_traits = get_declared_traits(); + $current_classes = get_declared_classes(); + $current_interfaces = get_declared_interfaces(); + $current_traits = get_declared_traits(); //store the class name (key) and the path (value) foreach ($files as $file) { @@ -181,33 +181,33 @@ class auto_loader { $new_traits = get_declared_traits(); //check for a new class - $classes = array_diff($new_classes, $curr_classes); + $classes = array_diff($new_classes, $current_classes); if (!empty($classes)) { foreach ($classes as $class) { $this->classes[$class] = $file; } //overwrite previous array with new values - $curr_classes = $new_classes; + $current_classes = $new_classes; } //check for a new interface - $interfaces = array_diff($new_interfaces, $curr_interfaces); + $interfaces = array_diff($new_interfaces, $current_interfaces); if (!empty($interfaces)) { foreach ($interfaces as $interface) { $this->classes[$interface] = $file; } //overwrite previous array with new values - $curr_interfaces = $new_interfaces; + $current_interfaces = $new_interfaces; } //check for a new trait - $traits = array_diff($new_traits, $curr_traits); + $traits = array_diff($new_traits, $current_traits); if (!empty($traits)) { foreach ($traits as $trait) { $this->classes[$trait] = $file; } //overwrite previous array with new values - $curr_traits = $new_traits; + $current_traits = $new_traits; } } } From 95761621a661b39eba26fcf8b7cb9fd62a33d815 Mon Sep 17 00:00:00 2001 From: chansizzle <14916599+chansizzle@users.noreply.github.com> Date: Wed, 12 Mar 2025 17:39:05 -0600 Subject: [PATCH 86/88] improve emergency emailing (#7309) * improve emergency emailing 1. set emergency CID name & number to the outbound CID name & number if emergency CID name & number are not set 2. remove duplicate item in email body 3. change the hardcoded email subject '911 Emergency Call' to be dynamically provided from the event. I do not like seeing the subject '911 Emergency Call' when it is an TEST call. * improve emergency emailing 1. change the hardcoded email subject '911 Emergency Call' to be dynamically provided from the event. I do not like seeing the subject '911 Emergency Call' when it is an TEST call. 2. fix email template misspelling 3. improved email template with bold fonts --- .../resources/scripts/app/emergency/index.lua | 13 +++++++--- core/email_templates/app_defaults.php | 24 +++++++++---------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/app/switch/resources/scripts/app/emergency/index.lua b/app/switch/resources/scripts/app/emergency/index.lua index d33c5eb2a2..53c945a435 100644 --- a/app/switch/resources/scripts/app/emergency/index.lua +++ b/app/switch/resources/scripts/app/emergency/index.lua @@ -118,13 +118,18 @@ if (session and session:ready()) then sip_from_user = session:getVariable("sip_from_user"); emergency_caller_id_name = session:getVariable("emergency_caller_id_name"); emergency_caller_id_number = session:getVariable("emergency_caller_id_number"); + outbound_caller_id_name = session:getVariable("outbound_caller_id_name"); outbound_caller_id_number = session:getVariable("outbound_caller_id_number"); destination_number = session:getVariable("destination_number"); end --set the defaults -if (not emergency_caller_id_name) then emergency_caller_id_name = ''; end -if (not emergency_caller_id_number) then emergency_caller_id_number = '' end +if (not emergency_caller_id_name or emergency_caller_id_name == '') then + emergency_caller_id_name = outbound_caller_id_name +end +if (not emergency_caller_id_number or emergency_caller_id_number == '') then + emergency_caller_id_number = outbound_caller_id_number +end --no emergency emails found under domain, using default local sql = "SELECT default_setting_value "; @@ -181,6 +186,9 @@ end local t = dbh:first_row(sql); call_date = t.call_date; +-- replace the hardcoded template subject with the event +subject = event; + --send the email if (#to > 0) then --prepare the body @@ -190,7 +198,6 @@ if (#to > 0) then body = body:gsub("${emergency_caller_id_name}", emergency_caller_id_name); body = body:gsub("${emergency_caller_id_number}", emergency_caller_id_number); body = body:gsub("${sip_from_user}", sip_from_user); - body = body:gsub("${caller_id_number}", caller_id_number); body = body:gsub("${message_date}", call_date); body = body:gsub("${event}", event); body = trim(body); diff --git a/core/email_templates/app_defaults.php b/core/email_templates/app_defaults.php index de95aa70ab..f3280dd25d 100644 --- a/core/email_templates/app_defaults.php +++ b/core/email_templates/app_defaults.php @@ -510,15 +510,15 @@ $array['email_templates'][$x]['template_language'] = 'en-gb'; $array['email_templates'][$x]['template_category'] = 'plugin'; $array['email_templates'][$x]['template_subcategory'] = 'emergency'; - $array['email_templates'][$x]['template_subject'] = '911 Emergency Call'; + $array['email_templates'][$x]['template_subject'] = '\${event}'; $array['email_templates'][$x]['template_body'] = "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; - $array['email_templates'][$x]['template_body'] .= "From \${caller_id_name} \${caller_id_number}
\n"; + $array['email_templates'][$x]['template_body'] .= "From: \${caller_id_name} \${caller_id_number}
\n"; $array['email_templates'][$x]['template_body'] .= "
\n"; - $array['email_templates'][$x]['template_body'] .= "Emergency Name \${emergency_caller_id_name}
\n"; - $array['email_templates'][$x]['template_body'] .= "Emergency Name \${emergency_caller_id_number}
\n"; - $array['email_templates'][$x]['template_body'] .= "Received \${message_date}
\n"; - $array['email_templates'][$x]['template_body'] .= "Event \${event}
\n"; + $array['email_templates'][$x]['template_body'] .= "Emergency Name: \${emergency_caller_id_name}
\n"; + $array['email_templates'][$x]['template_body'] .= "Emergency Number: \${emergency_caller_id_number}
\n"; + $array['email_templates'][$x]['template_body'] .= "Received: \${message_date}
\n"; + $array['email_templates'][$x]['template_body'] .= "Event: \${event}
\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; @@ -530,15 +530,15 @@ $array['email_templates'][$x]['template_language'] = 'en-us'; $array['email_templates'][$x]['template_category'] = 'plugin'; $array['email_templates'][$x]['template_subcategory'] = 'emergency'; - $array['email_templates'][$x]['template_subject'] = '911 Emergency Call'; + $array['email_templates'][$x]['template_subject'] = '\${event}'; $array['email_templates'][$x]['template_body'] = "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; - $array['email_templates'][$x]['template_body'] .= "From \${caller_id_name} \${caller_id_number}
\n"; + $array['email_templates'][$x]['template_body'] .= "From: \${caller_id_name} \${caller_id_number}
\n"; $array['email_templates'][$x]['template_body'] .= "
\n"; - $array['email_templates'][$x]['template_body'] .= "Emergency Name \${emergency_caller_id_name}
\n"; - $array['email_templates'][$x]['template_body'] .= "Emergency Name \${emergency_caller_id_number}
\n"; - $array['email_templates'][$x]['template_body'] .= "Received \${message_date}
\n"; - $array['email_templates'][$x]['template_body'] .= "Event \${event}
\n"; + $array['email_templates'][$x]['template_body'] .= "Emergency Name: \${emergency_caller_id_name}
\n"; + $array['email_templates'][$x]['template_body'] .= "Emergency Number: \${emergency_caller_id_number}
\n"; + $array['email_templates'][$x]['template_body'] .= "Received: \${message_date}
\n"; + $array['email_templates'][$x]['template_body'] .= "Event: \${event}
\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; From bed7c8827f663bbcaa216c0d0fa02817e0826f9c Mon Sep 17 00:00:00 2001 From: frytimo Date: Wed, 12 Mar 2025 23:50:14 -0300 Subject: [PATCH 87/88] fix missing quotes on parameter default value (#7310) --- resources/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/functions.php b/resources/functions.php index cc791db9df..43b4219938 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -2118,7 +2118,7 @@ //define email button (src: https://buttons.cm) if (!function_exists('email_button')) { - function email_button($text = 'Click Here!', $link = URL, $bg_color = '#dddddd', $fg_color = '#000000', $radius = '') { + function email_button($text = 'Click Here!', $link = 'URL', $bg_color = '#dddddd', $fg_color = '#000000', $radius = '') { // default button radius $radius = !empty($radius) ? $radius : '3px'; From 6c6814b29e22b3c93b7d8e73342fcf0f22c78c5c Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 12 Mar 2025 23:39:24 -0600 Subject: [PATCH 88/88] Remove syntax that breaks older PHP Removed :static to support PHP 7.4 --- resources/classes/database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/classes/database.php b/resources/classes/database.php index 28ceade452..692dcb56cd 100644 --- a/resources/classes/database.php +++ b/resources/classes/database.php @@ -3279,7 +3279,7 @@ * @see database::__construct() * @see database::connect() */ - public static function new(array $params = []): static { + public static function new(array $params = []) { if (self::$database === null) { self::$database = new database($params); if (!self::$database->is_connected()) {