diff --git a/app/access_controls/app_defaults.php b/app/access_controls/app_defaults.php index d3ceda0e8a..a91b535865 100644 --- a/app/access_controls/app_defaults.php +++ b/app/access_controls/app_defaults.php @@ -158,7 +158,7 @@ //rescan each sip profile $sql = "select sip_profile_name from v_sip_profiles "; - $sql .= "where sip_profile_enabled = 'true'; "; + $sql .= "where sip_profile_enabled = true; "; $sip_profiles = $database->select($sql, null, 'all'); if (is_array($sip_profiles)) { foreach ($sip_profiles as $row) { diff --git a/app/active_calls/resources/classes/active_calls_service.php b/app/active_calls/resources/classes/active_calls_service.php index 07a8a32b04..77e6249447 100644 --- a/app/active_calls/resources/classes/active_calls_service.php +++ b/app/active_calls/resources/classes/active_calls_service.php @@ -881,7 +881,7 @@ class active_calls_service extends service implements websocket_service_interfac * @return array */ private static function get_domain_names(database $database): array { - return array_column($database->execute("select domain_name, domain_uuid from v_domains where domain_enabled='true'") ?: [], 'domain_name', 'domain_uuid'); + return array_column($database->execute("select domain_name, domain_uuid from v_domains where domain_enabled= true ") ?: [], 'domain_name', 'domain_uuid'); } /** @@ -890,7 +890,7 @@ class active_calls_service extends service implements websocket_service_interfac * @return string */ private static function get_domain_name_by_uuid(database $database, string $domain_uuid): string { - return $database->execute("select domain_name from v_domains where domain_enabled='true' and domain_uuid = :domain_uuid limit 1", ['domain_uuid' => $domain_uuid], 'column') ?: ''; + return $database->execute("select domain_name from v_domains where domain_enabled = true and domain_uuid = :domain_uuid limit 1", ['domain_uuid' => $domain_uuid], 'column') ?: ''; } /** @@ -899,6 +899,6 @@ class active_calls_service extends service implements websocket_service_interfac * @return string */ private static function get_domain_uuid_by_name(database $database, string $domain_name): string { - return $database->execute("select domain_uuid from v_domains where domain_enabled='true' and domain_name = :domain_name limit 1", ['domain_name' => $domain_name], 'column') ?: ''; + return $database->execute("select domain_uuid from v_domains where domain_enabled = true and domain_name = :domain_name limit 1", ['domain_name' => $domain_name], 'column') ?: ''; } } diff --git a/app/bridges/app_config.php b/app/bridges/app_config.php index d5cbbda9b0..bcfdc0f943 100644 --- a/app/bridges/app_config.php +++ b/app/bridges/app_config.php @@ -46,7 +46,7 @@ $apps[$x]['destinations'][$y]['label'] = "bridges"; $apps[$x]['destinations'][$y]['name'] = "bridges"; //$apps[$x]['destinations'][$y]['sql'] = "select bridge_name, bridge_destination, bridge_description from v_bridges "; - $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and bridge_enabled = 'true'"; + $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and bridge_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "bridge_name asc"; $apps[$x]['destinations'][$y]['field']['bridge_uuid'] = "bridge_uuid"; $apps[$x]['destinations'][$y]['field']['uuid'] = "bridge_uuid"; @@ -89,7 +89,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the destination.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'bridge_enabled'; - $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'boolean'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select to enable or disable.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'bridge_description'; diff --git a/app/bridges/bridge_edit.php b/app/bridges/bridge_edit.php index f88ba3e8ea..84951a3c9f 100644 --- a/app/bridges/bridge_edit.php +++ b/app/bridges/bridge_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) 2018-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. */ @@ -62,7 +62,7 @@ $bridge_gateways = $_POST["bridge_gateways"]; $destination_number = $_POST["destination_number"]; $bridge_destination = $_POST["bridge_destination"]; - $bridge_enabled = $_POST["bridge_enabled"] ?? 'false'; + $bridge_enabled = $_POST["bridge_enabled"]; $bridge_description = $_POST["bridge_description"]; } @@ -343,7 +343,7 @@ //get the domains $sql = "select * from v_domains "; - $sql .= "where domain_enabled = 'true' "; + $sql .= "where domain_enabled = true "; $database = new database; $domains = $database->select($sql, null, 'all'); unset($sql); @@ -351,15 +351,12 @@ //get the sip profiles $sql = "select sip_profile_name "; $sql .= "from v_sip_profiles "; - $sql .= "where sip_profile_enabled = 'true' "; + $sql .= "where sip_profile_enabled = true "; $sql .= "order by sip_profile_name asc "; $database = new database; $sip_profiles = $database->select($sql, null, 'all'); unset($sql); -//set the defaults - if (empty($bridge_enabled)) { $bridge_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -572,17 +569,16 @@ echo " ".$text['label-bridge_enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-bridge_enabled']."\n"; diff --git a/app/bridges/bridges.php b/app/bridges/bridges.php index c89fc47e8f..08492e3005 100644 --- a/app/bridges/bridges.php +++ b/app/bridges/bridges.php @@ -93,7 +93,6 @@ $sql_search = " ("; $sql_search .= " lower(bridge_name) like :search "; $sql_search .= " or lower(bridge_destination) like :search "; - $sql_search .= " or lower(bridge_enabled) like :search "; $sql_search .= " or lower(bridge_description) like :search "; $sql_search .= ") "; $parameters['search'] = '%'.$search.'%'; @@ -126,7 +125,7 @@ $offset = $rows_per_page * $page; //get the list - $sql = "select d.domain_uuid, b.bridge_uuid, d.domain_name, b.bridge_name, b.bridge_destination, bridge_enabled, bridge_description "; + $sql = "select d.domain_uuid, b.bridge_uuid, d.domain_name, b.bridge_name, b.bridge_destination, cast(bridge_enabled as text), bridge_description "; $sql .= "from v_bridges as b, v_domains as d "; $sql .= "where b.domain_uuid = d.domain_uuid "; if (!empty($show) && $show == "all" && permission_exists('bridge_all')) { diff --git a/app/call_block/app_config.php b/app/call_block/app_config.php index 69c88adb8a..51266de780 100644 --- a/app/call_block/app_config.php +++ b/app/call_block/app_config.php @@ -170,7 +170,7 @@ $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "call_block_enabled"; $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "block_call_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enable/disable blocking the call."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'call_block_description'; diff --git a/app/call_block/call_block.php b/app/call_block/call_block.php index dbbd4816f1..4850455582 100644 --- a/app/call_block/call_block.php +++ b/app/call_block/call_block.php @@ -163,7 +163,7 @@ else { $sql .= " to_char(timezone(:time_zone, insert_date), 'HH24:MI:SS am') as time_formatted, \n"; } - $sql .= " call_block_enabled, call_block_description, insert_date, insert_user, update_date, update_user "; + $sql .= " cast(call_block_enabled as text), call_block_description, insert_date, insert_user, update_date, update_user "; $sql .= "from view_call_block "; $sql .= "where true "; $parameters['time_zone'] = $time_zone; diff --git a/app/call_block/call_block_edit.php b/app/call_block/call_block_edit.php index e5b50d9e74..fde803ace7 100644 --- a/app/call_block/call_block_edit.php +++ b/app/call_block/call_block_edit.php @@ -71,7 +71,7 @@ $call_block_name = $_POST["call_block_name"] ?? null; $call_block_country_code = $_POST["call_block_country_code"] ?? null; $call_block_number = $_POST["call_block_number"] ?? null; - $call_block_enabled = $_POST["call_block_enabled"] ?? 'false'; + $call_block_enabled = $_POST["call_block_enabled"]; $call_block_description = $_POST["call_block_description"] ?? null; //get the call block app and data @@ -154,7 +154,7 @@ $sql .= "and domain_uuid = :domain_uuid "; } $sql .= "and app_uuid = 'b1b31930-d0ee-4395-a891-04df94599f1f' "; - $sql .= "and dialplan_enabled <> 'true' "; + $sql .= "and dialplan_enabled <> true "; if (!empty($domain_uuid) && is_uuid($domain_uuid)) { $parameters['domain_uuid'] = $domain_uuid; } @@ -163,7 +163,7 @@ if (!empty($rows)) { foreach ($rows as $index => $row) { $array['dialplans'][$index]['dialplan_uuid'] = $row['dialplan_uuid']; - $array['dialplans'][$index]['dialplan_enabled'] = 'true'; + $array['dialplans'][$index]['dialplan_enabled'] = true; } $p = permissions::new(); @@ -291,9 +291,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($call_block_enabled)) { $call_block_enabled = 'true'; } - //get the extensions if (permission_exists('call_block_all') || permission_exists('call_block_extension')) { $sql = "select extension_uuid, extension, number_alias, user_context, description from v_extensions "; @@ -303,7 +300,7 @@ $sql .= " or domain_uuid is null "; } $sql .= ") "; - $sql .= "and enabled = 'true' "; + $sql .= "and enabled = true "; $sql .= "order by extension asc "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $extensions = $database->select($sql, $parameters); @@ -561,17 +558,16 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr echo " ".$text['label-enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enable']."\n"; diff --git a/app/call_block/resources/classes/call_block.php b/app/call_block/resources/classes/call_block.php index 1faf6501dc..ebea5ab27e 100644 --- a/app/call_block/resources/classes/call_block.php +++ b/app/call_block/resources/classes/call_block.php @@ -314,7 +314,7 @@ $sql .= "from v_destinations as d "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and destination_prefix <> '' "; - $sql .= "and destination_enabled = 'true' "; + $sql .= "and destination_enabled = true "; $sql .= "order by count desc limit 1; "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $destination_country_code = $this->database->select($sql, $parameters ?? null, 'column'); @@ -378,7 +378,7 @@ $array['call_block'][$x]['call_block_count'] = 0; $array['call_block'][$x]['call_block_app'] = $this->call_block_app; $array['call_block'][$x]['call_block_data'] = $this->call_block_data; - $array['call_block'][$x]['call_block_enabled'] = 'true'; + $array['call_block'][$x]['call_block_enabled'] = true; $array['call_block'][$x]['date_added'] = time(); $x++; } @@ -402,7 +402,7 @@ $array['call_block'][$x]['call_block_count'] = 0; $array['call_block'][$x]['call_block_app'] = $this->call_block_app; $array['call_block'][$x]['call_block_data'] = $this->call_block_data; - $array['call_block'][$x]['call_block_enabled'] = 'true'; + $array['call_block'][$x]['call_block_enabled'] = true; $array['call_block'][$x]['date_added'] = time(); $x++; } @@ -420,13 +420,13 @@ $sql = "select dialplan_uuid from v_dialplans "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and app_uuid = '".$this->app_uuid."' "; - $sql .= "and dialplan_enabled <> 'true' "; + $sql .= "and dialplan_enabled <> true "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $rows = $this->database->select($sql, $parameters); if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $x => $row) { $array['dialplans'][$x]['dialplan_uuid'] = $row['dialplan_uuid']; - $array['dialplans'][$x]['dialplan_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_enabled'] = true; } } unset($rows, $parameters); diff --git a/app/call_block/resources/database/views/call_block.php b/app/call_block/resources/database/views/call_block.php new file mode 100644 index 0000000000..93e64edc2a --- /dev/null +++ b/app/call_block/resources/database/views/call_block.php @@ -0,0 +1,12 @@ +\n"; echo "\n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "
\n"; echo $text['description-avmd']."\n"; echo "\n"; diff --git a/app/call_centers/app_config.php b/app/call_centers/app_config.php index 4afafe6e4f..ed5957d413 100644 --- a/app/call_centers/app_config.php +++ b/app/call_centers/app_config.php @@ -327,7 +327,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_record"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date"; @@ -454,7 +454,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_tier_rules_apply"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_tier_rule_wait_second"; @@ -462,7 +462,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_tier_rule_no_agent_no_wait"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_timeout_action"; @@ -474,11 +474,11 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_abandoned_resume_allowed"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_tier_rule_wait_multiply_level"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_cid_prefix"; diff --git a/app/call_centers/app_defaults.php b/app/call_centers/app_defaults.php index 60bcd960b3..1a64d36919 100644 --- a/app/call_centers/app_defaults.php +++ b/app/call_centers/app_defaults.php @@ -150,10 +150,10 @@ if ($domains_processed == 1) { $array['dialplans'][$id]["dialplan_name"] = $row["queue_name"]; $array['dialplans'][$id]["dialplan_number"] = $row["queue_extension"]; $array['dialplans'][$id]["dialplan_context"] = $row['domain_name']; - $array['dialplans'][$id]["dialplan_continue"] = "false"; + $array['dialplans'][$id]["dialplan_continue"] = false; $array['dialplans'][$id]["dialplan_xml"] = $dialplan_xml; $array['dialplans'][$id]["dialplan_order"] = "230"; - $array['dialplans'][$id]["dialplan_enabled"] = "true"; + $array['dialplans'][$id]["dialplan_enabled"] = true; $array['dialplans'][$id]["dialplan_description"] = $row["queue_description"]; $array['dialplans'][$id]["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370"; } diff --git a/app/call_centers/call_center_agent_edit.php b/app/call_centers/call_center_agent_edit.php index e55556d823..4c985e0a26 100644 --- a/app/call_centers/call_center_agent_edit.php +++ b/app/call_centers/call_center_agent_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): @@ -83,7 +83,7 @@ $agent_wrap_up_time = $_POST["agent_wrap_up_time"]; $agent_reject_delay_time = $_POST["agent_reject_delay_time"]; $agent_busy_delay_time = $_POST["agent_busy_delay_time"]; - $agent_record = $_POST["agent_record"] ?? 'false'; + $agent_record = $_POST["agent_record"]; //$agent_logout = $_POST["agent_logout"]; } @@ -265,7 +265,23 @@ //pre-populate the form if (!empty($_GET["id"]) && is_uuid($_GET["id"]) && empty($_POST["persistformvar"])) { $call_center_agent_uuid = $_GET["id"]; - $sql = "select * from v_call_center_agents "; + $sql = "select "; + $sql .= "call_center_agent_uuid, "; + $sql .= "user_uuid, "; + $sql .= "agent_name, "; + $sql .= "agent_type, "; + $sql .= "agent_call_timeout, "; + $sql .= "agent_id, "; + $sql .= "agent_password, "; + $sql .= "agent_status, "; + $sql .= "agent_contact, "; + $sql .= "agent_no_answer_delay_time, "; + $sql .= "agent_max_no_answer, "; + $sql .= "agent_wrap_up_time, "; + $sql .= "agent_reject_delay_time, "; + $sql .= "agent_busy_delay_time, "; + $sql .= "agent_record "; + $sql .= "from v_call_center_agents "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and call_center_agent_uuid = :call_center_agent_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; @@ -495,17 +511,16 @@ echo " ".$text['label-record_template']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-record_template']."\n"; diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index be488ed7f2..7d7dd63990 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -123,8 +123,8 @@ $queue_max_wait_time_with_no_agent_time_reached = $_POST["queue_max_wait_time_with_no_agent_time_reached"]; $queue_tier_rules_apply = $_POST["queue_tier_rules_apply"]; $queue_tier_rule_wait_second = $_POST["queue_tier_rule_wait_second"]; - $queue_tier_rule_wait_multiply_level = $_POST["queue_tier_rule_wait_multiply_level"] ?? 'false'; - $queue_tier_rule_no_agent_no_wait = $_POST["queue_tier_rule_no_agent_no_wait"] ?? 'false'; + $queue_tier_rule_wait_multiply_level = $_POST["queue_tier_rule_wait_multiply_level"]; + $queue_tier_rule_no_agent_no_wait = $_POST["queue_tier_rule_no_agent_no_wait"]; $queue_timeout_action = $_POST["queue_timeout_action"] ?? null; $queue_discard_abandoned_after = $_POST["queue_discard_abandoned_after"]; $queue_abandoned_resume_allowed = $_POST["queue_abandoned_resume_allowed"]; @@ -454,7 +454,7 @@ $array['dialplans'][0]["dialplan_continue"] = "false"; $array['dialplans'][0]["dialplan_xml"] = $dialplan_xml; $array['dialplans'][0]["dialplan_order"] = "230"; - $array['dialplans'][0]["dialplan_enabled"] = "true"; + $array['dialplans'][0]["dialplan_enabled"] = true; $array['dialplans'][0]["dialplan_description"] = $queue_description; $array['dialplans'][0]["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370"; @@ -557,7 +557,41 @@ //pre-populate the form if (!empty($_GET) && is_uuid($_GET["id"]) && empty($_POST["persistformvar"])) { $call_center_queue_uuid = $_GET["id"]; - $sql = "select * from v_call_center_queues "; + $sql = "select "; + $sql = "select "; + $sql .= "queue_name, "; + $sql .= "dialplan_uuid, "; + $sql .= "queue_extension, "; + $sql .= "queue_greeting, "; + $sql .= "queue_language, "; + $sql .= "queue_dialect, "; + $sql .= "queue_voice , "; + $sql .= "queue_strategy, "; + $sql .= "queue_moh_sound, "; + $sql .= "queue_record_template, "; + $sql .= "queue_time_base_score, "; + $sql .= "queue_time_base_score_sec, "; + $sql .= "queue_max_wait_time, "; + $sql .= "queue_max_wait_time_with_no_agent, "; + $sql .= "queue_max_wait_time_with_no_agent_time_reached, "; + $sql .= "queue_timeout_action, "; + $sql .= "queue_tier_rules_apply, "; + $sql .= "queue_tier_rule_wait_second, "; + $sql .= "queue_tier_rule_wait_multiply_level, "; + $sql .= "queue_tier_rule_no_agent_no_wait, "; + $sql .= "queue_discard_abandoned_after, "; + $sql .= "queue_abandoned_resume_allowed, "; + $sql .= "queue_cid_prefix, "; + $sql .= "queue_outbound_caller_id_name, "; + $sql .= "queue_outbound_caller_id_number, "; + $sql .= "queue_announce_position, "; + $sql .= "queue_announce_sound, "; + $sql .= "queue_announce_frequency, "; + $sql .= "queue_cc_exit_keys, "; + $sql .= "queue_email_address, "; + $sql .= "queue_context, "; + $sql .= "queue_description "; + $sql .= "from v_call_center_queues "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and call_center_queue_uuid = :call_center_queue_uuid "; $parameters['domain_uuid'] = $domain_uuid; @@ -661,16 +695,11 @@ if (empty($queue_strategy)) { $queue_strategy = "longest-idle-agent"; } if (empty($queue_moh_sound)) { $queue_moh_sound = "\$\${hold_music}"; } if (empty($queue_time_base_score)) { $queue_time_base_score = "system"; } - if (empty($queue_time_base_score)) { $queue_time_base_score = ""; } if (empty($queue_max_wait_time)) { $queue_max_wait_time = "0"; } if (empty($queue_max_wait_time_with_no_agent)) { $queue_max_wait_time_with_no_agent = "90"; } if (empty($queue_max_wait_time_with_no_agent_time_reached)) { $queue_max_wait_time_with_no_agent_time_reached = "30"; } - if (empty($queue_tier_rules_apply)) { $queue_tier_rules_apply = "false"; } if (empty($queue_tier_rule_wait_second)) { $queue_tier_rule_wait_second = "30"; } - if (empty($queue_tier_rule_wait_multiply_level)) { $queue_tier_rule_wait_multiply_level = "true"; } - if (empty($queue_tier_rule_no_agent_no_wait)) { $queue_tier_rule_no_agent_no_wait = "true"; } if (empty($queue_discard_abandoned_after)) { $queue_discard_abandoned_after = "900"; } - if (empty($queue_abandoned_resume_allowed)) { $queue_abandoned_resume_allowed = "false"; } if (empty($queue_context)) { $queue_context = $domain_name; } //create token @@ -1076,17 +1105,16 @@ echo " ".$text['label-record_template']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-record_template']."\n"; @@ -1177,17 +1205,16 @@ echo " ".$text['label-tier_rules_apply']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-tier_rules_apply']."\n"; @@ -1210,17 +1237,16 @@ echo " ".$text['label-tier_rule_wait_multiply_level']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-tier_rule_wait_multiply_level']."\n"; @@ -1232,17 +1258,16 @@ echo " ".$text['label-tier_rule_no_agent_no_wait']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-tier_rule_no_agent_no_wait']."\n"; @@ -1265,17 +1290,16 @@ echo " ".$text['label-abandoned_resume_allowed']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-abandoned_resume_allowed']."\n"; diff --git a/app/call_centers/resources/classes/call_center.php b/app/call_centers/resources/classes/call_center.php index 11ce9dc30e..d558394dc7 100644 --- a/app/call_centers/resources/classes/call_center.php +++ b/app/call_centers/resources/classes/call_center.php @@ -97,9 +97,9 @@ $dialplan["dialplan_name"] = ($this->queue_name != '') ? $this->queue_name : format_phone($this->destination_number); $dialplan["dialplan_number"] = $this->destination_number; $dialplan["dialplan_context"] = $_SESSION['domain_name']; - $dialplan["dialplan_continue"] = "false"; + $dialplan["dialplan_continue"] = false; $dialplan["dialplan_order"] = "210"; - $dialplan["dialplan_enabled"] = "true"; + $dialplan["dialplan_enabled"] = true; $dialplan["dialplan_description"] = $this->queue_description; $dialplan_detail_order = 10; diff --git a/app/call_flows/app_config.php b/app/call_flows/app_config.php index 2766358c78..43adadde44 100644 --- a/app/call_flows/app_config.php +++ b/app/call_flows/app_config.php @@ -36,7 +36,7 @@ $apps[$x]['destinations'][$y]['label'] = "call_flows"; $apps[$x]['destinations'][$y]['name'] = "call_flows"; $apps[$x]['destinations'][$y]['sql'] = "select call_flow_name as name, call_flow_uuid, call_flow_uuid as uuid, call_flow_extension as destination, call_flow_extension as extension, call_flow_context as context from v_call_flows "; - $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and call_flow_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and call_flow_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "natural_sort(call_flow_extension) asc"; $apps[$x]['destinations'][$y]['field']['call_flow_uuid'] = "call_flow_uuid"; $apps[$x]['destinations'][$y]['field']['name'] = "call_flow_name"; @@ -51,7 +51,7 @@ $apps[$x]['destinations'][$y]['label'] = "call_flows"; $apps[$x]['destinations'][$y]['name'] = "call_flows"; $apps[$x]['destinations'][$y]['sql'] = "select call_flow_name as name, call_flow_uuid, call_flow_uuid as uuid, call_flow_feature_code as extension, call_flow_feature_code as destination, call_flow_context as context from v_call_flows "; - $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and call_flow_feature_code is not null and call_flow_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and call_flow_feature_code is not null and call_flow_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "natural_sort(call_flow_feature_code) asc"; $apps[$x]['destinations'][$y]['field']['uuid'] = "uuid"; $apps[$x]['destinations'][$y]['field']['name'] = "name"; @@ -200,7 +200,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the alernate application data."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "call_flow_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select whether to enable or disable the call flow"; $z++; diff --git a/app/call_flows/app_defaults.php b/app/call_flows/app_defaults.php index 86d7938dd9..292dc1ef5e 100644 --- a/app/call_flows/app_defaults.php +++ b/app/call_flows/app_defaults.php @@ -28,7 +28,7 @@ if ($domains_processed == 1) { //update the dialplan order - $sql = "update v_call_flows set call_flow_enabled = 'true' where call_flow_enabled is null;\n"; + $sql = "update v_call_flows set call_flow_enabled = true where call_flow_enabled is null;\n"; $database->execute($sql); unset($sql); diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index 53e217b405..c1c32b6b40 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_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): @@ -84,7 +84,7 @@ $call_flow_alternate_sound = $_POST["call_flow_alternate_sound"]; $call_flow_alternate_destination = $_POST["call_flow_alternate_destination"]; $call_flow_context = $_POST["call_flow_context"]; - $call_flow_enabled = $_POST["call_flow_enabled"] ?? 'false'; + $call_flow_enabled = $_POST["call_flow_enabled"]; $call_flow_description = $_POST["call_flow_description"]; //seperate the action and the param @@ -364,9 +364,6 @@ $call_flow_context = $_SESSION['domain_name']; } -//set the defaults - if (empty($call_flow_enabled)) { $call_flow_enabled = 'true'; } - //get the sounds $sounds = new sounds; $audio_files = $sounds->get(); @@ -770,17 +767,16 @@ echo " ".$text['label-enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "\n"; echo "\n"; diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index 746ab6d4ad..6f866495b2 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -115,7 +115,6 @@ $parameters['domain_uuid'] = $_SESSION['domain_uuid']; } $sql .= $sql_search ?? ''; - $database = new database; $num_rows = $database->select($sql, $parameters ?? null, 'column'); //prepare to page the results @@ -131,10 +130,35 @@ $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(*)', '*', $sql ?? ''); + $sql = "select "; + $sql .= "call_flow_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "call_flow_name, "; + $sql .= "call_flow_extension, "; + $sql .= "call_flow_feature_code, "; + $sql .= "call_flow_context, "; + $sql .= "call_flow_status, "; + $sql .= "call_flow_pin_number, "; + $sql .= "call_flow_label, "; + $sql .= "call_flow_sound, "; + $sql .= "call_flow_app, "; + $sql .= "call_flow_data, "; + $sql .= "call_flow_alternate_label, "; + $sql .= "call_flow_alternate_sound, "; + $sql .= "call_flow_alternate_app, "; + $sql .= "call_flow_alternate_data, "; + $sql .= "cast(call_flow_enabled as text), "; + $sql .= "call_flow_description "; + $sql .= "from v_call_flows "; + $sql .= "where true "; + if ($show != "all" || !permission_exists('call_flow_all')) { + $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + } + $sql .= $sql_search ?? ''; $sql .= order_by($order_by, $order, 'call_flow_name', 'asc', $sort); $sql .= limit_offset($rows_per_page, $offset); - $database = new database; $call_flows = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); diff --git a/app/call_forward/call_forward.php b/app/call_forward/call_forward.php index 58ca8adb23..a0c63949c3 100644 --- a/app/call_forward/call_forward.php +++ b/app/call_forward/call_forward.php @@ -305,7 +305,7 @@ if (!empty($extensions)) { $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']); + $list_row_url = PROJECT_PATH . "/app/call_forward/call_forward_edit.php?id=".$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'; } @@ -341,13 +341,13 @@ //---------------------------------- echo " \n"; - echo $row['forward_all_enabled'] == 'true' ? escape(format_phone($row['forward_all_destination'])) : ' '; + echo $row['forward_all_enabled'] == true ? escape(format_phone($row['forward_all_destination'])) : ' '; echo " \n"; } if (permission_exists('follow_me')) { //-- inline toggle ----------------- //get destination count - //if ($row['follow_me_enabled'] == 'true' && is_uuid($row['follow_me_uuid'])) { + //if ($row['follow_me_enabled'] == true && is_uuid($row['follow_me_uuid'])) { // $sql = "select count(*) from v_follow_me_destinations "; // $sql .= "where follow_me_uuid = :follow_me_uuid "; // $sql .= "and domain_uuid = :domain_uuid "; @@ -370,7 +370,7 @@ //---------------------------------- //get destination count $follow_me_destination_count = 0; - if ($row['follow_me_enabled'] == 'true' && is_uuid($row['follow_me_uuid'])) { + if ($row['follow_me_enabled'] == true && is_uuid($row['follow_me_uuid'])) { $sql = "select count(*) from v_follow_me_destinations "; $sql .= "where follow_me_uuid = :follow_me_uuid "; $sql .= "and domain_uuid = :domain_uuid "; diff --git a/app/call_forward/call_forward_edit.php b/app/call_forward/call_forward_edit.php index 12899683f3..70ec717637 100644 --- a/app/call_forward/call_forward_edit.php +++ b/app/call_forward/call_forward_edit.php @@ -38,6 +38,15 @@ exit; } +//set toggle defaults + $forward_all_enabled = false; + $forward_busy_enabled = false; + $forward_no_answer_enabled = false; + $forward_user_not_registered_enabled = false; + $do_not_disturb = false; + $follow_me_enabled = false; + $follow_me_ignore_busy = false; + //add multi-lingual support $language = new text; $text = $language->get(); @@ -80,7 +89,6 @@ } $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['extension_uuid'] = $extension_uuid; - $database = new database; $row = $database->select($sql, $parameters, 'row'); if (!empty($row)) { $extension = $row["extension"]; @@ -90,15 +98,15 @@ $effective_caller_id_number = $row["effective_caller_id_number"]; $outbound_caller_id_name = $row["outbound_caller_id_name"]; $outbound_caller_id_number = $row["outbound_caller_id_number"]; - $do_not_disturb = !empty($row["do_not_disturb"]) ? $row["do_not_disturb"] : 'false'; + $do_not_disturb = filter_var($row["do_not_disturb"], FILTER_VALIDATE_BOOLEAN); $forward_all_destination = $row["forward_all_destination"]; - $forward_all_enabled = $row["forward_all_enabled"]; + $forward_all_enabled = filter_var($row["forward_all_enabled"], FILTER_VALIDATE_BOOLEAN); $forward_busy_destination = $row["forward_busy_destination"]; - $forward_busy_enabled = $row["forward_busy_enabled"]; + $forward_busy_enabled = filter_var($row["forward_busy_enabled"], FILTER_VALIDATE_BOOLEAN); $forward_no_answer_destination = $row["forward_no_answer_destination"]; - $forward_no_answer_enabled = $row["forward_no_answer_enabled"]; + $forward_no_answer_enabled = filter_var($row["forward_no_answer_enabled"], FILTER_VALIDATE_BOOLEAN); $forward_user_not_registered_destination = $row["forward_user_not_registered_destination"]; - $forward_user_not_registered_enabled = $row["forward_user_not_registered_enabled"]; + $forward_user_not_registered_enabled = filter_var($row["forward_user_not_registered_enabled"], FILTER_VALIDATE_BOOLEAN); $follow_me_uuid = $row["follow_me_uuid"]; } else { @@ -111,35 +119,33 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { //get http post variables and set them to php variables - if (!empty($_POST)) { - $forward_all_enabled = !empty($_POST["forward_all_destination"]) ? $_POST["forward_all_enabled"] : 'false'; - $forward_all_destination = $_POST["forward_all_destination"]; - $forward_busy_enabled = !empty($_POST["forward_busy_destination"]) ? $_POST["forward_busy_enabled"] : 'false'; - $forward_busy_destination = $_POST["forward_busy_destination"]; - $forward_no_answer_enabled = !empty($_POST["forward_no_answer_destination"]) ? $_POST["forward_no_answer_enabled"] : 'false'; - $forward_no_answer_destination = $_POST["forward_no_answer_destination"]; - $forward_user_not_registered_enabled = !empty($_POST["forward_user_not_registered_destination"]) ? $_POST["forward_user_not_registered_enabled"] : 'false'; - $forward_user_not_registered_destination = $_POST["forward_user_not_registered_destination"]; + $forward_all_enabled = filter_var($_POST["forward_all_enabled"], FILTER_VALIDATE_BOOLEAN); + $forward_all_destination = $_POST["forward_all_destination"]; + $forward_busy_enabled = filter_var($_POST["forward_busy_enabled"], FILTER_VALIDATE_BOOLEAN); + $forward_busy_destination = $_POST["forward_busy_destination"]; + $forward_no_answer_enabled = filter_var($_POST["forward_no_answer_enabled"], FILTER_VALIDATE_BOOLEAN); + $forward_no_answer_destination = $_POST["forward_no_answer_destination"]; + $forward_user_not_registered_enabled = filter_var($_POST["forward_user_not_registered_enabled"], FILTER_VALIDATE_BOOLEAN); + $forward_user_not_registered_destination = $_POST["forward_user_not_registered_destination"]; + $do_not_disturb = filter_var($_POST["do_not_disturb"], FILTER_VALIDATE_BOOLEAN); - $cid_name_prefix = $_POST["cid_name_prefix"] ?? ''; - $cid_number_prefix = $_POST["cid_number_prefix"] ?? ''; - $follow_me_enabled = $_POST["follow_me_enabled"]; - $follow_me_ignore_busy = $_POST["follow_me_ignore_busy"]; + $cid_name_prefix = $_POST["cid_name_prefix"] ?? ''; + $cid_number_prefix = $_POST["cid_number_prefix"] ?? ''; + $follow_me_enabled = filter_var($_POST["follow_me_enabled"], FILTER_VALIDATE_BOOLEAN); + $follow_me_ignore_busy = filter_var($_POST["follow_me_ignore_busy"], FILTER_VALIDATE_BOOLEAN); - $n = 0; - $destination_found = false; - foreach ($_POST["destinations"] as $field) { - $destinations[$n]['uuid'] = $field['uuid']; - $destinations[$n]['destination'] = $field['destination']; - $destinations[$n]['delay'] = $field['delay']; - $destinations[$n]['prompt'] = $field['prompt']; - $destinations[$n]['timeout'] = $field['timeout']; - if (!empty($field['destination'])) { - $destination_found = true; - } - $n++; + $n = 0; + $destination_found = false; + foreach ($_POST["destinations"] as $field) { + $destinations[$n]['uuid'] = $field['uuid']; + $destinations[$n]['destination'] = $field['destination']; + $destinations[$n]['delay'] = $field['delay']; + $destinations[$n]['prompt'] = $field['prompt']; + $destinations[$n]['timeout'] = $field['timeout']; + if (isset($field['destination'])) { + $destination_found = true; } - $dnd_enabled = $_POST["dnd_enabled"]; + $n++; } //validate the token @@ -176,13 +182,13 @@ //build the array $array['extensions'][0]['domain_uuid'] = $_SESSION['domain_uuid']; $array['extensions'][0]['extension_uuid'] = $extension_uuid; - $array['extensions'][0]['forward_all_enabled'] = $forward_all_enabled; + $array['extensions'][0]['forward_all_enabled'] = $forward_all_enabled ? 'true' : 'false'; $array['extensions'][0]['forward_all_destination'] = $forward_all_destination; - $array['extensions'][0]['forward_busy_enabled'] = $forward_busy_enabled; + $array['extensions'][0]['forward_busy_enabled'] = $forward_busy_enabled ? 'true' : 'false'; $array['extensions'][0]['forward_busy_destination'] = $forward_busy_destination; - $array['extensions'][0]['forward_no_answer_enabled'] = $forward_no_answer_enabled; + $array['extensions'][0]['forward_no_answer_enabled'] = $forward_no_answer_enabled ? 'true' : 'false'; $array['extensions'][0]['forward_no_answer_destination'] = $forward_no_answer_destination; - $array['extensions'][0]['forward_user_not_registered_enabled'] = $forward_user_not_registered_enabled; + $array['extensions'][0]['forward_user_not_registered_enabled'] = $forward_user_not_registered_enabled ? 'true' : 'false'; $array['extensions'][0]['forward_user_not_registered_destination'] = $forward_user_not_registered_destination; } @@ -190,7 +196,7 @@ if (permission_exists('do_not_disturb')) { $array['extensions'][0]['domain_uuid'] = $_SESSION['domain_uuid']; $array['extensions'][0]['extension_uuid'] = $extension_uuid; - $array['extensions'][0]['do_not_disturb'] = $dnd_enabled; + $array['extensions'][0]['do_not_disturb'] = $do_not_disturb ? 'true' : 'false'; } //follow me config @@ -203,24 +209,15 @@ $array['extensions'][0]['extension_uuid'] = $extension_uuid; $array['extensions'][0]['follow_me_uuid'] = $follow_me_uuid; } - if ($destination_found) { - $array['extensions'][0]['follow_me_enabled'] = $follow_me_enabled; - } - else { - $array['extensions'][0]['follow_me_enabled'] = 'false'; - } + $array['extensions'][0]['follow_me_enabled'] = ($destination_found && $follow_me_enabled) ? 'true' : 'false'; + //build the follow me array $array['follow_me'][0]['domain_uuid'] = $_SESSION['domain_uuid']; $array['follow_me'][0]['follow_me_uuid'] = $follow_me_uuid; $array['follow_me'][0]['cid_name_prefix'] = $cid_name_prefix; $array['follow_me'][0]['cid_number_prefix'] = $cid_number_prefix; - $array['follow_me'][0]['follow_me_ignore_busy'] = $follow_me_ignore_busy; - if ($destination_found) { - $array['follow_me'][0]['follow_me_enabled'] = $follow_me_enabled; - } - else { - $array['follow_me'][0]['follow_me_enabled'] = 'false'; - } + $array['follow_me'][0]['follow_me_ignore_busy'] = $follow_me_ignore_busy ? 'true' : 'false'; + $array['follow_me'][0]['follow_me_enabled'] = ($destination_found && $follow_me_enabled) ? 'true' : 'false'; $d = 0; $destination_found = false; @@ -252,7 +249,6 @@ $p->add("extension_edit", "temp"); //save the data - $database = new database; $database->app_name = 'call_forward'; $database->app_uuid = '19806921-e8ed-dcff-b325-dd3e5da4959d'; $database->save($array); @@ -266,7 +262,6 @@ foreach ($follow_me_delete_uuids as $follow_me_delete_uuid) { $array['follow_me_destinations'][]['follow_me_destination_uuid'] = $follow_me_delete_uuid; } - $database = new database; $database->app_name = 'call_forward'; $database->app_uuid = '19806921-e8ed-dcff-b325-dd3e5da4959d'; $database->delete($array); @@ -291,11 +286,11 @@ $dnd->domain_name = $_SESSION['domain_name']; $dnd->extension_uuid = $extension_uuid; $dnd->extension = $extension; - $dnd->enabled = $dnd_enabled; + $dnd->enabled = $do_not_disturb ? 'true' : 'false'; } //if follow me is enabled then process call forward and dnd first - if ($follow_me_enabled == "true") { + if ($follow_me_enabled) { //call forward $call_forward->set(); unset($call_forward); @@ -318,8 +313,8 @@ } //if dnd or call forward are enabled process them last - if ($follow_me_enabled != "true") { - if ($forward_all_enabled == "true") { + if ($follow_me_enabled != true) { + if ($forward_all_enabled == true) { //dnd $dnd->set(); $dnd->user_status(); @@ -346,7 +341,7 @@ $feature_event_notify = new feature_event_notify; $feature_event_notify->domain_name = $_SESSION['domain_name']; $feature_event_notify->extension = $extension; - $feature_event_notify->do_not_disturb = $dnd_enabled; + $feature_event_notify->do_not_disturb = $do_not_disturb ? 'true' : 'false'; $feature_event_notify->ring_count = $ring_count; $feature_event_notify->forward_all_enabled = $forward_all_enabled; $feature_event_notify->forward_busy_enabled = $forward_busy_enabled; @@ -378,7 +373,7 @@ //send presence event if (permission_exists('do_not_disturb')) { - if ($dnd_enabled == 'true') { + if ($do_not_disturb) { //build the event $cmd = "sendevent PRESENCE_IN\n"; $cmd .= "proto: sip\n"; @@ -420,7 +415,7 @@ } //synchronize configuration - if (!empty($_SESSION['switch']['extensions']['dir']) && is_readable($_SESSION['switch']['extensions']['dir'])) { + if (!empty($settings->get('switch', 'extensions')) && is_readable($settings->get('switch', 'extensions'))) { $ext = new extension; $ext->xml(); unset($ext); @@ -435,6 +430,11 @@ //add the message message::add($text['confirm-update']); + + // redirect + header('Location: call_forward_edit.php?id='.$extension_uuid); + exit; + } //show the header @@ -448,22 +448,21 @@ $sql .= "and follow_me_uuid = :follow_me_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['follow_me_uuid'] = $follow_me_uuid; - $database = new database; $row = $database->select($sql, $parameters, 'row'); unset($sql, $parameters); if (!empty($row)) { $cid_name_prefix = $row["cid_name_prefix"]; $cid_number_prefix = $row["cid_number_prefix"]; - $follow_me_enabled = $row["follow_me_enabled"]; - $follow_me_ignore_busy = $row["follow_me_ignore_busy"]; + $follow_me_enabled = filter_var($row["follow_me_enabled"], FILTER_VALIDATE_BOOLEAN); + $follow_me_ignore_busy = filter_var($row["follow_me_ignore_busy"], FILTER_VALIDATE_BOOLEAN); + unset($row); $sql = "select * from v_follow_me_destinations "; $sql .= "where follow_me_uuid = :follow_me_uuid "; $sql .= "order by follow_me_order asc "; $parameters['follow_me_uuid'] = $follow_me_uuid; - $database = new database; $result = $database->select($sql, $parameters, 'all'); unset($destinations); @@ -479,7 +478,7 @@ } //add the pre-defined follow me destinations - for ($n = 0; $n <= (((!empty($_SESSION['follow_me']['max_destinations']['numeric'])) ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) { + for ($n = 0; $n <= $settings->get('follow_me', 'max_destinations', 5) - 1; $n++) { if (empty($destinations[$n]['uuid'])) { $destinations[$n]['uuid'] = null; } if (empty($destinations[$n]['destination'])) { $destinations[$n]['destination'] = null; } if (empty($destinations[$n]['delay'])) { $destinations[$n]['delay'] = null; } @@ -492,16 +491,9 @@ $sql .= "where domain_uuid = :domain_uuid "; $sql .= "order by extension, number_alias asc "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $database = new database; $extensions = $database->select($sql, $parameters, 'all'); unset($sql, $parameters, $row); -//set the default - if (empty($dnd_enabled)) { - //set the value from the database - $dnd_enabled = $do_not_disturb; - } - //prepare the autocomplete if ($settings->get('follow_me', 'follow_me_autocomplete', false)) { echo "\n"; @@ -518,7 +510,7 @@ } } echo " ];\n"; - for ($n = 0; $n <= (((!empty($_SESSION['follow_me']['max_destinations']['numeric'])) ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) { + for ($n = 0; $n <= $settings->get('follow_me', 'max_destinations', 5) - 1; $n++) { echo " \$(\"#destination_".$n."\").autocomplete({\n"; echo " source: extensions\n"; echo " });\n"; @@ -558,40 +550,29 @@ echo " ".$text['label-call_forward']."\n"; echo "\n"; echo "\n"; - - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo "\n"; - echo "\n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - $on_click = "$('#div_follow_me_settings').slideUp('fast'); "; - $on_click .= "document.getElementById('follow_me_disabled').checked = true; "; - $on_click .= "document.getElementById('dnd_disabled').checked = true; "; - $on_click .= "document.getElementById('forward_all_destination').focus(); "; - $on_click2 = "(document.getElementById('follow_me_enabled').checked) ? $('#div_follow_me_settings').slideDown('fast') : '' "; - echo " \n"; - echo " \n"; - unset($on_click); - echo "  "; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + echo " "; } - - echo " "; - echo " \n"; + echo " \n"; echo "
".$text['description-call_forward']."\n"; echo "\n"; echo "\n"; @@ -601,30 +582,27 @@ echo " ".$text['label-on-busy']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo "\n"; - echo "\n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - $on_click = "document.getElementById('dnd_disabled').checked = true;"; - $on_click .= "document.getElementById('forward_busy_destination').focus();"; - echo " \n"; - echo " \n"; - unset($on_click); - echo "  "; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + echo " "; } - echo " "; - echo " \n"; + echo " \n"; echo "
".$text['description-on-busy']."\n"; echo "\n"; echo "\n"; @@ -634,30 +612,27 @@ echo " ".$text['label-no_answer']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo "\n"; - echo "\n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - $on_click = "document.getElementById('dnd_disabled').checked = true;"; - $on_click .= "document.getElementById('forward_no_answer_destination').focus();"; - echo " \n"; - echo " \n"; - unset($on_click); - echo "  "; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + echo " "; } - echo " "; - echo " \n"; + echo " \n"; echo "
".$text['description-no_answer']."\n"; echo "\n"; echo "\n"; @@ -667,171 +642,164 @@ echo " ".$text['label-not_registered']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo "\n"; - echo "\n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - $on_click = "document.getElementById('forward_user_not_registered_destination').focus();"; - echo " \n"; - echo " \n"; - unset($on_click); - echo "  "; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + echo " "; } - echo " "; - echo " \n"; + echo " \n"; echo "
".$text['description-not_registered']."\n"; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo " ".$text['label-follow_me']."\n"; + echo "\n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } + echo "
\n"; + + echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - if (!empty($follow_me_enabled) && $follow_me_enabled == "true" && $dnd_enabled != "true" && $forward_all_enabled != "true") { $style = ''; } else { $style = 'display: none;'; } - echo "
\n"; - - echo "
\n"; - echo " ".$text['label-follow_me']."\n"; + echo " ".$text['label-destinations']."\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo "\n"; - echo "\n"; + + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if (permission_exists('follow_me_prompt')) { + echo " \n"; } - else { - $on_click = "document.getElementById('forward_all_disabled').checked = true; "; - $on_click .= "document.getElementById('dnd_disabled').checked = true; "; - echo " \n"; - echo " \n"; - unset($on_click); - } - echo "\n"; - echo "\n"; - echo "
".$text['label-destination_number']."".$text['label-destination_delay']."".$text['label-destination_timeout']."".$text['label-destination_prompt']."
\n"; + echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + + if (permission_exists('follow_me_ignore_busy')) { + echo " \n"; + echo " \n"; + echo "
\n"; - echo " ".$text['label-destinations']."\n"; - echo "\n"; - - echo " \n"; + //output destinations + $on_click = ""; + foreach ($destinations as $n => $destination) { + echo " \n"; echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; if (permission_exists('follow_me_prompt')) { - echo " \n"; + echo " \n"; } echo " \n"; + } - //output destinations - $on_click = ""; - foreach ($destinations as $n => $destination) { - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - if (permission_exists('follow_me_prompt')) { - echo " \n"; - } - echo " \n"; + echo "
".$text['label-destination_number']."".$text['label-destination_delay']."".$text['label-destination_timeout']."\n"; + destination_select('destinations['.$n.'][delay]', $destination['delay'], '0'); + echo " \n"; + destination_select('destinations['.$n.'][timeout]', $destination['timeout'], $settings->get('follow_me', 'timeout', 30)); + echo " ".$text['label-destination_prompt']."\n"; + echo " \n"; + echo "
\n"; - destination_select('destinations['.$n.'][delay]', $destination['delay'], '0'); - echo " \n"; - destination_select('destinations['.$n.'][timeout]', $destination['timeout'], ((!empty($_SESSION['follow_me']['timeout']['numeric'])) ? $_SESSION['follow_me']['timeout']['numeric'] : 30)); - echo " \n"; - echo " \n"; - echo "
\n"; + echo "
"; + echo $text['label-ignore_busy']; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - echo "
\n"; + echo "
\n"; + echo $text['description-ignore_busy']."\n"; + echo " \n"; + echo " \n"; + } + + if (permission_exists('follow_me_cid_name_prefix')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-cid-name-prefix']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-cid-name-prefix']."\n"; echo "\n"; echo "\n"; + } - if (permission_exists('follow_me_ignore_busy')) { - echo " \n"; - echo " "; - echo $text['label-ignore_busy']; - echo " \n"; - echo " \n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if (permission_exists('follow_me_cid_number_prefix')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-cid-number-prefix']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-cid-number-prefix']."\n"; + echo "\n"; + echo "\n"; + } - } - else { - echo " \n"; - echo " \n"; - } - echo "
\n"; - echo $text['description-ignore_busy']."\n"; - echo " \n"; - echo " \n"; - } + echo "\n"; - if (permission_exists('follow_me_cid_name_prefix')) { - echo "\n"; - echo "\n"; - echo " ".$text['label-cid-name-prefix']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-cid-name-prefix']."\n"; - echo "\n"; - echo "\n"; - } - - if (permission_exists('follow_me_cid_number_prefix')) { - echo "\n"; - echo "\n"; - echo " ".$text['label-cid-number-prefix']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-cid-number-prefix']."\n"; - echo "\n"; - echo "\n"; - } - - // echo "
\n"; - echo "\n"; - - echo "
\n"; + echo "\n"; echo "\n"; echo "\n"; @@ -840,24 +808,23 @@ echo " ".$text['label-dnd']."\n"; echo "\n"; echo "\n"; @@ -876,5 +843,3 @@ //include the footer require_once "resources/footer.php"; - -?> diff --git a/app/call_forward/resources/dashboard/call_forward.php b/app/call_forward/resources/dashboard/call_forward.php index 3fbfce2273..6d88229ac2 100644 --- a/app/call_forward/resources/dashboard/call_forward.php +++ b/app/call_forward/resources/dashboard/call_forward.php @@ -52,7 +52,7 @@ $sql .= "where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; } - $sql .= "and enabled = 'true' "; + $sql .= "and enabled = true "; if (!permission_exists('extension_edit')) { if (is_array($_SESSION['user']['extension']) && count($_SESSION['user']['extension']) > 0) { $sql .= "and ("; @@ -84,13 +84,13 @@ if (is_array($extensions) && @sizeof($extensions) != 0) { foreach ($extensions as $row) { if (permission_exists('call_forward')) { - $stats['call_forward'] += $row['forward_all_enabled'] == 'true' && $row['forward_all_destination'] ? 1 : 0; + $stats['call_forward'] += $row['forward_all_enabled'] == true && $row['forward_all_destination'] ? 1 : 0; } if (permission_exists('follow_me')) { - $stats['follow_me'] += $row['follow_me_enabled'] == 'true' && is_uuid($row['follow_me_uuid']) ? 1 : 0; + $stats['follow_me'] += $row['follow_me_enabled'] == true && is_uuid($row['follow_me_uuid']) ? 1 : 0; } if (permission_exists('do_not_disturb')) { - $stats['dnd'] += $row['do_not_disturb'] == 'true' ? 1 : 0; + $stats['dnd'] += $row['do_not_disturb'] == true ? 1 : 0; } } $stats['active'] = @sizeof($extensions) - $stats['call_forward'] - $stats['follow_me'] - $stats['dnd']; @@ -223,7 +223,7 @@ if (permission_exists('follow_me')) { //get destination count $follow_me_destination_count = 0; - if ($row['follow_me_enabled'] == 'true' && is_uuid($row['follow_me_uuid'])) { + if ($row['follow_me_enabled'] == true && is_uuid($row['follow_me_uuid'])) { $sql = "select count(*) from v_follow_me_destinations "; $sql .= "where follow_me_uuid = :follow_me_uuid "; $sql .= "and domain_uuid = :domain_uuid "; diff --git a/app/call_recordings/resources/database/views/call_recordings.php b/app/call_recordings/resources/database/views/call_recordings.php new file mode 100644 index 0000000000..4f25f9df88 --- /dev/null +++ b/app/call_recordings/resources/database/views/call_recordings.php @@ -0,0 +1,14 @@ + - 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): @@ -82,7 +82,7 @@ $conference_center_extension = $_POST["conference_center_extension"]; $conference_center_greeting = $_POST["conference_center_greeting"]; $conference_center_pin_length = $_POST["conference_center_pin_length"]; - $conference_center_enabled = $_POST["conference_center_enabled"] ?? 'false'; + $conference_center_enabled = $_POST["conference_center_enabled"]; $conference_center_description = $_POST["conference_center_description"]; //validate the token @@ -233,7 +233,6 @@ } //set defaults - if (empty($conference_center_enabled)) { $conference_center_enabled = "true"; } if (empty($conference_center_pin_length)) { $conference_center_pin_length = 9; } //get the sounds @@ -453,17 +452,16 @@ echo " ".$text['label-conference_center_enabled']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -737,21 +712,17 @@ echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -761,21 +732,17 @@ echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -785,21 +752,17 @@ echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -809,21 +772,17 @@ echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -833,21 +792,17 @@ echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -868,21 +823,17 @@ echo "\n"; echo "\n"; echo "\n"; @@ -919,17 +870,16 @@ echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; diff --git a/app/conference_controls/app_config.php b/app/conference_controls/app_config.php index ae5ecf285a..390f31cdbe 100644 --- a/app/conference_controls/app_config.php +++ b/app/conference_controls/app_config.php @@ -85,7 +85,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the conference control name."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "control_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the stats of the control."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "control_description"; @@ -151,7 +151,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the data."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "control_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the status of the control."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date"; diff --git a/app/conference_controls/app_defaults.php b/app/conference_controls/app_defaults.php index 853e39370d..4ae4fcb8c4 100644 --- a/app/conference_controls/app_defaults.php +++ b/app/conference_controls/app_defaults.php @@ -83,7 +83,7 @@ $control_action = $p['@attributes']['action']; $control_digits = $p['@attributes']['digits']; $control_data = $p['@attributes']['data']; - $control_enabled = 'true'; + $control_enabled = true; //add the coference profile params $conference_control_detail_uuid = uuid(); diff --git a/app/conference_controls/conference_control_detail_edit.php b/app/conference_controls/conference_control_detail_edit.php index 62789b4860..0cd8f21353 100644 --- a/app/conference_controls/conference_control_detail_edit.php +++ b/app/conference_controls/conference_control_detail_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) 2018-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -65,7 +65,7 @@ $control_digits = $_POST["control_digits"]; $control_action = $_POST["control_action"]; $control_data = $_POST["control_data"]; - $control_enabled = $_POST["control_enabled"] ?? 'false'; + $control_enabled = $_POST["control_enabled"]; } //process the http post @@ -155,9 +155,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($control_enabled)) { $control_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -219,17 +216,16 @@ echo " ".$text['label-control_enabled']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -1817,17 +1811,16 @@ echo "\n"; echo "\n"; @@ -2017,17 +2010,16 @@ echo " ".$text['label-device_enabled']."\n"; echo "\n"; echo "\n"; + if (permission_exists('device_key_extension')) { echo " \n"; } + if (permission_exists('device_key_protected')) { echo " \n"; } + echo " \n"; @@ -711,17 +715,16 @@ echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -821,4 +816,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 486638d8e8..dff992153f 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -191,7 +191,7 @@ } //set additional variables - $dialplan_enabled = $_POST["dialplan_enabled"] ?? 'false'; + $dialplan_enabled = $_POST["dialplan_enabled"] ?? false; $dialplan_description = $_POST["dialplan_description"]; } @@ -438,7 +438,7 @@ $dialplan_order ='333'; } $dialplan_context = $_SESSION['domain_name']; - $dialplan_continue = 'false'; + $dialplan_continue = false; $app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'; //set the uuid @@ -451,7 +451,7 @@ $array['dialplans'][$x]['app_uuid'] = $app_uuid; $array['dialplans'][$x]['dialplan_name'] = 'call_direction-outbound'.(empty($dialplan_description) && !empty($abbrv) ? '.'.$abbrv : null); $array['dialplans'][$x]['dialplan_order'] = '22'; - $array['dialplans'][$x]['dialplan_continue'] = 'true'; + $array['dialplans'][$x]['dialplan_continue'] = true; $array['dialplans'][$x]['dialplan_context'] = $dialplan_context; $array['dialplans'][$x]['dialplan_enabled'] = $dialplan_enabled; $array['dialplans'][$x]['dialplan_description'] = $dialplan_description; @@ -464,7 +464,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'false'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; @@ -474,7 +474,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = '^$'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; @@ -484,7 +484,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $dialplan_expression; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; @@ -495,7 +495,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_inline'] = 'true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $x++; @@ -521,7 +521,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'false'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; if (!empty($toll_allow)) { @@ -533,7 +533,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $toll_allow; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; } @@ -545,7 +545,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $dialplan_expression; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; if ($gateway_type != "transfer") { if (!empty($accountcode)) { @@ -558,7 +558,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'sip_h_accountcode='.$accountcode; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'false'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = false; } else { $y++; @@ -570,7 +570,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'sip_h_accountcode=${accountcode}'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'false'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = false; } } @@ -584,7 +584,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_inline'] = 'true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); @@ -595,7 +595,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'call_timeout'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; if ($gateway_type != "transfer") { $y++; @@ -607,7 +607,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'hangup_after_bridge=true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); @@ -623,7 +623,7 @@ } $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); @@ -639,7 +639,7 @@ } $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; if ($dialplan_expression == '(^911$|^933$)') { $y++; @@ -651,7 +651,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'call_date=${strftime(%d-%b-%Y %r)}'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'false'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = false; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; @@ -661,7 +661,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = "app.lua emergency 1"; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'false'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = false; } $y++; @@ -673,7 +673,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'inherit_codec=true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); @@ -684,7 +684,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'ignore_display_updates=true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); @@ -695,7 +695,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'callee_id_number=$1'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); @@ -706,7 +706,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'continue_on_fail=1,2,3,6,18,21,27,28,31,34,38,41,42,44,58,88,111,403,501,602,607,809'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } if ($gateway_type == "enum" || $gateway_2_type == "enum") { @@ -719,7 +719,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $prefix_number."$1 e164.org"; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } if (!empty($limit)) { @@ -732,7 +732,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = "hash \${domain_name} outbound ".$limit." !USER_BUSY"; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } if (!empty($outbound_prefix)) { @@ -745,7 +745,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'outbound_prefix='.$outbound_prefix; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } if ($pin_numbers_enable == "true") { @@ -758,7 +758,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'pin_number=database'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; $y++; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); @@ -769,7 +769,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'pin_number.lua'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } if (strlen($prefix_number) > 2) { @@ -782,7 +782,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'provider_prefix='.$prefix_number; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } if ($gateway_type == "transfer") { $dialplan_detail_type = 'transfer'; } else { $dialplan_detail_type = 'bridge'; } @@ -795,7 +795,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $bridge_data; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; if (!empty($bridge_2_data)) { $y++; @@ -807,7 +807,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $bridge_2_data; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } if (!empty($bridge_3_data)) { @@ -820,7 +820,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $bridge_3_data; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } unset($bridge_data); @@ -870,14 +870,14 @@ //get the domains $sql = "select * from v_domains "; - $sql .= "where domain_enabled = 'true' "; + $sql .= "where domain_enabled = true "; $database = new database; $domains = $database->select($sql, null, 'all'); unset($sql); //get the gateways $sql = "select * from v_gateways "; - $sql .= "where enabled = 'true' "; + $sql .= "where enabled = true "; if (permission_exists('outbound_route_any_gateway')) { $sql .= "order by CASE WHEN domain_uuid = :domain_uuid THEN 0 ELSE 1 END, domain_uuid DESC, gateway "; } @@ -893,7 +893,7 @@ //get the bridges if (permission_exists('bridge_view')) { $sql = "select * from v_bridges "; - $sql .= "where bridge_enabled = 'true' "; + $sql .= "where bridge_enabled = true "; $sql .= "and domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $domain_uuid; $database = new database; @@ -901,9 +901,6 @@ unset($sql, $parameters); } -//set defaults - if (empty($dialplan_enabled)) { $dialplan_enabled = "true"; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -1342,17 +1339,16 @@ function type_onchange(dialplan_detail_type) { echo " ".$text['label-enabled']."\n"; echo "\n"; echo "\n"; echo " \n"; diff --git a/app/dialplans/dialplan_edit.php b/app/dialplans/dialplan_edit.php index 4a4c9d4667..536b2bffbd 100644 --- a/app/dialplans/dialplan_edit.php +++ b/app/dialplans/dialplan_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-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -96,10 +96,10 @@ $dialplan_name = $_POST["dialplan_name"]; $dialplan_number = $_POST["dialplan_number"]; $dialplan_order = $_POST["dialplan_order"]; - $dialplan_continue = $_POST["dialplan_continue"] ?? 'false'; + $dialplan_continue = $_POST["dialplan_continue"]; $dialplan_details = $_POST["dialplan_details"] ?? null; $dialplan_context = $_POST["dialplan_context"]; - $dialplan_enabled = $_POST["dialplan_enabled"] ?? 'false'; + $dialplan_enabled = $_POST["dialplan_enabled"]; $dialplan_description = $_POST["dialplan_description"]; $dialplan_details_delete = $_POST["dialplan_details_delete"] ?? null; if (!empty($dialplan_details_delete)) { @@ -265,7 +265,7 @@ $array['dialplans'][$x]['dialplan_context'] = $_POST["dialplan_context"]; $array['dialplans'][$x]['dialplan_continue'] = $_POST["dialplan_continue"]; $array['dialplans'][$x]['dialplan_order'] = $_POST["dialplan_order"]; - $array['dialplans'][$x]['dialplan_enabled'] = $_POST["dialplan_enabled"] ?? 'false'; + $array['dialplans'][$x]['dialplan_enabled'] = $_POST["dialplan_enabled"]; $array['dialplans'][$x]['dialplan_description'] = $_POST["dialplan_description"]; $y = 0; if (!empty($_POST["dialplan_details"]) && is_array($_POST["dialplan_details"])) { @@ -312,7 +312,6 @@ $array['dialplans'][$x]['dialplan_xml'] = $dialplan_array[$dialplan_uuid]; //add or update the database - $database = new database; $database->app_name = 'dialplans'; $database->app_uuid = $app_uuid ?? null; $database->uuid($dialplan_uuid); @@ -353,10 +352,23 @@ //pre-populate the form if (!empty($_GET) && count($_GET) > 0 && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) { - $sql = "select * from v_dialplans "; + $sql = "select "; + $sql .= "domain_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "app_uuid, "; + $sql .= "hostname, "; + $sql .= "dialplan_context, "; + $sql .= "dialplan_name, "; + $sql .= "dialplan_number, "; + $sql .= "dialplan_destination, "; + $sql .= "dialplan_continue, "; + $sql .= "dialplan_xml, "; + $sql .= "dialplan_order, "; + $sql .= "dialplan_enabled, "; + $sql .= "dialplan_description "; + $sql .= "from v_dialplans "; $sql .= "where dialplan_uuid = :dialplan_uuid "; $parameters['dialplan_uuid'] = $dialplan_uuid; - $database = new database; $row = $database->select($sql, $parameters, 'row'); if (is_array($row) && @sizeof($row) != 0) { $domain_uuid = $row["domain_uuid"]; @@ -381,18 +393,17 @@ $dialplan_order = '200'; } if (empty($dialplan_destination)) { - $dialplan_destination = 'false'; + $dialplan_destination = false; } //get the dialplan details in an array $sql = "select "; $sql .= "domain_uuid, dialplan_uuid, dialplan_detail_uuid, dialplan_detail_tag, dialplan_detail_type, dialplan_detail_data, "; - $sql .= "dialplan_detail_break, dialplan_detail_inline, dialplan_detail_group, dialplan_detail_order, cast(dialplan_detail_enabled as text) "; + $sql .= "dialplan_detail_break, dialplan_detail_inline, dialplan_detail_group, dialplan_detail_order, dialplan_detail_enabled "; $sql .= "from v_dialplan_details "; $sql .= "where dialplan_uuid = :dialplan_uuid "; $sql .= "order by dialplan_detail_group asc, dialplan_detail_order asc"; $parameters['dialplan_uuid'] = $dialplan_uuid; - $database = new database; $result = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -476,7 +487,7 @@ $details[$group][$x]['dialplan_detail_inline'] = ''; $details[$group][$x]['dialplan_detail_group'] = $group; $details[$group][$x]['dialplan_detail_order'] = $dialplan_detail_order; - $details[$group][$x]['dialplan_detail_enabled'] = 'true'; + $details[$group][$x]['dialplan_detail_enabled'] = true; } } @@ -639,17 +650,16 @@ echo " ".$text['label-continue']."\n"; echo " \n"; echo " \n"; echo " \n"; @@ -692,13 +702,13 @@ echo " \n"; echo " \n"; echo " \n"; @@ -837,11 +846,6 @@ $dialplan_detail_order = $row['dialplan_detail_order']; $dialplan_detail_enabled = $row['dialplan_detail_enabled']; - //default to enabled true - if (empty($dialplan_detail_enabled)) { - $dialplan_detail_enabled = 'true'; - } - //no border on last row $no_border = ($index == 999) ? "border: none;" : null; @@ -949,7 +953,6 @@ // retrieve gateway name from db $sql = "select gateway from v_gateways where gateway_uuid = :gateway_uuid "; $parameters['gateway_uuid'] = $bridge_statement[3]; - $database = new database; $gateways = $database->select($sql, $parameters, 'all'); if (is_array($gateways) && @sizeof($gateways) != 0) { $gateway_name = $gateways[0]['gateway']; @@ -1037,13 +1040,13 @@ echo "\n"; //enabled echo "\n"; //tools diff --git a/app/dialplans/dialplans.php b/app/dialplans/dialplans.php index dc822a3425..9804b403d2 100644 --- a/app/dialplans/dialplans.php +++ b/app/dialplans/dialplans.php @@ -123,7 +123,6 @@ $sql .= "app_uuid = 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4' "; $sql .= "where dialplan_context = 'public' "; $sql .= "and app_uuid is null; "; - $database = new database; $database->execute($sql); unset($sql); } @@ -178,8 +177,6 @@ $sql .= " lower(dialplan_context) like :search "; $sql .= " or lower(dialplan_name) like :search "; $sql .= " or lower(dialplan_number) like :search "; - $sql .= " or lower(dialplan_continue) like :search "; - $sql .= " or lower(dialplan_enabled) like :search "; $sql .= " or lower(dialplan_description) like :search "; if (is_numeric($search)) { $sql .= " or dialplan_order = :search_numeric "; @@ -188,7 +185,6 @@ $sql .= ") "; $parameters['search'] = '%'.$search.'%'; } - $database = new database; $num_rows = $database->select($sql, $parameters ?? null, 'column'); //prepare the paging @@ -214,7 +210,21 @@ $offset = $rows_per_page * $page; //get the list of dialplans - $sql = "select * from v_dialplans "; + $sql = "select "; + $sql .= "domain_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "app_uuid, "; + $sql .= "hostname, "; + $sql .= "dialplan_context, "; + $sql .= "dialplan_name, "; + $sql .= "dialplan_number, "; + $sql .= "dialplan_destination, "; + $sql .= "cast(dialplan_continue as text), "; + $sql .= "dialplan_xml, "; + $sql .= "dialplan_order, "; + $sql .= "cast(dialplan_enabled as text), "; + $sql .= "dialplan_description "; + $sql .= "from v_dialplans "; if ($show == "all" && permission_exists('dialplan_all')) { $sql .= "where true "; } @@ -252,8 +262,6 @@ $sql .= " lower(dialplan_context) like :search "; $sql .= " or lower(dialplan_name) like :search "; $sql .= " or lower(dialplan_number) like :search "; - $sql .= " or lower(dialplan_continue) like :search "; - $sql .= " or lower(dialplan_enabled) like :search "; $sql .= " or lower(dialplan_description) like :search "; if (is_numeric($search)) { $sql .= " or dialplan_order = :search_numeric "; @@ -274,7 +282,6 @@ $sql .= "order by dialplan_order asc, lower(dialplan_name) asc "; } $sql .= limit_offset($rows_per_page, $offset); - $database = new database; $dialplans = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); @@ -298,7 +305,6 @@ $parameters['app_uuid'] = $app_uuid; } $sql .= ") as dc "; - $database = new database; $rows = $database->select($sql, $parameters ?? null, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $row) { @@ -655,4 +661,3 @@ require_once "resources/footer.php"; ?> - diff --git a/app/dialplans/resources/classes/dialplan.php b/app/dialplans/resources/classes/dialplan.php index 0147b6b313..065efa30be 100644 --- a/app/dialplans/resources/classes/dialplan.php +++ b/app/dialplans/resources/classes/dialplan.php @@ -326,7 +326,7 @@ $array['dialplans'][$x]['dialplan_enabled'] = $dialplan['@attributes']['enabled']; } else { - $array['dialplans'][$x]['dialplan_enabled'] = "true"; + $array['dialplans'][$x]['dialplan_enabled'] = true; } $array['dialplans'][$x]['dialplan_description'] = $dialplan['@attributes']['description'] ?? null; @@ -351,7 +351,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = $row['@attributes']['enabled']; } else { - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } $y++; @@ -391,7 +391,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = $row2['@attributes']['enabled']; } else { - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } $y++; @@ -418,7 +418,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = $row2['@attributes']['enabled']; } else { - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true; } $y++; @@ -499,7 +499,7 @@ $sql .= "or d.domain_uuid is null "; $sql .= ") "; $sql .= "and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' "; - $sql .= "and d.dialplan_enabled = 'true' "; + $sql .= "and d.dialplan_enabled = true "; $sql .= "and d.dialplan_uuid = s.dialplan_uuid "; $sql .= "order by "; $sql .= "d.dialplan_order asc, "; @@ -603,7 +603,7 @@ foreach($database_array['dialplans'] as $row) { if (!empty($row['dialplan_details'])) { foreach($row['dialplan_details'] as $detail) { - if ($detail['dialplan_detail_enabled'] == 'true') { + if ($detail['dialplan_detail_enabled'] == true) { $array[$id]['domain_uuid'] = $row['domain_uuid']; $array[$id]['dialplan_uuid'] = $row['dialplan_uuid']; $array[$id]['app_uuid'] = $row['app_uuid']; @@ -668,7 +668,7 @@ else { $sql .= "where (dialplan_context = :dialplan_context or dialplan_context = '\${domain_name}' or dialplan_context = 'global') "; } - $sql .= "and dialplan_enabled = 'true' "; + $sql .= "and dialplan_enabled = true "; $parameters['dialplan_context'] = $this->context; } } @@ -728,7 +728,7 @@ $sql .= "and p.dialplan_uuid = :dialplan_uuid \n"; $parameters['dialplan_uuid'] = $this->uuid; } - $sql .= "and (s.dialplan_detail_enabled = 'true' or s.dialplan_detail_enabled is null) \n"; + $sql .= "and (s.dialplan_detail_enabled = true or s.dialplan_detail_enabled is null) \n"; $sql .= "order by \n"; $sql .= "p.dialplan_order asc, \n"; $sql .= "p.dialplan_name asc, \n"; diff --git a/app/email_queue/email_test.php b/app/email_queue/email_test.php index 257436c3cd..66d7adfd79 100644 --- a/app/email_queue/email_test.php +++ b/app/email_queue/email_test.php @@ -55,7 +55,7 @@ $sql .= " and template_category = 'email' "; $sql .= " and template_subcategory = 'test' "; $sql .= " and template_type = 'html' "; - $sql .= " and template_enabled = 'true' "; + $sql .= " and template_enabled = true "; $sql .= " and (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "limit 1 "; $parameters['template_language'] = $language_dialect; diff --git a/app/email_queue/resources/command/send.php b/app/email_queue/resources/command/send.php index f38899f25b..ed7dd421ed 100644 --- a/app/email_queue/resources/command/send.php +++ b/app/email_queue/resources/command/send.php @@ -197,7 +197,7 @@ //get the email template from the database $sql = "select template_subject, template_body from v_email_templates "; - $sql .= "where template_enabled = 'true' "; + $sql .= "where template_enabled = true "; $sql .= "and template_language = :template_language "; $sql .= "and template_category = :template_category "; $sql .= "and template_subcategory = :template_subcategory "; diff --git a/app/email_queue/resources/jobs/email_send.php b/app/email_queue/resources/jobs/email_send.php index b9f447cd81..ece3ee5a61 100755 --- a/app/email_queue/resources/jobs/email_send.php +++ b/app/email_queue/resources/jobs/email_send.php @@ -181,7 +181,7 @@ //$voicemail_name_base64 = $row["voicemail_name_base64"]; //$voicemail_tutorial = $row["voicemail_tutorial"]; if (gettype($voicemail_transcription_enabled) === 'string') { - $voicemail_transcription_enabled = ($voicemail_transcription_enabled === 'true') ? true : false; + $voicemail_transcription_enabled = ($voicemail_transcription_enabled === true) ? true : false; } } unset($parameters); diff --git a/app/extension_settings/extension_setting_edit.php b/app/extension_settings/extension_setting_edit.php index a1b3e38bfd..87d52f5410 100644 --- a/app/extension_settings/extension_setting_edit.php +++ b/app/extension_settings/extension_setting_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) 2021-2023 + Portions created by the Initial Developer are Copyright (C) 2021-2025 the Initial Developer. All Rights Reserved. */ @@ -69,7 +69,7 @@ $extension_setting_type = $_POST["extension_setting_type"]; $extension_setting_name = $_POST["extension_setting_name"]; $extension_setting_value = $_POST["extension_setting_value"]; - $extension_setting_enabled = $_POST["extension_setting_enabled"] ?? 'false'; + $extension_setting_enabled = $_POST["extension_setting_enabled"]; $extension_setting_description = $_POST["extension_setting_description"]; } @@ -123,7 +123,7 @@ if (empty($extension_setting_type)) { $msg .= $text['message-required']." ".$text['label-extension_setting_type']."
\n"; } if (empty($extension_setting_name)) { $msg .= $text['message-required']." ".$text['label-extension_setting_name']."
\n"; } //if (empty($extension_setting_value)) { $msg .= $text['message-required']." ".$text['label-extension_setting_value']."
\n"; } - if (empty($extension_setting_enabled)) { $msg .= $text['message-required']." ".$text['label-extension_setting_enabled']."
\n"; } + // if (empty($extension_setting_enabled)) { $msg .= $text['message-required']." ".$text['label-extension_setting_enabled']."
\n"; } //if (empty($extension_setting_description)) { $msg .= $text['message-required']." ".$text['label-extension_setting_description']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -193,7 +193,7 @@ $sql .= "extension_setting_type, "; $sql .= "extension_setting_name, "; $sql .= "extension_setting_value, "; - $sql .= "cast(extension_setting_enabled as text), "; + $sql .= "extension_setting_enabled, "; $sql .= "extension_setting_description "; $sql .= "from v_extension_settings "; $sql .= "where extension_setting_uuid = :extension_setting_uuid "; @@ -216,9 +216,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($extension_setting_enabled)) { $extension_setting_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -341,17 +338,16 @@ echo " ".$text['label-extension_setting_enabled']."\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -2283,11 +2280,17 @@ echo " ".$text['label-force_ping']."\n"; echo "\n"; echo "\n"; @@ -2322,17 +2325,16 @@ echo " ".$text['label-enabled']."\n"; echo "\n"; echo "\n"; echo " \n"; diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 2fd85a0ae0..cc65d69578 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -195,7 +195,7 @@ if (!function_exists('fax_split_dtmf')) { $sql = "select domain_enabled::text from v_domains where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $domain_uuid; $row = $database->select($sql, $parameters, 'row'); - if ($row['domain_enabled'] == "true") { + if ($row['domain_enabled']) { $domain_enabled = true; } else { @@ -732,7 +732,7 @@ if (!function_exists('fax_split_dtmf')) { $sql .= " and domain_uuid = :domain_uuid "; $sql .= ") "; $sql .= "and dialplan_detail_data like 'provider_prefix%' "; - $sql .= "and dialplan_detail_enabled = 'true' "; + $sql .= "and dialplan_detail_enabled = true "; $parameters['domain_uuid'] = $domain_uuid; $row = $database->select($sql, $parameters, 'row'); $dialplan_detail_data = $row["dialplan_detail_data"]; diff --git a/app/fax/resources/classes/fax.php b/app/fax/resources/classes/fax.php index 3030133701..c85b00cf52 100644 --- a/app/fax/resources/classes/fax.php +++ b/app/fax/resources/classes/fax.php @@ -164,10 +164,10 @@ $dialplan["dialplan_name"] = ($this->fax_name != '') ? $this->fax_name : format_phone($this->destination_number); $dialplan["dialplan_number"] = $this->fax_extension; $dialplan["dialplan_context"] = $_SESSION['domain_name']; - $dialplan["dialplan_continue"] = "false"; + $dialplan["dialplan_continue"] = false; $dialplan["dialplan_xml"] = $dialplan_xml; $dialplan["dialplan_order"] = "40"; - $dialplan["dialplan_enabled"] = "true"; + $dialplan["dialplan_enabled"] = true; $dialplan["dialplan_description"] = $this->fax_description; $dialplan_detail_order = 10; diff --git a/app/fax_queue/resources/job/fax_send.php b/app/fax_queue/resources/job/fax_send.php index 3bd89946c3..10ee2a6420 100644 --- a/app/fax_queue/resources/job/fax_send.php +++ b/app/fax_queue/resources/job/fax_send.php @@ -242,7 +242,7 @@ $sql .= " and domain_uuid = :domain_uuid "; $sql .= ") "; $sql .= "and dialplan_detail_data like 'provider_prefix%' "; - $sql .= "and dialplan_detail_enabled = 'true' "; + $sql .= "and dialplan_detail_enabled = true "; $parameters['domain_uuid'] = $domain_uuid; $row = $database->select($sql, $parameters, 'row'); $dialplan_detail_data = $row["dialplan_detail_data"]; @@ -490,7 +490,7 @@ $sql .= "and template_language = :template_language "; $sql .= "and template_category = :template_category "; $sql .= "and template_type = :template_type "; - $sql .= "and template_enabled = 'true' "; + $sql .= "and template_enabled = true "; $parameters['domain_uuid'] = $domain_uuid; $parameters['template_language'] = $language_code; $parameters['template_category'] = 'fax'; diff --git a/app/fifo/app_config.php b/app/fifo/app_config.php index 8dca1f66ec..1e4f3a67ee 100644 --- a/app/fifo/app_config.php +++ b/app/fifo/app_config.php @@ -36,7 +36,7 @@ $apps[$x]['destinations'][$y]['label'] = "fifo"; $apps[$x]['destinations'][$y]['name'] = "fifo"; $apps[$x]['destinations'][$y]['sql'] = "select fifo_uuid as uuid, fifo_name as name, fifo_extension as extension, fifo_enabled from v_fifo "; - $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and fifo_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and fifo_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "natural_sort(fifo_extension) asc"; $apps[$x]['destinations'][$y]['field']['uuid'] = "uuid"; $apps[$x]['destinations'][$y]['field']['name'] = "name"; diff --git a/app/fifo/fifo_edit.php b/app/fifo/fifo_edit.php index 164caebe18..be510965a2 100644 --- a/app/fifo/fifo_edit.php +++ b/app/fifo/fifo_edit.php @@ -80,7 +80,7 @@ $fifo_music = $_POST["fifo_music"]; $domain_uuid = $_POST["domain_uuid"]; $fifo_order = $_POST["fifo_order"]; - $fifo_enabled = $_POST["fifo_enabled"] ?? 'false'; + $fifo_enabled = $_POST["fifo_enabled"]; $fifo_description = $_POST["fifo_description"]; } @@ -102,7 +102,7 @@ $x = 0; if (is_array($_POST['fifo_members'])) { foreach ($_POST['fifo_members'] as $row) { - if (is_uuid($row['fifo_member_uuid']) && $row['checked'] === 'true') { + if (is_uuid($row['fifo_member_uuid']) && $row['checked'] == 'true') { $array['fifo'][$x]['checked'] = $row['checked']; $array['fifo'][$x]['fifo_members'][]['fifo_member_uuid'] = $row['fifo_member_uuid']; $x++; @@ -152,11 +152,11 @@ $fifo_members[$i]['member_contact'] = preg_replace('#[^a-zA-Z0-9/@.\-\*]#', '', $row["member_contact"] ?? ''); $fifo_members[$i]['member_call_timeout'] = preg_replace('#[^0-9]#', '', $row["member_call_timeout"] ?? '20'); $fifo_members[$i]['member_wrap_up_time'] = preg_replace('#[^0-9]#', '', $row["member_wrap_up_time"] ?? '10'); - $fifo_members[$i]['member_enabled'] = $row["member_enabled"] ?? 'false'; + $fifo_members[$i]['member_enabled'] = $row["member_enabled"]; $i++; } } - + //check for all required data $msg = ''; if (strlen($fifo_name) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_name']."
\n"; } @@ -227,7 +227,7 @@ $array['fifo'][0]['fifo_members'][$y]['member_call_timeout'] = $row["member_call_timeout"] ?? '20'; //$array['fifo'][0]['fifo_members'][$y]['member_simultaneous'] = $row["member_simultaneous"]; $array['fifo'][0]['fifo_members'][$y]['member_wrap_up_time'] = $row["member_wrap_up_time"] ?? '10'; - $array['fifo'][0]['fifo_members'][$y]['member_enabled'] = $row["member_enabled"] ?? 'false'; + $array['fifo'][0]['fifo_members'][$y]['member_enabled'] = $row["member_enabled"]; $y++; } } @@ -397,7 +397,7 @@ $sql .= " fifo_music, "; $sql .= " domain_uuid, "; $sql .= " fifo_order, "; - $sql .= " cast(fifo_enabled as text), "; + $sql .= " fifo_enabled, "; $sql .= " fifo_description "; $sql .= "from v_fifo "; $sql .= "where fifo_uuid = :fifo_uuid "; @@ -434,7 +434,7 @@ $sql .= " member_call_timeout, "; //$sql .= " member_simultaneous, "; $sql .= " member_wrap_up_time, "; - $sql .= " cast(member_enabled as text) "; + $sql .= " member_enabled "; $sql .= "from v_fifo_members "; $sql .= "where fifo_uuid = :fifo_uuid "; //$sql .= "and domain_uuid = '".$domain_uuid."' "; @@ -477,7 +477,7 @@ $fifo_members[$id]['member_call_timeout'] = ''; //$fifo_members[$id]['member_simultaneous'] = ''; $fifo_members[$id]['member_wrap_up_time'] = ''; - $fifo_members[$id]['member_enabled'] = ''; + $fifo_members[$id]['member_enabled'] = false; $id++; } @@ -495,9 +495,6 @@ if (empty($fifo_order)) { $fifo_order = 50; } - if (empty($fifo_enabled)) { - $fifo_enabled = true; - } //show the header $document['title'] = $text['title-fifo']; @@ -629,32 +626,31 @@ echo " \n"; - echo " \n"; //echo " \n"; - echo " \n"; echo " \n"; if ($show_option_delete && is_array($fifo_members) && @sizeof($fifo_members) > 1 && permission_exists('fifo_member_delete')) { - if (is_uuid($row['fifo_member_uuid'])) { - echo " \n"; } @@ -775,17 +771,16 @@ echo " ".$text['label-fifo_enabled']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -651,21 +639,17 @@ echo " ".$text['label-caller_id_in_from']."\n"; echo " \n"; echo " \n"; @@ -676,21 +660,17 @@ echo " ".$text['label-supress_cng']."\n"; echo "\n"; echo "\n"; @@ -781,21 +761,17 @@ echo " ".$text['label-contact_in_ping']."\n"; echo "\n"; echo "\n"; @@ -898,17 +874,16 @@ echo " ".$text['label-enabled']."\n"; echo "\n"; echo "\n"; @@ -1069,19 +1063,16 @@ echo " \n"; echo "\n"; echo "\n"; if ($show_option_delete && permission_exists('ivr_menu_option_delete')) { @@ -1177,17 +1168,16 @@ echo " ".$text['label-direct_dial']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -273,17 +266,16 @@ echo " ".$text['label-default_enabled']."\n"; echo "\n"; echo "\n"; echo "\n"; @@ -311,4 +303,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/modules/modules.php b/app/modules/modules.php index 0f180810ae..d32c72f127 100644 --- a/app/modules/modules.php +++ b/app/modules/modules.php @@ -245,7 +245,7 @@ } else { echo " \n"; if (permission_exists('module_edit')) { echo " \n"; echo " \n"; diff --git a/app/modules/resources/classes/modules.php b/app/modules/resources/classes/modules.php index d35e13d4ca..ddcd90432e 100644 --- a/app/modules/resources/classes/modules.php +++ b/app/modules/resources/classes/modules.php @@ -76,658 +76,658 @@ $mod['module_label'] = $module_label; $mod['module_name'] = $name; $mod['module_order'] = '800'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; $mod['module_description'] = ''; switch ($name) { case "mod_amr": $mod['module_label'] = 'AMR'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'AMR codec.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_av": $mod['module_label'] = 'AV'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Supports libav and RTMP streams.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_avmd": $mod['module_label'] = 'AVMD'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Advanced voicemail beep detection.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_blacklist": $mod['module_label'] = 'Blacklist'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Blacklist.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_b64": $mod['module_label'] = 'B64'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'B64 Codec.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_bcg729": $mod['module_label'] = 'BCG729'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'G729 Open Source Codec.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_bv": $mod['module_label'] = 'BV'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'BroadVoice16 and BroadVoice32 audio codecs.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_cdr_csv": $mod['module_label'] = 'CDR CSV'; $mod['module_category'] = 'Event Handlers'; $mod['module_description'] = 'CSV call detail record handler.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_cdr_sqlite": $mod['module_label'] = 'CDR SQLite'; $mod['module_category'] = 'Event Handlers'; $mod['module_description'] = 'SQLite call detail record handler.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_callcenter": $mod['module_label'] = 'Call Center'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Call queuing with agents and tiers for call centers.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_cepstral": $mod['module_label'] = 'Cepstral'; $mod['module_category'] = 'Speech Recognition / Text to Speech'; $mod['module_description'] = 'Text to Speech engine.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_cidlookup": $mod['module_label'] = 'CID Lookup'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Lookup caller id info.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_cluechoo": $mod['module_label'] = 'Cluechoo'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'A framework demo module.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_commands": $mod['module_label'] = 'Commands'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'API interface commands.'; $mod['module_order'] = 100; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_conference": $mod['module_label'] = 'Conference'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Conference room module.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_console": $mod['module_label'] = 'Console'; $mod['module_category'] = 'Loggers'; $mod['module_description'] = 'Send logs to the console.'; $mod['module_order'] = 400; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_curl": $mod['module_label'] = 'CURL'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Allows scripts to make HTTP requests and return responses in plain text or JSON.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_db": $mod['module_label'] = 'DB'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Database key / value storage functionality, dialing and limit backend.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_dialplan_asterisk": $mod['module_label'] = 'Dialplan Asterisk'; $mod['module_category'] = 'Dialplan Interfaces'; $mod['module_description'] = 'Allows Asterisk dialplans.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_dialplan_xml": $mod['module_label'] = 'Dialplan XML'; $mod['module_category'] = 'Dialplan Interfaces'; $mod['module_description'] = 'Provides dialplan functionality in XML.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_directory": $mod['module_label'] = 'Directory'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Dial by name directory.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_distributor": $mod['module_label'] = 'Distributor'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Round robin call distribution.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_dptools": $mod['module_label'] = 'Dialplan Plan Tools'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Provides a number of apps and utilities for the dialplan.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_enum": $mod['module_label'] = 'ENUM'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Route PSTN numbers over internet according to ENUM servers, such as e164.org.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_esf": $mod['module_label'] = 'ESF'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Holds the multi cast paging application for SIP.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_event_socket": $mod['module_label'] = 'Event Socket'; $mod['module_category'] = 'Event Handlers'; $mod['module_description'] = 'Sends events via a single socket.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_expr": $mod['module_label'] = 'Expr'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Expression evaluation library.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_fifo": $mod['module_label'] = 'FIFO'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'FIFO provides custom call queues including call park.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_flite": $mod['module_label'] = 'Flite'; $mod['module_category'] = 'Speech Recognition / Text to Speech'; $mod['module_description'] = 'Text to Speech engine.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_fsv": $mod['module_label'] = 'FSV'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Video application (Recording and playback).'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_g723_1": $mod['module_label'] = 'G.723.1'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'G.723.1 codec.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_g729": $mod['module_label'] = 'G.729'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'G729 codec supports passthrough mode'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_h26x": $mod['module_label'] = 'H26x'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'Video codecs'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_hash": $mod['module_label'] = 'Hash'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Resource limitation.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_httapi": $mod['module_label'] = 'HT-TAPI'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'HT-TAPI Hypertext Telephony API'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_http_cache": $mod['module_label'] = 'HTTP Cache'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'HTTP GET with caching'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_ilbc": $mod['module_label'] = 'iLBC'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'iLBC codec.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_ladspa": $mod['module_label'] = 'Ladspa'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Auto-tune calls.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_lcr": $mod['module_label'] = 'LCR'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Least cost routing.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_local_stream": $mod['module_label'] = 'Local Stream'; $mod['module_category'] = 'Streams / Files'; $mod['module_description'] = 'For local streams (play all the files in a directory).'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_logfile": $mod['module_label'] = 'Log File'; $mod['module_category'] = 'Loggers'; $mod['module_description'] = 'Send logs to the local file system.'; $mod['module_order'] = 400; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_loopback": $mod['module_label'] = 'Loopback'; $mod['module_category'] = 'Endpoints'; $mod['module_description'] = 'A loopback channel driver to make an outbound call as an inbound call.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_lua": $mod['module_label'] = 'Lua'; $mod['module_category'] = 'Languages'; $mod['module_description'] = 'Lua script.'; $mod['module_order'] = 200; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_memcache": $mod['module_label'] = 'Memcached'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'API for memcached.'; - $mod['module_enabled'] = 'false'; + $mod['module_enabled'] = false; $mod['module_order'] = 150; - $mod['module_default_enabled'] = 'false'; + $mod['module_default_enabled'] = false; break; case "mod_native_file": $mod['module_label'] = 'Native File'; $mod['module_category'] = 'File Format Interfaces'; $mod['module_description'] = 'File interface for codec specific file formats.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_nibblebill": $mod['module_label'] = 'Nibblebill'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Billing module.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_opus": $mod['module_label'] = 'Opus'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'OPUS ultra-low delay audio codec'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_park": $mod['module_label'] = 'Park'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Park Calls.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_pgsql": $mod['module_label'] = 'PGSQL'; $mod['module_category'] = 'Databases'; $mod['module_description'] = 'Client support for PostgreSQL database.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_png": $mod['module_label'] = 'PNG'; $mod['module_category'] = 'Formats'; $mod['module_description'] = 'Image format Portable Network Graphics.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_pocketsphinx": $mod['module_label'] = 'PocketSphinx'; $mod['module_category'] = 'Speech Recognition / Text to Speech'; $mod['module_description'] = 'Speech Recognition.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_rtc": $mod['module_label'] = 'RTC'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Supports medias streaming for WebRTC and Verto.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_rtmp": $mod['module_label'] = 'RTMP'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Real Time Media Protocol'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_de": $mod['module_label'] = 'German'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'German sound files used for time, date, digits, etc.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_en": $mod['module_label'] = 'English'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'English sound files used for time, date, digits, etc.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_es": $mod['module_label'] = 'Spanish'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Spanish sound files used for time, date, digits, etc.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_es_ar": $mod['module_label'] = 'Spanish AR'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Spanish AR sound files used for time, date, digits, etc.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_fr": $mod['module_label'] = 'French'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Play French phrases using sound files for time, date, digits, and more.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_he": $mod['module_label'] = 'Hebrew'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Play Hebrew phrases using sound files for time, date, digits, and more.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_hu": $mod['module_label'] = 'Hungarian'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Play Hungarian phrases using sound files for time, date, digits, and more.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_it": $mod['module_label'] = 'Italian'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Play Italian phrases using sound files for time, date, digits, and more.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_nl": $mod['module_label'] = 'Dutch'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Play Dutch phrases using sound files for time, date, digits, and more.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_pt": $mod['module_label'] = 'Portuguese'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Play Portuguese phrases using sound files for time, date, digits, and more.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_ru": $mod['module_label'] = 'Russian'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Play Russian phrases using sound files for time, date, digits, and more.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_th": $mod['module_label'] = 'Thai'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Play Thai phrases using sound files for time, date, digits, and more.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_say_zh": $mod['module_label'] = 'Chinese'; $mod['module_category'] = 'Say'; $mod['module_description'] = 'Play Chinese phrases using sound files for time, date, digits, and more.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_shout": $mod['module_label'] = 'Shout'; $mod['module_category'] = 'Streams / Files'; $mod['module_description'] = 'MP3 files and shoutcast streams.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_siren": $mod['module_label'] = 'Siren'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'Siren codec'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_sms": $mod['module_label'] = 'SMS'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Chat messages'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_sndfile": $mod['module_label'] = 'Sound File'; $mod['module_category'] = 'File Format Interfaces'; $mod['module_description'] = 'Multi-format file format transcoder (WAV, etc).'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_sofia": $mod['module_label'] = 'Sofia'; $mod['module_category'] = 'Endpoints'; $mod['module_description'] = 'SIP module.'; $mod['module_order'] = 300; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_spandsp": $mod['module_label'] = 'SpanDSP'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'FAX provides fax send and receive.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_speex": $mod['module_label'] = 'Speex'; $mod['module_category'] = 'Codecs'; $mod['module_description'] = 'Speex codec.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_spidermonkey": $mod['module_label'] = 'SpiderMonkey'; $mod['module_category'] = 'Languages'; $mod['module_description'] = 'JavaScript support.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_spidermonkey_core_db": $mod['module_label'] = 'SpiderMonkey Core DB'; $mod['module_category'] = 'Languages'; $mod['module_description'] = 'Javascript support for SQLite.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_spidermonkey_curl": $mod['module_label'] = 'SpiderMonkey Curl'; $mod['module_category'] = 'Languages'; $mod['module_description'] = 'Javascript curl support.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_spidermonkey_socket": $mod['module_label'] = 'SpiderMonkey Socket'; $mod['module_category'] = 'Languages'; $mod['module_description'] = 'Javascript socket support.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_spidermonkey_teletone": $mod['module_label'] = 'SpiderMonkey Teletone'; $mod['module_category'] = 'Languages'; $mod['module_description'] = 'Javascript teletone support.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_syslog": $mod['module_label'] = 'Syslog'; $mod['module_category'] = 'Loggers'; $mod['module_description'] = 'Send logs to a remote syslog server.'; $mod['module_order'] = 400; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_test": $mod['module_label'] = 'Test'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Test application.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_tone_stream": $mod['module_label'] = 'Tone Stream'; $mod['module_category'] = 'Streams / Files'; $mod['module_description'] = 'Generate tone streams.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_tts_commandline": $mod['module_label'] = 'TTS Commandline'; $mod['module_category'] = 'Speech Recognition / Text to Speech'; $mod['module_description'] = 'Commandline text to speech engine.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_unimrcp": $mod['module_label'] = 'MRCP'; $mod['module_category'] = 'Speech Recognition / Text to Speech'; $mod['module_description'] = 'Media Resource Control Protocol.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_valet_parking": $mod['module_label'] = 'Valet Parking'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Call parking'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_voicemail": $mod['module_label'] = 'Voicemail'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Full featured voicemail module.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_voicemail_ivr": $mod['module_label'] = 'Voicemail IVR'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'Voicemail IVR interface.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_translate": $mod['module_label'] = 'Translate'; $mod['module_category'] = 'Applications'; $mod['module_description'] = 'format numbers into a specified format.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_xml_cdr": $mod['module_label'] = 'XML CDR'; $mod['module_category'] = 'XML Interfaces'; $mod['module_description'] = 'XML based call detail record handler.'; - $mod['module_enabled'] = 'true'; - $mod['module_default_enabled'] = 'true'; + $mod['module_enabled'] = true; + $mod['module_default_enabled'] = true; break; case "mod_xml_curl": $mod['module_label'] = 'XML Curl'; $mod['module_category'] = 'XML Interfaces'; $mod['module_description'] = 'Request XML config files dynamically.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_xml_rpc": $mod['module_label'] = 'XML RPC'; $mod['module_category'] = 'XML Interfaces'; $mod['module_description'] = 'XML Remote Procedure Calls. Issue commands from your web application.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; case "mod_xml_scgi": $mod['module_label'] = 'XML SCGI'; $mod['module_category'] = 'XML Interfaces'; $mod['module_description'] = 'SCGI XML Gateway.'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; break; default: $mod['module_category'] = 'Auto'; - $mod['module_enabled'] = 'false'; - $mod['module_default_enabled'] = 'false'; + $mod['module_enabled'] = false; + $mod['module_default_enabled'] = false; } return $mod; } @@ -850,7 +850,7 @@ if ($prev_module_cat != $row['module_category']) { $xml .= "\n \n"; } - if ($row['module_enabled'] == "true"){ + if ($row['module_enabled'] == true){ $xml .= " \n"; } $prev_module_cat = $row['module_category']; diff --git a/app/number_translations/app_config.php b/app/number_translations/app_config.php index 1e13b331a6..0de04deee9 100644 --- a/app/number_translations/app_config.php +++ b/app/number_translations/app_config.php @@ -86,7 +86,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the number translation name.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'number_translation_enabled'; - $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'boolean'; $apps[$x]['db'][$y]['fields'][$z]['toggle'] = ['true','false']; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the number translation enabled.'; $z++; diff --git a/app/number_translations/number_translation_edit.php b/app/number_translations/number_translation_edit.php index c289f8f4fd..a932564fbe 100644 --- a/app/number_translations/number_translation_edit.php +++ b/app/number_translations/number_translation_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) 2018-2023 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. */ @@ -58,7 +58,7 @@ if (!empty($_POST)) { $number_translation_name = $_POST["number_translation_name"]; $number_translation_details = $_POST["number_translation_details"]; - $number_translation_enabled = $_POST["number_translation_enabled"] ?? 'false'; + $number_translation_enabled = $_POST["number_translation_enabled"]; $number_translation_description = $_POST["number_translation_description"]; } @@ -119,7 +119,7 @@ $msg = ''; if (empty($number_translation_name)) { $msg .= $text['message-required']." ".$text['label-number_translation_name']."
\n"; } //if (empty($number_translation_details)) { $msg .= $text['message-required']." ".$text['label-number_translation_details']."
\n"; } - if (empty($number_translation_enabled)) { $msg .= $text['message-required']." ".$text['label-number_translation_enabled']."
\n"; } + //if (empty($number_translation_enabled)) { $msg .= $text['message-required']." ".$text['label-number_translation_enabled']."
\n"; } //if (empty($number_translation_description)) { $msg .= $text['message-required']." ".$text['label-number_translation_description']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -337,17 +337,16 @@ echo " ".$text['label-number_translation_enabled']."\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; if (permission_exists('ring_group_forward')) { @@ -300,7 +292,6 @@ echo "

\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo "\n"; - echo "\n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - $on_click = "document.getElementById('forward_all_disabled').checked = true;"; - $on_click2 = "if (document.getElementById('follow_me_enabled').checked) { $('#div_follow_me_settings').slideDown('fast'); }"; - echo " \n"; - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-conference_center_enabled']."\n"; diff --git a/app/conference_centers/conference_centers.php b/app/conference_centers/conference_centers.php index ba0359820e..9e09ae690e 100644 --- a/app/conference_centers/conference_centers.php +++ b/app/conference_centers/conference_centers.php @@ -127,7 +127,17 @@ $offset = $rows_per_page * $page; //get the list - $sql = "select * from v_conference_centers "; + $sql = "select "; + $sql .= "domain_uuid, "; + $sql .= "conference_center_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "conference_center_name, "; + $sql .= "conference_center_extension, "; + $sql .= "conference_center_pin_length, "; + $sql .= "conference_center_greeting, "; + $sql .= "conference_center_description, "; + $sql .= "cast(conference_center_enabled as text) "; + $sql .= "from v_conference_centers "; $sql .= "where true "; if ($show != "all" || !permission_exists('conference_center_all')) { $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; @@ -289,4 +299,3 @@ require_once "resources/footer.php"; ?> - diff --git a/app/conference_centers/conference_room_edit.php b/app/conference_centers/conference_room_edit.php index 6382fe4807..dd34741dba 100644 --- a/app/conference_centers/conference_room_edit.php +++ b/app/conference_centers/conference_room_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): @@ -85,7 +85,7 @@ $created_by = $_POST["created_by"] ?? null; $email_address = $_POST["email_address"] ?? null; $account_code = $_POST["account_code"]; - $enabled = $_POST["enabled"] ?? 'false'; + $enabled = $_POST["enabled"]; $description = $_POST["description"]; //remove any pin number formatting @@ -303,16 +303,7 @@ if ($action == "add" && permission_exists('conference_room_add')) { //set default values if (empty($profile)) { $profile = 'default'; } - if (empty($record)) { $record = 'false'; } if (empty($max_members)) { $max_members = 0; } - if (empty($wait_mod)) { $wait_mod = 'true'; } - if (empty($moderator_endconf)) { $moderator_endconf = 'false'; } - if (empty($announce_name)) { $announce_name = 'true'; } - if (empty($announce_recording)) { $announce_recording = 'true'; } - if (empty($announce_count)) { $announce_count = 'true'; } - if (empty($mute)) { $mute = 'false'; } - if (empty($enabled)) { $enabled = 'true'; } - if (empty($sounds)) { $sounds = 'false'; } //add a conference room $conference_room_uuid = uuid(); @@ -544,18 +535,6 @@ $participant_pin = substr($participant_pin, 0, 3) ."-". substr($participant_pin, 3, 3) ."-". substr($participant_pin, -3)."\n"; } -//set default values - if (empty($record)) { $record = 'false'; } - if (empty($max_members)) { $max_members = 0; } - if (empty($wait_mod)) { $wait_mod = 'true'; } - if (empty($moderator_endconf)) { $moderator_endconf = 'false'; } - if (empty($announce_name)) { $announce_name = 'true'; } - if (empty($announce_recording)) { $announce_recording = 'true'; } - if (empty($announce_count)) { $announce_count = 'true'; } - if (empty($mute)) { $mute = 'false'; } - if (empty($sounds)) { $sounds = 'false'; } - if (empty($enabled)) { $enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -693,21 +672,17 @@ echo "
".$text['label-record']."\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($record == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo "
".$text['label-wait_for_moderator']."\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($wait_mod == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo "
".$text['label-moderator_endconf']."\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($moderator_endconf == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo "
".$text['label-announce_name']."\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($announce_name == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo "
".$text['label-announce_count']."\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($announce_count == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo "
".$text['label-announce_recording']."\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($announce_recording == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo "
".$text['label-mute']."\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($mute == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo "\n"; echo "
".$text['label-enabled']."\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo "\n"; @@ -941,21 +891,17 @@ echo "
".$text['label-sounds']."\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($sounds == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo "\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-control_enabled']."\n"; diff --git a/app/conference_controls/conference_control_details.php b/app/conference_controls/conference_control_details.php index 5e60ebd063..fb4fea949d 100644 --- a/app/conference_controls/conference_control_details.php +++ b/app/conference_controls/conference_control_details.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-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -97,8 +97,8 @@ $sql .= "where conference_control_uuid = :conference_control_uuid "; $sql .= $sql_search ?? ''; $parameters['conference_control_uuid'] = $conference_control_uuid ?? ''; - $database = new database; $num_rows = $database->select($sql, $parameters ?? null, 'column'); + unset($sql, $parameters); //prepare to page the results $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; @@ -110,11 +110,17 @@ } //get the list - $sql = str_replace('count(conference_control_detail_uuid)', '*', $sql); + $sql = "select "; + $sql .= "conference_control_detail_uuid, "; + $sql .= "conference_control_uuid, "; + $sql .= "control_digits, "; + $sql .= "control_action, "; + $sql .= "control_data, "; + $sql .= "cast(control_enabled as text) "; + $sql .= "from v_conference_control_details "; $sql .= $sql_search ?? ''; $sql .= order_by($order_by, $order, 'control_digits', 'asc'); $sql .= limit_offset($rows_per_page, !empty($offset)); - $database = new database; $result = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); diff --git a/app/conference_controls/conference_control_edit.php b/app/conference_controls/conference_control_edit.php index d1ada908e9..e25d06550e 100644 --- a/app/conference_controls/conference_control_edit.php +++ b/app/conference_controls/conference_control_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) 2018-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -57,7 +57,7 @@ //get http post variables and set them to php variables if (!empty($_POST)) { $control_name = $_POST["control_name"]; - $control_enabled = $_POST["control_enabled"] ?? 'false'; + $control_enabled = $_POST["control_enabled"]; $control_description = $_POST["control_description"]; } @@ -108,7 +108,6 @@ $array['conference_controls'][0]['control_description'] = $control_description; //save to the data - $database = new database; $database->app_name = 'conference_controls'; $database->app_uuid = 'e1ad84a2-79e1-450c-a5b1-7507a043e048'; if (!empty($conference_control_uuid)) { @@ -137,7 +136,6 @@ //$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where conference_control_uuid = :conference_control_uuid "; $parameters['conference_control_uuid'] = $conference_control_uuid; - $database = new database; $row = $database->select($sql, $parameters, 'row'); if (!empty($row)) { $control_name = $row["control_name"]; @@ -147,9 +145,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($control_enabled)) { $control_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -189,17 +184,16 @@ echo " ".$text['label-control_enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-control_enabled']."\n"; diff --git a/app/conference_controls/conference_controls.php b/app/conference_controls/conference_controls.php index 0f4f8bce05..c88adb2667 100644 --- a/app/conference_controls/conference_controls.php +++ b/app/conference_controls/conference_controls.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-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -98,6 +98,7 @@ $sql .= $sql_search ?? ''; $database = new database; $num_rows = $database->select($sql, $parameters ?? null, 'column'); + unset($sql); //prepare to page the results $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; @@ -108,7 +109,13 @@ $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(conference_control_uuid)', '*', $sql); + $sql = "select "; + $sql .= "conference_control_uuid, "; + $sql .= "control_name, "; + $sql .= "cast(control_enabled as text), "; + $sql .= "control_description "; + $sql .= "from v_conference_controls "; + $sql .= $sql_search ?? ''; $sql .= order_by($order_by, $order, 'control_name', 'asc'); $sql .= limit_offset($rows_per_page, $offset); $database = new database; diff --git a/app/conference_profiles/app_config.php b/app/conference_profiles/app_config.php index 741b5b42b8..b56d9d858c 100644 --- a/app/conference_profiles/app_config.php +++ b/app/conference_profiles/app_config.php @@ -85,7 +85,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the profile name."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "profile_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the status of the profile."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "profile_description"; @@ -144,7 +144,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the value."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "profile_param_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the status of the parameter."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "profile_param_description"; diff --git a/app/conference_profiles/app_defaults.php b/app/conference_profiles/app_defaults.php index fc62fbd944..6ea787c8c9 100644 --- a/app/conference_profiles/app_defaults.php +++ b/app/conference_profiles/app_defaults.php @@ -81,7 +81,7 @@ //print_r($p); $profile_param_name = $p['@attributes']['name']; $profile_param_value = $p['@attributes']['value']; - $profile_param_enabled = 'true'; + $profile_param_enabled = true; //add the coference profile params $conference_profile_param_uuid = uuid(); diff --git a/app/conference_profiles/conference_profile_edit.php b/app/conference_profiles/conference_profile_edit.php index 6d8ec43b3c..2f7f90b33f 100644 --- a/app/conference_profiles/conference_profile_edit.php +++ b/app/conference_profiles/conference_profile_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) 2018-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -57,7 +57,7 @@ //get http post variables and set them to php variables if (!empty($_POST)) { $profile_name = $_POST["profile_name"]; - $profile_enabled = $_POST["profile_enabled"] ?? 'false'; + $profile_enabled = $_POST["profile_enabled"]; $profile_description = $_POST["profile_description"]; } //check to see if the http post exists @@ -129,7 +129,11 @@ //pre-populate the form if (!empty($_GET) && empty($_POST["persistformvar"])) { $conference_profile_uuid = $_GET["id"]; - $sql = "select * from v_conference_profiles "; + $sql = "select "; + $sql .= "profile_name, "; + $sql .= "profile_enabled, "; + $sql .= "profile_description "; + $sql .= "from v_conference_profiles "; $sql .= "where conference_profile_uuid = :conference_profile_uuid "; //$sql .= "and domain_uuid = :domain_uuid "; $parameters['conference_profile_uuid'] = $conference_profile_uuid; @@ -144,9 +148,6 @@ unset($sql, $parameters); } -//set the defaults - if (empty($profile_enabled)) { $profile_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -186,17 +187,16 @@ echo " ".$text['label-profile_enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-profile_enabled']."\n"; diff --git a/app/conference_profiles/conference_profile_param_edit.php b/app/conference_profiles/conference_profile_param_edit.php index 23b936ab45..b5867eb4eb 100644 --- a/app/conference_profiles/conference_profile_param_edit.php +++ b/app/conference_profiles/conference_profile_param_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) 2018-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -64,7 +64,7 @@ if (!empty($_POST)) { $profile_param_name = $_POST["profile_param_name"]; $profile_param_value = $_POST["profile_param_value"]; - $profile_param_enabled = $_POST["profile_param_enabled"] ?? 'false'; + $profile_param_enabled = $_POST["profile_param_enabled"]; $profile_param_description = $_POST["profile_param_description"]; } @@ -123,7 +123,6 @@ } if (is_uuid($array['conference_profile_params'][0]['conference_profile_param_uuid'])) { - $database = new database; $database->app_name = 'conference_profiles'; $database->app_uuid = 'c33e2c2a-847f-44c1-8c0d-310df5d65ba9'; $database->save($array); @@ -139,11 +138,15 @@ //pre-populate the form if (!empty($_GET) && empty($_POST["persistformvar"])) { $conference_profile_param_uuid = $_GET["id"] ?? ''; - $sql = "select * from v_conference_profile_params "; + $sql = "select "; + $sql .= "profile_param_name, "; + $sql .= "profile_param_value, "; + $sql .= "profile_param_enabled, "; + $sql .= "profile_param_description "; + $sql .= "from v_conference_profile_params "; $sql .= "where conference_profile_param_uuid = :conference_profile_param_uuid "; $parameters['conference_profile_param_uuid'] = $conference_profile_param_uuid; - $database = new database; - $row = $database->select($sql, $parameters, 'row'); + $row = $database->select($sql, $parameters ?? null, 'row'); if (!empty($row)) { $profile_param_name = $row["profile_param_name"]; $profile_param_value = $row["profile_param_value"]; @@ -153,9 +156,6 @@ unset($sql, $parameters); } -//set the defaults - if (empty($profile_param_enabled)) { $profile_param_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -206,17 +206,16 @@ echo " ".$text['label-profile_param_enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-profile_param_enabled']."\n"; diff --git a/app/conference_profiles/conference_profile_params.php b/app/conference_profiles/conference_profile_params.php index bbc5011aad..5ebfb26e97 100644 --- a/app/conference_profiles/conference_profile_params.php +++ b/app/conference_profiles/conference_profile_params.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-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -84,8 +84,8 @@ $sql .= "from v_conference_profile_params "; $sql .= "where conference_profile_uuid = :conference_profile_uuid "; $parameters['conference_profile_uuid'] = $conference_profile_uuid; - $database = new database; $num_rows = $database->select($sql, $parameters, 'column'); + unset($sql, $parameters); //prepare to page the results $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; @@ -97,10 +97,18 @@ } //get the list - $sql = str_replace('count(conference_profile_param_uuid)', '*', $sql); + $sql = "select "; + $sql .= "conference_profile_param_uuid, "; + $sql .= "conference_profile_uuid, "; + $sql .= "profile_param_name, "; + $sql .= "profile_param_value, "; + $sql .= "cast(profile_param_enabled as text), "; + $sql .= "profile_param_description "; + $sql .= "from v_conference_profile_params "; + $sql .= "where conference_profile_uuid = :conference_profile_uuid "; + $parameters['conference_profile_uuid'] = $conference_profile_uuid; $sql .= order_by($order_by, $order, 'profile_param_name', 'asc'); $sql .= limit_offset($rows_per_page ?? '', $offset ?? ''); - $database = new database; $result = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); diff --git a/app/conference_profiles/conference_profiles.php b/app/conference_profiles/conference_profiles.php index 904362a566..c9c9e811ef 100644 --- a/app/conference_profiles/conference_profiles.php +++ b/app/conference_profiles/conference_profiles.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-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -102,9 +102,18 @@ } $database = new database; $num_rows = $database->select($sql, $parameters ?? null, 'column'); + unset($sql); //get the list - $sql = str_replace('count(conference_profile_uuid)', '*', $sql); + $sql = "select "; + $sql .= "conference_profile_uuid, "; + $sql .= "profile_name, "; + $sql .= "cast(profile_enabled as text), "; + $sql .= "profile_description "; + $sql .= "from v_conference_profiles "; + if (!empty($sql_search)) { + $sql .= "where ".$sql_search; + } $sql .= order_by($order_by, $order, 'profile_name', 'asc'); $sql .= limit_offset($rows_per_page ?? '', $offset ?? ''); $database = new database; diff --git a/app/conference_profiles/resources/classes/conference_profiles.php b/app/conference_profiles/resources/classes/conference_profiles.php index e44522ac62..423ea0f197 100644 --- a/app/conference_profiles/resources/classes/conference_profiles.php +++ b/app/conference_profiles/resources/classes/conference_profiles.php @@ -102,7 +102,6 @@ $p->add('conference_profile_param_delete', 'temp'); //execute delete - $database = new database; $database->app_name = $this->app_name; $database->app_uuid = $this->app_uuid; $database->delete($array); @@ -157,7 +156,6 @@ //delete the checked rows if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //execute delete - $database = new database; $database->app_name = $this->app_name; $database->app_uuid = $this->app_uuid; $database->delete($array); @@ -208,7 +206,6 @@ if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; $sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") "; - $database = new database; $rows = $database->select($sql, $parameters ?? null, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $row) { @@ -232,7 +229,6 @@ //save the changes if (is_array($array) && @sizeof($array) != 0) { //save the array - $database = new database; $database->app_name = $this->app_name; $database->app_uuid = $this->app_uuid; $database->save($array); @@ -280,7 +276,6 @@ if (!empty($uuids) && is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; $sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") "; - $database = new database; $rows = $database->select($sql, $parameters ?? null, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $row) { @@ -306,7 +301,6 @@ //save the changes if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //save the array - $database = new database; $database->app_name = $this->app_name; $database->app_uuid = $this->app_uuid; $database->save($array); @@ -361,7 +355,6 @@ //primary table $sql = "select * from v_".$this->table." "; $sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") "; - $database = new database; $rows = $database->select($sql, $parameters ?? null, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { $y = 0; @@ -378,7 +371,6 @@ //params sub table $sql_2 = "select * from v_conference_profile_params where conference_profile_uuid = :conference_profile_uuid"; $parameters_2['conference_profile_uuid'] = $row['conference_profile_uuid']; - $database = new database; $rows_2 = $database->select($sql_2, $parameters_2, 'all'); if (is_array($rows_2) && @sizeof($rows_2) != 0) { foreach ($rows_2 as $row_2) { @@ -409,7 +401,6 @@ $p->add('conference_profile_param_add', 'temp'); //save the array - $database = new database; $database->app_name = $this->app_name; $database->app_uuid = $this->app_uuid; $database->save($array); diff --git a/app/conferences/app_config.php b/app/conferences/app_config.php index e3bfb5fbdf..b863a11494 100644 --- a/app/conferences/app_config.php +++ b/app/conferences/app_config.php @@ -35,7 +35,7 @@ $apps[$x]['destinations'][$y]['type'] = "sql"; $apps[$x]['destinations'][$y]['label'] = "conferences"; $apps[$x]['destinations'][$y]['name'] = "conferences"; - $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and conference_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and conference_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "natural_sort(conference_extension) asc"; $apps[$x]['destinations'][$y]['field']['conference_uuid'] = "conference_uuid"; $apps[$x]['destinations'][$y]['field']['uuid'] = "conference_uuid"; @@ -188,7 +188,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "conference_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select whether to enable or disable the conference."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date"; diff --git a/app/conferences/conference_edit.php b/app/conferences/conference_edit.php index 7f61b3f627..4f4729551f 100644 --- a/app/conferences/conference_edit.php +++ b/app/conferences/conference_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): @@ -70,7 +70,7 @@ $conference_account_code = $_POST["conference_account_code"]; $conference_order = $_POST["conference_order"]; $conference_description = $_POST["conference_description"]; - $conference_enabled = $_POST["conference_enabled"] ?? 'false'; + $conference_enabled = $_POST["conference_enabled"]; //set the context for users that do not have the permission if (permission_exists('conference_context')) { @@ -234,7 +234,7 @@ } $array['dialplans'][0]['app_uuid'] = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9'; $array['dialplans'][0]['dialplan_xml'] = $dialplan_xml; - $array['dialplans'][0]['dialplan_continue'] = 'false'; + $array['dialplans'][0]['dialplan_continue'] = "false"; $array['dialplans'][0]['dialplan_order'] = '333'; $array['dialplans'][0]['dialplan_enabled'] = $conference_enabled; $array['dialplans'][0]['dialplan_description'] = $conference_description; @@ -288,7 +288,20 @@ //pre-populate the form if (!empty($_GET) && empty($_POST["persistformvar"])) { $conference_uuid = $_GET["id"]; - $sql = "select * from v_conferences "; + $sql = "select "; + $sql .= "dialplan_uuid, "; + $sql .= "conference_name, "; + $sql .= "conference_extension, "; + $sql .= "conference_pin_number, "; + $sql .= "conference_profile, "; + $sql .= "conference_flags, "; + $sql .= "conference_email_address, "; + $sql .= "conference_account_code, "; + $sql .= "conference_order, "; + $sql .= "conference_description, "; + $sql .= "conference_context, "; + $sql .= "conference_enabled "; + $sql .= "from v_conferences "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and conference_uuid = :conference_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; @@ -315,7 +328,6 @@ //set the defaults if (empty($conference_context)) { $conference_context = $_SESSION['domain_name']; } - if (empty($conference_enabled)) { $conference_enabled = 'true'; } //get the conference profiles $sql = "select * "; @@ -329,7 +341,7 @@ //get conference users $sql = "select * from v_conference_users as e, v_users as u "; $sql .= "where e.user_uuid = u.user_uuid "; - $sql .= "and u.user_enabled = 'true' "; + $sql .= "and u.user_enabled = true "; $sql .= "and e.domain_uuid = :domain_uuid "; $sql .= "and e.conference_uuid = :conference_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; @@ -341,7 +353,7 @@ //get the users $sql = "select * from v_users "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and user_enabled = 'true' "; + $sql .= "and user_enabled = true "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $users = $database->select($sql, $parameters ?? null, 'all'); @@ -556,17 +568,16 @@ echo " ".$text['table-enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo "".$text['description-conference-enable']."\n"; diff --git a/app/conferences/conferences.php b/app/conferences/conferences.php index e4e4e7e5d8..1e389f0067 100644 --- a/app/conferences/conferences.php +++ b/app/conferences/conferences.php @@ -118,7 +118,6 @@ $parameters['user_uuid'] = $_SESSION['user_uuid']; } $sql .= $sql_search ?? ''; - $database = new database; $num_rows = $database->select($sql, $parameters ?? null, 'column'); //prepare to page the results @@ -134,10 +133,40 @@ $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(*)', '*', $sql); + $sql = "select "; + $sql .= "domain_uuid, "; + $sql .= "conference_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "conference_name, "; + $sql .= "conference_extension, "; + $sql .= "conference_pin_number, "; + $sql .= "conference_profile, "; + $sql .= "conference_email_address, "; + $sql .= "conference_account_code, "; + $sql .= "conference_flags, "; + $sql .= "conference_order, "; + $sql .= "conference_description, "; + $sql .= "conference_context, "; + $sql .= "cast(conference_enabled as text) "; + if (permission_exists('conference_view')) { + //show all extensions + $sql .= "from v_conferences as c "; + $sql .= "where true "; + if ($show != "all" || !permission_exists('conference_all')) { + $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + } + } + else { + //show only assigned extensions + $sql .= "from v_conferences as c, v_conference_users as u "; + $sql .= "where c.conference_uuid = u.conference_uuid "; + $sql .= "and c.domain_uuid = :domain_uuid "; + $sql .= "and u.user_uuid = :user_uuid "; + $parameters['user_uuid'] = $_SESSION['user_uuid']; + } $sql .= order_by($order_by, $order, null, null, $sort); $sql .= limit_offset($rows_per_page, $offset); - $database = new database; $conferences = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); diff --git a/app/destinations/app_config.php b/app/destinations/app_config.php index e687bee91a..be6079d31e 100644 --- a/app/destinations/app_config.php +++ b/app/destinations/app_config.php @@ -36,7 +36,7 @@ $apps[$x]['destinations'][$y]['label'] = "destinations"; $apps[$x]['destinations'][$y]['name'] = "destinations"; $apps[$x]['destinations'][$y]['sql'] = "select destination_uuid, destination_uuid as uuid, destination_number, destination_context, destination_description from v_destinations "; - $apps[$x]['destinations'][$y]['where'] = "where (domain_uuid = '\${domain_uuid}' or domain_uuid is null) and (destination_type = 'outbound' or destination_type = 'local') and destination_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where (domain_uuid = '\${domain_uuid}' or domain_uuid is null) and (destination_type = 'outbound' or destination_type = 'local') and destination_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "destination_number asc"; $apps[$x]['destinations'][$y]['field']['destination_uuid'] = "destination_uuid"; $apps[$x]['destinations'][$y]['field']['destination_number'] = "destination_number"; @@ -393,7 +393,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the destination order."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_description"; diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 7c1eeab204..3ecb791670 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -120,7 +120,7 @@ $user_uuid = $_POST["user_uuid"]; $group_uuid = $_POST["group_uuid"]; $destination_order= $_POST["destination_order"]; - $destination_enabled = $_POST["destination_enabled"] ?? 'false'; + $destination_enabled = $_POST["destination_enabled"]; $destination_description = $_POST["destination_description"]; $destination_sell = check_float($_POST["destination_sell"] ?? ''); $currency = $_POST["currency"] ?? null; @@ -207,7 +207,6 @@ //if (empty($destination_prefix) && permission_exists('destination_prefix')) { $msg .= $text['message-required']." ".$text['label-destination_country_code']."
\n"; } if (empty($destination_number)) { $msg .= $text['message-required']." ".$text['label-destination_number']."
\n"; } if (empty($destination_context)) { $msg .= $text['message-required']." ".$text['label-destination_context']."
\n"; } - if (empty($destination_enabled)) { $msg .= $text['message-required']." ".$text['label-destination_enabled']."
\n"; } //check for duplicates if ($destination_type == 'inbound' && $destination_number != $db_destination_number && $settings->get('destinations', 'unique', false)) { @@ -449,7 +448,7 @@ $dialplan["dialplan_name"] = (!empty($dialplan_name)) ? $dialplan_name : format_phone($destination_area_code.$destination_number); $dialplan["dialplan_number"] = $destination_area_code.$destination_number; $dialplan["dialplan_context"] = $destination_context; - $dialplan["dialplan_continue"] = "false"; + $dialplan["dialplan_continue"] = 'false'; $dialplan["dialplan_order"] = $destination_order; $dialplan["dialplan_enabled"] = $destination_enabled; $dialplan["dialplan_description"] = (!empty($dialplan_description)) ? $dialplan_description : $destination_description; @@ -1326,7 +1325,6 @@ $currency_buy = $currency_buy ?? ''; $destination_carrier = $destination_carrier ?? ''; $destination_order = $destination_order ?? ''; - $destination_enabled = $destination_enabled ?? ''; $destination_description = $destination_description ?? ''; $destination_email = $destination_email ?? ''; $select_style = $select_style ?? ''; @@ -1335,7 +1333,39 @@ if (!empty($_GET["id"]) && empty($_POST["persistformvar"])) { if (is_uuid($_GET["id"])) { $destination_uuid = $_GET["id"]; - $sql = "select * from v_destinations "; + $sql = "select "; + $sql .= "domain_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "destination_type, "; + $sql .= "destination_number, "; + $sql .= "destination_condition_field, "; + $sql .= "destination_prefix, "; + $sql .= "destination_trunk_prefix, "; + $sql .= "destination_area_code, "; + $sql .= "destination_caller_id_name, "; + $sql .= "destination_caller_id_number, "; + $sql .= "destination_cid_name_prefix, "; + $sql .= "destination_hold_music, "; + $sql .= "destination_distinctive_ring, "; + $sql .= "destination_record, "; + $sql .= "destination_ringback, "; + $sql .= "destination_accountcode, "; + $sql .= "destination_type_voice, "; + $sql .= "destination_type_fax, "; + $sql .= "destination_type_text, "; + $sql .= "destination_type_emergency, "; + $sql .= "destination_context, "; + $sql .= "destination_conditions, "; + $sql .= "destination_actions, "; + $sql .= "fax_uuid, "; + $sql .= "provider_uuid, "; + $sql .= "user_uuid, "; + $sql .= "group_uuid, "; + $sql .= "destination_order, "; + $sql .= "destination_enabled, "; + $sql .= "destination_description, "; + $sql .= "destination_email "; + $sql .= "from v_destinations "; $sql .= "where destination_uuid = :destination_uuid "; $parameters['destination_uuid'] = $destination_uuid; $row = $database->select($sql, $parameters, 'row'); @@ -1462,7 +1492,6 @@ if (empty($destination_order)) { $destination_order = '100'; } if (empty($destination_type)) { $destination_type = 'inbound'; } if (empty($destination_context)) { $destination_context = 'public'; } - if (empty($destination_enabled)) { $destination_enabled = 'true'; } if ($destination_type =="outbound") { $destination_context = $_SESSION['domain_name']; } if ($destination_type =="local") { $destination_context = $_SESSION['domain_name']; } @@ -1489,7 +1518,7 @@ if (permission_exists('user_edit')) { $sql = "select * from v_users "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and user_enabled = 'true' "; + $sql .= "and user_enabled = true "; $sql .= "order by username asc "; $parameters['domain_uuid'] = $domain_uuid; $users = $database->select($sql, $parameters, 'all'); @@ -2135,22 +2164,16 @@ echo " ".$text['label-destination_enabled']."\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style', ''), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-destination_enabled']."\n"; diff --git a/app/destinations/destination_imports.php b/app/destinations/destination_imports.php index 203d300bf6..c3cfe5e83d 100644 --- a/app/destinations/destination_imports.php +++ b/app/destinations/destination_imports.php @@ -267,7 +267,7 @@ $array["dialplans"][$row_id]["dialplan_name"] = !empty($dialplan_name) ? $dialplan_name : format_phone($destination_number); $array["dialplans"][$row_id]["dialplan_number"] = $destination_number; $array["dialplans"][$row_id]["dialplan_context"] = $destination_context; - $array["dialplans"][$row_id]["dialplan_continue"] = "false"; + $array["dialplans"][$row_id]["dialplan_continue"] = false; $array["dialplans"][$row_id]["dialplan_order"] = "100"; $array["dialplans"][$row_id]["dialplan_enabled"] = $destination_enabled; $array["dialplans"][$row_id]["dialplan_description"] = $destination_description; diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index 94dea6ceeb..45a22372c4 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.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): @@ -164,14 +164,12 @@ $sql .= "or lower(destination_caller_id_name) like :search "; $sql .= "or destination_caller_id_number like :search "; } - $sql .= "or lower(destination_enabled) like :search "; $sql .= "or lower(destination_description) like :search "; $sql .= "or lower(destination_data) like :search "; $sql .= ") "; $parameters['search'] = '%'.$search.'%'; } $parameters['destination_type'] = $destination_type; - $database = new database; $num_rows = $database->select($sql, $parameters, 'column'); //prepare to page the results @@ -206,7 +204,7 @@ $sql .= " d.destination_context, "; $sql .= " d.destination_caller_id_name, "; $sql .= " d.destination_caller_id_number, "; - $sql .= " d.destination_enabled, "; + $sql .= " cast(d.destination_enabled as text), "; $sql .= " d.destination_description "; $sql .= "from v_destinations as d "; if ($show == "all" && permission_exists('destination_all')) { @@ -230,7 +228,6 @@ $sql .= " or lower(destination_caller_id_name) like :search "; $sql .= " or destination_caller_id_number like :search "; } - $sql .= " or lower(destination_enabled) like :search "; $sql .= " or lower(destination_description) like :search "; $sql .= " or lower(destination_data) like :search "; $sql .= ") "; @@ -238,7 +235,6 @@ } $sql .= order_by($order_by, $order, 'destination_number, destination_order ', 'asc'); $sql .= limit_offset($rows_per_page, $offset); - $database = new database; $destinations = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -463,4 +459,3 @@ require_once "resources/footer.php"; ?> - diff --git a/app/destinations/resources/classes/destinations.php b/app/destinations/resources/classes/destinations.php index cf6ad2f0d0..830d358f9c 100644 --- a/app/destinations/resources/classes/destinations.php +++ b/app/destinations/resources/classes/destinations.php @@ -1240,7 +1240,7 @@ $sql .= "and d.domain_uuid = :domain_uuid \n"; } $sql .= "and destination_type = 'inbound' \n"; - $sql .= "and destination_enabled = 'true' \n"; + $sql .= "and destination_enabled = true \n"; $sql .= "group by d.domain_uuid, d.destination_uuid, d.dialplan_uuid, n.domain_name, d.destination_type, d.destination_prefix, d.destination_number \n"; $sql .= "order by destination_number asc \n"; if (!(!empty($_GET['show']) && $_GET['show'] === 'all' && permission_exists('destination_summary_all'))) { diff --git a/app/devices/app_config.php b/app/devices/app_config.php index 718077b973..2d1254d9a7 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -482,7 +482,7 @@ $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "device_enabled"; $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "device_provision_enable"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_enabled_date"; @@ -670,7 +670,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date"; @@ -743,7 +743,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_setting_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_setting_description"; @@ -912,7 +912,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_profile_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_profile_description"; @@ -1003,7 +1003,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the device key extension.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'profile_key_protected'; - $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'boolean'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the device key protected.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'profile_key_label'; @@ -1073,7 +1073,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the profile setting value.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'profile_setting_enabled'; - $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'boolean'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the profile setting enabled.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'profile_setting_description'; @@ -1119,7 +1119,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the name."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the status of the vendor."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "description"; @@ -1189,7 +1189,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the value."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the status of the function."; $z++; @@ -1879,7 +1879,7 @@ $vendors[$y]['functions'][$z]['subtype'] = ""; $vendors[$y]['functions'][$z]['value'] = "blf"; $vendors[$y]['functions'][$z]['groups'][] = "superadmin"; - $vendors[$y]['functions'][$z]['groups'][] = "admin"; + $vendors[$y]['functions'][$z]['groups'][] = "admin"; $z++; $vendors[$y]['functions'][$z]['uuid'] = "b531c295-6b8f-4c50-a1a2-63aefbaf91ae"; $vendors[$y]['functions'][$z]['label'] = "label-line"; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 3430ac0258..12ca28976e 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -128,7 +128,7 @@ $device_uuid_alternate = $_POST["device_uuid_alternate"] ?? null; $device_model = $_POST["device_model"] ?? null; $device_firmware_version = $_POST["device_firmware_version"] ?? null; - $device_enabled = $_POST["device_enabled"] ?? 'false'; + $device_enabled = $_POST["device_enabled"]; $device_template = $_POST["device_template"]; $device_description = $_POST["device_description"]; //lines @@ -349,7 +349,7 @@ if (permission_exists('device_line_shared')) { $array['devices'][0]['device_lines'][$y]['shared_line'] = $row["shared_line"]; } - $array['devices'][0]['device_lines'][$y]['enabled'] = $row["enabled"] ?? 'false'; + $array['devices'][0]['device_lines'][$y]['enabled'] = $row["enabled"] ?? false; if (permission_exists('device_line_port')) { $array['devices'][0]['device_lines'][$y]['sip_port'] = $row["sip_port"]; } @@ -435,15 +435,14 @@ $array['devices'][0]['device_settings'][$y]['device_setting_subcategory'] = $row["device_setting_subcategory"] ?? null; $array['devices'][0]['device_settings'][$y]['device_setting_name'] = $row["device_setting_name"] ?? null; $array['devices'][0]['device_settings'][$y]['device_setting_value'] = $row["device_setting_value"] ?? null; - $array['devices'][0]['device_settings'][$y]['device_setting_enabled'] = $row["device_setting_enabled"] ?? 'false'; -// echo $array['devices'][0]['device_settings'][$y]['device_setting_enabled'].'
'; + $array['devices'][0]['device_settings'][$y]['device_setting_enabled'] = $row["device_setting_enabled"] ?? false; $array['devices'][0]['device_settings'][$y]['device_setting_description'] = $row["device_setting_description"]; $y++; } } } -// view_array($array); -// exit; + + //save the device $database->app_name = 'devices'; $database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e'; @@ -545,9 +544,6 @@ $domains = $database->select($sql, null, 'all'); unset($sql, $parameters); -//set the defaults - if (empty($device_enabled)) { $device_enabled = 'true'; } - //use the device address to get the vendor if (empty($device_vendor)) { //get the device vendor using the device address @@ -597,7 +593,7 @@ $device_lines[$x]['auth_id'] = ''; $device_lines[$x]['password'] = ''; $device_lines[$x]['shared_line'] = ''; - $device_lines[$x]['enabled'] = ''; + $device_lines[$x]['enabled'] = false; $device_lines[$x]['sip_port'] = $settings->get('provision', 'line_sip_port', '5060'); $device_lines[$x]['sip_transport'] = $settings->get('provision', 'line_sip_transport', 'tcp'); $device_lines[$x]['register_expires'] = $settings->get('provision', 'line_register_expires', '120'); @@ -685,7 +681,7 @@ for ($x = 0; $x < $rows; $x++) { $device_settings[$id]['device_setting_name'] = ''; $device_settings[$id]['device_setting_value'] = ''; - $device_settings[$id]['device_setting_enabled'] = ''; + $device_settings[$id]['device_setting_enabled'] = false; $device_settings[$id]['device_setting_description'] = ''; $id++; } @@ -694,7 +690,7 @@ //get the users $sql = "select * from v_users "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and user_enabled = 'true' "; + $sql .= "and user_enabled = true "; $sql .= "order by username asc "; $parameters['domain_uuid'] = $domain_uuid; $users = $database->select($sql, $parameters, 'all'); @@ -1283,7 +1279,6 @@ $x = 0; foreach ($device_lines as $row) { - //set the defaults if (!permission_exists('device_line_server_address')) { if (empty($row['server_address'])) { $row['server_address'] = $domain_name; } @@ -1453,17 +1448,16 @@ } echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo " \n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style', ''), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-device_enabled']."\n"; diff --git a/app/devices/device_profile_edit.php b/app/devices/device_profile_edit.php index 47c86882cd..01b91dde07 100644 --- a/app/devices/device_profile_edit.php +++ b/app/devices/device_profile_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2020-2024 All Rights Reserved. + Copyright (C) 2020-2025 All Rights Reserved. Contributor(s): Mark J Crane @@ -76,7 +76,7 @@ $device_profile_name = $_POST["device_profile_name"]; $device_profile_keys = $_POST["device_profile_keys"]; $device_profile_settings = $_POST["device_profile_settings"]; - $device_profile_enabled = $_POST["device_profile_enabled"] ?? 'false'; + $device_profile_enabled = $_POST["device_profile_enabled"]; $device_profile_description = $_POST["device_profile_description"]; $device_profile_keys_delete = $_POST["device_profile_keys_delete"] ?? null; $device_profile_settings_delete = $_POST["device_profile_settings_delete"] ?? null; @@ -96,7 +96,6 @@ $sql = "select domain_uuid from v_device_profiles "; $sql .= "where device_profile_uuid = :device_profile_uuid "; $parameters['device_profile_uuid'] = $device_profile_uuid; - $database = new database; $domain_uuid = $database->execute($sql, $parameters, 'column'); } } @@ -115,7 +114,6 @@ //if (empty($device_profile_keys)) { $msg .= $text['message-required']." ".$text['label-device_profile_keys']."
\n"; } //if (empty($device_profile_settings)) { $msg .= $text['message-required']." ".$text['label-device_profile_settings']."
\n"; } //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."
\n"; } - if (empty($device_profile_enabled)) { $msg .= $text['message-required']." ".$text['label-device_profile_enabled']."
\n"; } //if (empty($device_profile_description)) { $msg .= $text['message-required']." ".$text['label-device_profile_description']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -170,7 +168,7 @@ $array['device_profiles'][0]['device_profile_settings'][$y]["device_profile_setting_uuid"] = $row["device_profile_setting_uuid"]; $array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_name"] = $row["profile_setting_name"]; $array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_value"] = $row["profile_setting_value"]; - $array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_enabled"] = $row["profile_setting_enabled"] ?? 'false'; + $array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_enabled"] = $row["profile_setting_enabled"]; $array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_description"] = $row["profile_setting_description"]; $y++; } @@ -178,7 +176,6 @@ } //save to the data - $database = new database; $database->app_name = 'Device Profiles'; $database->app_uuid = 'bb2531c3-97e6-428f-9a19-cbac1b96f5b7'; $database->save($array); @@ -223,12 +220,17 @@ //pre-populate the form if (!empty($_GET) && is_array($_GET) && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) { $device_profile_uuid = $_GET["id"]; - $sql = "select * from v_device_profiles "; + $sql = "select "; + $sql .= "device_profile_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "device_profile_name, "; + $sql .= "device_profile_enabled, "; + $sql .= "device_profile_description "; + $sql .= "from v_device_profiles "; $sql .= "where device_profile_uuid = :device_profile_uuid "; //$sql .= "and domain_uuid = :domain_uuid "; //$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['device_profile_uuid'] = $device_profile_uuid; - $database = new database; $result = $database->execute($sql, $parameters, 'all'); foreach ($result as $row) { $domain_uuid = $row["domain_uuid"]; @@ -241,9 +243,6 @@ unset ($sql, $parameters); } -//set the defaults - if (empty($device_profile_enabled)) { $device_profile_enabled = 'true'; } - //get the child data if (!empty($device_profile_uuid)) { $sql = "select * from v_device_profile_keys "; @@ -265,7 +264,6 @@ $sql .= "profile_key_id asc "; //$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['device_profile_uuid'] = $device_profile_uuid; - $database = new database; $device_profile_keys = $database->execute($sql, $parameters, 'all'); unset ($sql, $parameters); } @@ -295,9 +293,8 @@ //get the vendors $sql = "select * "; $sql .= "from v_device_vendors as v "; - $sql .= "where enabled = 'true' "; + $sql .= "where enabled = true "; $sql .= "order by name asc "; - $database = new database; $vendors = $database->select($sql, null, 'all'); unset($sql); @@ -305,10 +302,9 @@ $sql = "select v.name as vendor_name, f.type, f.subtype, f.value "; $sql .= "from v_device_vendors as v, v_device_vendor_functions as f "; $sql .= "where v.device_vendor_uuid = f.device_vendor_uuid "; - $sql .= "and v.enabled = 'true' "; - $sql .= "and f.enabled = 'true' "; + $sql .= "and v.enabled = true "; + $sql .= "and f.enabled = true "; $sql .= "order by v.name asc, f.type asc "; - $database = new database; $vendor_functions = $database->select($sql, null, 'all'); unset($sql); @@ -352,7 +348,6 @@ $sql .= "order by profile_setting_name asc"; //$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['device_profile_uuid'] = $device_profile_uuid; - $database = new database; $device_profile_settings = $database->execute($sql, $parameters, 'all'); unset ($sql, $parameters); } @@ -369,7 +364,7 @@ $device_profile_settings[$x]['device_profile_setting_uuid'] = ''; $device_profile_settings[$x]['profile_setting_name'] = ''; $device_profile_settings[$x]['profile_setting_value'] = ''; - $device_profile_settings[$x]['profile_setting_enabled'] = 'true'; + $device_profile_settings[$x]['profile_setting_enabled'] = true; $device_profile_settings[$x]['profile_setting_description'] = ''; //filter the uuid @@ -632,20 +627,29 @@ echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo " \n"; echo " \n"; echo " \n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo " \n"; @@ -771,17 +774,16 @@ echo " ".$text['label-device_profile_enabled']."\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo ($text['description-device_profile_enabled'] ?? '')."\n"; diff --git a/app/devices/device_profiles.php b/app/devices/device_profiles.php index c689e15bed..319f26bd7e 100644 --- a/app/devices/device_profiles.php +++ b/app/devices/device_profiles.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2019-2024 All Rights Reserved. + Copyright (C) 2019-2025 All Rights Reserved. Contributor(s): Mark J Crane @@ -118,7 +118,6 @@ $parameters['domain_uuid'] = $domain_uuid; } $sql .= $sql_search ?? ''; - $database = new database; $num_rows = $database->select($sql, $parameters ?? null, 'column'); //prepare to page the results @@ -137,10 +136,21 @@ $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(*)', '*', $sql); + $sql = "select "; + $sql .= "device_profile_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "device_profile_name, "; + $sql .= "cast(device_profile_enabled as text), "; + $sql .= "device_profile_description "; + $sql .= "from v_device_profiles "; + $sql .= "where true "; + if ($show != "all" || !permission_exists('device_profile_all')) { + $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; + $parameters['domain_uuid'] = $domain_uuid; + } + $sql .= $sql_search ?? ''; $sql .= order_by($order_by, $order, 'device_profile_name', 'asc'); $sql .= limit_offset($rows_per_page, $offset); - $database = new database; $device_profiles = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); @@ -302,4 +312,3 @@ require_once "resources/footer.php"; ?> - diff --git a/app/devices/device_vendor_edit.php b/app/devices/device_vendor_edit.php index 796785c812..fac508cd84 100644 --- a/app/devices/device_vendor_edit.php +++ b/app/devices/device_vendor_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) 2016-2024 + Portions created by the Initial Developer are Copyright (C) 2016-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -53,7 +53,7 @@ //get http post variables and set them to php variables if (count($_POST) > 0) { $name = $_POST["name"]; - $enabled = $_POST["enabled"] ?? 'false'; + $enabled = $_POST["enabled"]; $description = $_POST["description"]; } @@ -76,7 +76,6 @@ //check for all required data $msg = ''; if (empty($name)) { $msg .= $text['message-required']." ".$text['label-name']."
\n"; } - if (empty($enabled)) { $msg .= $text['message-required']." ".$text['label-enabled']."
\n"; } //if (empty($description)) { $msg .= $text['message-required']." ".$text['label-description']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -123,7 +122,12 @@ //pre-populate the form if (!empty($_GET) && count($_GET) > 0 && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) { $device_vendor_uuid = $_GET["id"]; - $sql = "select * from v_device_vendors "; + $sql = "select "; + $sql .= "device_vendor_uuid, "; + $sql .= "name, "; + $sql .= "enabled, "; + $sql .= "description "; + $sql .= "from v_device_vendors "; $sql .= "where device_vendor_uuid = :device_vendor_uuid "; $parameters['device_vendor_uuid'] = $device_vendor_uuid; $database = new database; @@ -136,9 +140,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($enabled)) { $enabled = true; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -178,17 +179,16 @@ echo " ".$text['label-enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; diff --git a/app/devices/device_vendor_function_edit.php b/app/devices/device_vendor_function_edit.php index b3a4f38afe..1e8c4f1b6e 100644 --- a/app/devices/device_vendor_function_edit.php +++ b/app/devices/device_vendor_function_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) 2016-2024 + Portions created by the Initial Developer are Copyright (C) 2016-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -47,7 +47,6 @@ $p = permissions::new(); $p->add('device_vendor_function_group_delete', 'temp'); - $database = new database; $database->app_name = 'devices'; $database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e'; $database->delete($array); @@ -95,7 +94,7 @@ $type = $_POST["type"]; $subtype = $_POST["subtype"]; $value = $_POST["value"]; - $enabled = $_POST["enabled"] ?? 'false'; + $enabled = $_POST["enabled"]; $description = $_POST["description"]; } @@ -120,7 +119,6 @@ //if (empty($label)) { $msg .= $text['message-required']." ".$text['label-label']."
\n"; } if (empty($type)) { $msg .= $text['message-required']." ".$text['label-type']."
\n"; } if (empty($value)) { $msg .= $text['message-required']." ".$text['label-value']."
\n"; } - if (empty($enabled)) { $msg .= $text['message-required']." ".$text['label-enabled']."
\n"; } //if (empty($description)) { $msg .= $text['message-required']." ".$text['label-description']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -159,7 +157,6 @@ $array['device_vendor_functions'][0]['enabled'] = $enabled; $array['device_vendor_functions'][0]['description'] = $description; - $database = new database; $database->app_name = 'devices'; $database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e'; $database->save($array); @@ -186,7 +183,6 @@ $p = permissions::new(); $p->add('device_vendor_function_group_add', 'temp'); - $database = new database; $database->app_name = 'devices'; $database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e'; $database->save($array); @@ -206,13 +202,19 @@ //pre-populate the form if (!empty($_GET) && count($_GET) > 0 && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) { $device_vendor_function_uuid = $_GET["id"] ?? null; - $sql = "select * from v_device_vendor_functions "; + $sql = "select "; + $sql .= "device_vendor_function_uuid, "; + $sql .= "device_vendor_uuid, "; + $sql .= "type, "; + $sql .= "subtype, "; + $sql .= "value, "; + $sql .= "enabled, "; + $sql .= "description "; + $sql .= "from v_device_vendor_functions "; $sql .= "where device_vendor_function_uuid = :device_vendor_function_uuid "; $parameters['device_vendor_function_uuid'] = $device_vendor_function_uuid; - $database = new database; $row = $database->select($sql, $parameters, 'row'); if (is_array($row) && @sizeof($row) != 0) { - //$label = $row["label"]; $type = $row["type"]; $subtype = $row["subtype"]; $value = $row["value"]; @@ -237,7 +239,6 @@ $sql .= "g.group_name asc "; $parameters['device_vendor_uuid'] = $device_vendor_uuid; $parameters['device_vendor_function_uuid'] = $device_vendor_function_uuid; - $database = new database; $function_groups = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -251,7 +252,14 @@ } //get the groups - $sql = "select * from v_groups "; + $sql = "select "; + $sql .= "group_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "group_name, "; + $sql .= "group_protected, "; + $sql .= "group_level, "; + $sql .= "group_description "; + $sql .= "from v_groups "; if (!empty($assigned_groups) && is_array($assigned_groups) && @sizeof($assigned_groups) != 0) { $sql .= "where "; foreach ($assigned_groups as $index => $group_uuid) { @@ -263,7 +271,6 @@ } } $sql .= "order by domain_uuid desc, group_name asc "; - $database = new database; $groups = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters, $sql_where, $index); @@ -366,17 +373,16 @@ echo " ".$text['label-enabled']."\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; diff --git a/app/devices/device_vendor_functions.php b/app/devices/device_vendor_functions.php index 3c1174c165..80e08c5fc7 100644 --- a/app/devices/device_vendor_functions.php +++ b/app/devices/device_vendor_functions.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) 2016-2024 + Portions created by the Initial Developer are Copyright (C) 2016-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -76,18 +76,20 @@ $order_by = $_GET["order_by"] ?? null; $order = $_GET["order"] ?? null; +//get the search term + $search = strtolower($_GET["search"] ?? ''); + //prepare to page the results $sql = "select count(*) from v_device_vendor_functions "; $sql .= "where device_vendor_uuid = :device_vendor_uuid "; - if (isset($_GET["search"])) { + if (!empty($search)) { $sql .= "and ("; $sql .= " label like :search "; $sql .= " or type like :search "; $sql .= " or subtype like :search "; - $sql .= " or enabled like :search "; $sql .= " or description like :search "; $sql .= ")"; - $parameters['search'] = '%'.$_GET["search"].'%'; + $parameters['search'] = '%'.$search.'%'; } $parameters['device_vendor_uuid'] = $device_vendor_uuid; $database = new database; @@ -106,18 +108,25 @@ } //get the list - $sql = "select * from v_device_vendor_functions "; + $sql = "select "; + $sql .= "device_vendor_function_uuid, "; + $sql .= "device_vendor_uuid, "; + $sql .= "type, "; + $sql .= "subtype, "; + $sql .= "value, "; + $sql .= "cast(enabled as text), "; + $sql .= "description "; + $sql .= "from v_device_vendor_functions "; $sql .= "where device_vendor_uuid = :device_vendor_uuid "; - if (isset($_GET["search"])) { + if (!empty($search)) { $sql .= "and ("; $sql .= " label like :search "; $sql .= " or type like :search "; $sql .= " or subtype like :search "; $sql .= " or value like :search "; - $sql .= " or enabled like :search "; $sql .= " or description like :search "; $sql .= ")"; - $parameters['search'] = '%'.$_GET["search"].'%'; + $parameters['search'] = '%'.$search.'%'; } $parameters['device_vendor_uuid'] = $device_vendor_uuid; $sql .= order_by($order_by, $order, 'type', 'asc'); @@ -293,4 +302,3 @@ echo "\n"; ?> - diff --git a/app/devices/device_vendors.php b/app/devices/device_vendors.php index 01e85278a7..633ef35861 100644 --- a/app/devices/device_vendors.php +++ b/app/devices/device_vendors.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) 2016-2024 + Portions created by the Initial Developer are Copyright (C) 2016-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -74,20 +74,19 @@ $order_by = $_GET["order_by"] ?? null; $order = $_GET["order"] ?? null; -//add the search term +//set the search term $search = strtolower($_GET["search"] ?? ''); - if (!empty($search)) { - $sql_where = "where ("; - $sql_where .= "lower(name) like :search "; - $sql_where .= "or lower(enabled) like :search "; - $sql_where .= "or lower(description) like :search "; - $sql_where .= ")"; - $parameters['search'] = '%'.$search.'%'; - } //prepare to page the results $sql = "select count(*) from v_device_vendors "; - $sql .= $sql_where ?? null; + if (!empty($search)) { + $sql .= "where ("; + $sql .= " lower(name) like :search "; + $sql .= " or lower(enabled) like :search "; + $sql .= " or lower(description) like :search "; + $sql .= ")"; + $parameters['search'] = '%'.$search.'%'; + } $database = new database; $num_rows = $database->select($sql, $parameters ?? null, 'column'); @@ -101,7 +100,20 @@ $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(*)', '*', $sql); + $sql = "select "; + $sql .= "device_vendor_uuid, "; + $sql .= "name, "; + $sql .= "cast(enabled as text), "; + $sql .= "description "; + $sql .= "from v_device_vendors "; + if (!empty($search)) { + $sql .= "where ("; + $sql .= " lower(name) like :search "; + $sql .= " or lower(enabled) like :search "; + $sql .= " or lower(description) like :search "; + $sql .= ")"; + $parameters['search'] = '%'.$search.'%'; + } $sql .= order_by($order_by, $order, 'name', 'asc'); $sql .= limit_offset($rows_per_page, $offset); $database = new database; @@ -226,4 +238,3 @@ require_once "resources/footer.php"; ?> - diff --git a/app/devices/devices.php b/app/devices/devices.php index 7c251692a5..5906cd7f64 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -135,7 +135,6 @@ $sql .= " lower(d.device_address) like :search "; $sql .= " or lower(d.device_label) like :search "; $sql .= " or lower(d.device_vendor) like :search "; - $sql .= " or lower(d.device_enabled) like :search "; $sql .= " or lower(d.device_template) like :search "; $sql .= " or lower(d.device_description) like :search "; $sql .= " or lower(d.device_provisioned_method) like :search "; @@ -189,7 +188,30 @@ if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) { $sql .= "d3.domain_name, "; } - $sql .="d.*, d2.device_label as alternate_label, "; + $sql .= "d.device_uuid, "; + $sql .= "d.domain_uuid, "; + $sql .= "d.device_address, "; + $sql .= "d.device_label, "; + $sql .= "d.device_vendor, "; + $sql .= "d.device_model, "; + $sql .= "d.device_firmware_version, "; + $sql .= "d.device_template, "; + $sql .= "d.device_username, "; + $sql .= "d.device_password, "; + $sql .= "d.device_time_zone, "; + $sql .= "d.device_description, "; + $sql .= "d.device_profile_uuid, "; + $sql .= "d.device_uuid_alternate, "; + $sql .= "d.device_user_uuid, "; + $sql .= "d.device_provisioned_date, "; + $sql .= "d.device_provisioned_method, "; + $sql .= "d.device_provisioned_ip, "; + $sql .= "d.device_enabled_date, "; + $sql .= "d.device_provisioned_agent, "; + $sql .= "d.device_location, "; + $sql .= "d.device_serial_number, "; + $sql .= "cast(d.device_enabled as text), "; + $sql .= "d2.device_label as alternate_label, "; $sql .= "to_char(timezone(:time_zone, d.device_provisioned_date), 'DD Mon YYYY') as provisioned_date_formatted, \n"; $sql .= "to_char(timezone(:time_zone, d.device_provisioned_date), 'HH12:MI:SS am') as provisioned_time_formatted \n"; $sql .= "from v_devices as d, v_devices as d2 "; @@ -224,7 +246,6 @@ $sql .= " lower(d.device_address) like :search "; $sql .= " or lower(d.device_label) like :search "; $sql .= " or lower(d.device_vendor) like :search "; - $sql .= " or lower(d.device_enabled) like :search "; $sql .= " or lower(d.device_template) like :search "; $sql .= " or lower(d.device_description) like :search "; $sql .= " or lower(d.device_provisioned_method) like :search "; @@ -477,4 +498,3 @@ require_once "resources/footer.php"; ?> - diff --git a/app/dialplan_inbound/dialplan_inbound_add.php b/app/dialplan_inbound/dialplan_inbound_add.php index 0789b18c52..2035c769df 100644 --- a/app/dialplan_inbound/dialplan_inbound_add.php +++ b/app/dialplan_inbound/dialplan_inbound_add.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): @@ -122,9 +122,8 @@ $condition_expression_1 = '^('.$condition_expression_1.')$'; } } - $dialplan_enabled = $_POST["dialplan_enabled"] ?? 'false'; + $dialplan_enabled = $_POST["dialplan_enabled"]; $dialplan_description = $_POST["dialplan_description"]; - if (empty($dialplan_enabled)) { $dialplan_enabled = "true"; } //set default to enabled } //process the http post data @@ -145,9 +144,6 @@ if (empty($condition_field_1)) { $msg .= "".$text['label-required-condition_field_1']."
\n"; } if (empty($condition_expression_1)) { $msg .= "".$text['label-required-condition_expression_1']."
\n"; } if (empty($action_application_1)) { $msg .= "".$text['label-required-action_application_1']."
\n"; } - //if (empty($limit)) { $msg .= "Please provide: Limit
\n"; } - //if (empty($dialplan_enabled)) { $msg .= "Please provide: Enabled True or False
\n"; } - //if (empty($dialplan_description)) { $msg .= "Please provide: Description
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; @@ -180,7 +176,7 @@ $array['dialplans'][$x]['dialplan_name'] = $dialplan_name; $array['dialplans'][$x]['dialplan_number'] = $destination_number; $array['dialplans'][$x]['dialplan_order'] = $public_order; - $array['dialplans'][$x]['dialplan_continue'] = 'false'; + $array['dialplans'][$x]['dialplan_continue'] = false; $array['dialplans'][$x]['dialplan_context'] = 'public'; $array['dialplans'][$x]['dialplan_enabled'] = $dialplan_enabled; $array['dialplans'][$x]['dialplan_description'] = $dialplan_description; @@ -781,17 +777,16 @@ echo " ".$text['label-enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; diff --git a/app/dialplans/app_config.php b/app/dialplans/app_config.php index 8c1e11d79b..9e0cbfb55b 100644 --- a/app/dialplans/app_config.php +++ b/app/dialplans/app_config.php @@ -36,7 +36,7 @@ $apps[$x]['destinations'][$y]['label'] = "dialplans"; $apps[$x]['destinations'][$y]['name'] = "dialplans"; $apps[$x]['destinations'][$y]['sql'] = "select d.domain_name, e.dialplan_name, e.dialplan_number as destination, e.dialplan_description as description from v_dialplans as e, v_domains as d "; - $apps[$x]['destinations'][$y]['where'] = "where e.domain_uuid = '\${domain_uuid}' and e.domain_uuid = d.domain_uuid and e.dialplan_destination = 'true' and e.dialplan_number <> '' and e.dialplan_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where e.domain_uuid = '\${domain_uuid}' and e.domain_uuid = d.domain_uuid and e.dialplan_destination = true and e.dialplan_number <> '' and e.dialplan_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "dialplan_order asc"; $apps[$x]['destinations'][$y]['field']['domain_name'] = "domain_name"; $apps[$x]['destinations'][$y]['field']['dialplan_name'] = "dialplan_name"; @@ -158,12 +158,11 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_destination"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_continue"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_xml"; @@ -177,7 +176,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_description"; diff --git a/app/dialplans/app_defaults.php b/app/dialplans/app_defaults.php index f2433e61ac..927e827179 100644 --- a/app/dialplans/app_defaults.php +++ b/app/dialplans/app_defaults.php @@ -152,9 +152,9 @@ $array['dialplans'][0]['app_uuid'] = 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4'; $array['dialplans'][0]['dialplan_context'] = 'public'; $array['dialplans'][0]['dialplan_name'] = 'not-found'; - $array['dialplans'][0]['dialplan_continue'] = 'false'; + $array['dialplans'][0]['dialplan_continue'] = false; $array['dialplans'][0]['dialplan_order'] = '999'; - $array['dialplans'][0]['dialplan_enabled'] = 'false'; + $array['dialplans'][0]['dialplan_enabled'] = false; $array['dialplan_details'][0]['dialplan_uuid'] = 'ea5339de-1982-46ca-9695-c35176165314'; $array['dialplan_details'][0]['dialplan_detail_uuid'] = '8a21744d-b381-4cb0-9930-55b776e4e461'; diff --git a/app/dialplans/dialplan_add.php b/app/dialplans/dialplan_add.php index 3e603c6db4..675caf3466 100644 --- a/app/dialplans/dialplan_add.php +++ b/app/dialplans/dialplan_add.php @@ -72,7 +72,7 @@ $dialplan_context = $_POST["dialplan_context"]; $dialplan_order = $_POST["dialplan_order"]; - $dialplan_enabled = $_POST["dialplan_enabled"] ?? 'false'; + $dialplan_enabled = $_POST["dialplan_enabled"] ?? false; $dialplan_description = $_POST["dialplan_description"]; } @@ -122,7 +122,7 @@ $array['dialplans'][0]['app_uuid'] = '742714e5-8cdf-32fd-462c-cbe7e3d655db'; $array['dialplans'][0]['dialplan_name'] = $dialplan_name; $array['dialplans'][0]['dialplan_order'] = $dialplan_order; - $array['dialplans'][0]['dialplan_continue'] = 'false'; + $array['dialplans'][0]['dialplan_continue'] = false; $array['dialplans'][0]['dialplan_context'] = $dialplan_context; $array['dialplans'][0]['dialplan_enabled'] = $dialplan_enabled; $array['dialplans'][0]['dialplan_description'] = $dialplan_description; @@ -269,13 +269,13 @@ //echo "
\n"; //echo " \n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo " \n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; + $label_dialplan_detail_enabled = $text['label-'.($dialplan_detail_enabled === true ? 'true' : 'false')]; if ($element['hidden']) { - echo " \n"; + echo " \n"; } echo " \n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-extension_setting_enabled']."\n"; @@ -381,4 +377,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php index 2731150b75..07df0c7c4e 100644 --- a/app/extensions/app_config.php +++ b/app/extensions/app_config.php @@ -477,11 +477,11 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "directory_visible"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "directory_exten_visible"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "max_registrations"; @@ -524,7 +524,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "call_screen_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "user_record"; @@ -580,7 +580,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "do_not_disturb"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "forward_all_destination"; @@ -589,7 +589,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "forward_all_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "forward_busy_destination"; @@ -597,7 +597,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "forward_busy_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "forward_no_answer_destination"; @@ -605,7 +605,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "forward_no_answer_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "forward_user_not_registered_destination"; @@ -613,7 +613,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "forward_user_not_registered_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "follow_me_uuid"; @@ -625,7 +625,7 @@ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "follow_me_uuid"; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "follow_me_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "follow_me_destinations"; @@ -649,7 +649,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "description"; @@ -664,7 +664,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "force_ping"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date"; diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 8c3bbe9afe..78a0006a93 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_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-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -159,7 +159,7 @@ //$device_uuid = $_POST["device_uuid"]; //$device_line = $_POST["device_line"]; $voicemail_password = $_POST["voicemail_password"]; - $voicemail_enabled = $_POST["voicemail_enabled"] ?? 'false'; + $voicemail_enabled = $_POST["voicemail_enabled"]; $voicemail_mail_to = $_POST["voicemail_mail_to"]; $voicemail_transcription_enabled = $_POST["voicemail_transcription_enabled"]; $voicemail_file = $_POST["voicemail_file"]; @@ -186,7 +186,7 @@ $dial_string = $_POST["dial_string"]; $extension_language = $_POST["extension_language"]; $extension_type = $_POST["extension_type"]; - $enabled = $_POST["enabled"] ?? 'false'; + $enabled = $_POST["enabled"]; $description = $_POST["description"]; //set defaults @@ -375,9 +375,6 @@ //check for all required data $msg = ''; if (empty($extension)) { $msg .= $text['message-required'].$text['label-extension']."
\n"; } - if (permission_exists('extension_enabled')) { - if (empty($enabled)) { $msg .= $text['message-required'].$text['label-enabled']."
\n"; } - } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; @@ -695,7 +692,7 @@ if (!empty($device_templates[$d])) { $array["devices"][$j]["device_template"] = $device_templates[$d]; } - $array["devices"][$j]["device_enabled"] = "true"; + $array["devices"][$j]["device_enabled"] = true; $array["devices"][$j]["device_lines"][0]["device_uuid"] = $device_uuids[$d]; $array["devices"][$j]["device_lines"][0]["device_line_uuid"] = uuid(); $array["devices"][$j]["device_lines"][0]["domain_uuid"] = $domain_uuid; @@ -754,7 +751,7 @@ //if voicemail_uuid does not exist then get a new uuid if (!is_uuid($voicemail_uuid)) { $voicemail_uuid = uuid(); - $voicemail_tutorial = 'true'; + $voicemail_tutorial = true; //if adding a mailbox and don't have the transcription permission, set the default transcribe behavior if (!permission_exists('voicemail_transcription_enabled')) { $voicemail_transcription_enabled = $voicemail_transcription_enabled_default; @@ -1021,7 +1018,7 @@ //get the device vendors $sql = "select name "; $sql .= "from v_device_vendors "; - $sql .= "where enabled = 'true' "; + $sql .= "where enabled = true "; $sql .= "order by name asc "; $device_vendors = $database->select($sql, null, 'all'); unset($sql); @@ -1031,7 +1028,7 @@ $sql = "select u.username, e.user_uuid "; $sql .= "from v_extension_users as e, v_users as u "; $sql .= "where e.user_uuid = u.user_uuid "; - $sql .= "and u.user_enabled = 'true' "; + $sql .= "and u.user_enabled = true "; $sql .= "and e.domain_uuid = :domain_uuid "; $sql .= "and e.extension_uuid = :extension_uuid "; $sql .= "order by u.username asc "; @@ -1055,7 +1052,7 @@ $parameters['user_uuid_'.$index] = $assigned_user_uuid; } } - $sql .= "and user_enabled = 'true' "; + $sql .= "and user_enabled = true "; $sql .= "order by username asc "; $parameters['domain_uuid'] = $domain_uuid; $users = $database->select($sql, $parameters, 'all'); @@ -1099,18 +1096,27 @@ } } -//set the defaults +//set the defaults - extension if (empty($user_context)) { $user_context = $domain_name; } if (empty($max_registrations)) { $max_registrations = $extension_max_registrations ?? ''; } if (empty($accountcode)) { $accountcode = get_accountcode(); } if (empty($limit_max)) { $limit_max = $extension_limit_max; } if (empty($limit_destination)) { $limit_destination = '!USER_BUSY'; } if (empty($call_timeout)) { $call_timeout = $extension_call_timeout; } - if (empty($call_screen_enabled)) { $call_screen_enabled = 'false'; } if (empty($user_record)) { $user_record = $extension_user_record_default; } - if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $voicemail_transcription_enabled_default; } - if (empty($voicemail_enabled)) { $voicemail_enabled = $voicemail_enabled_default; } - if (empty($enabled)) { $enabled = 'true'; } + if (!isset($directory_visible)) { $directory_visible = false; } + if (!isset($directory_exten_visible)) { $directory_exten_visible = false; } + if (!isset($call_screen_enabled)) { $call_screen_enabled = false; } + if (!isset($force_ping)) { $force_ping = false; } + if (!isset($enabled)) { $enabled = true; } + +//set the defaults - voicemail + if (!isset($voicemail_local_after_email)) { $voicemail_local_after_email = $settings->get('voicemail','keep_local', true); } + if (!isset($voicemail_enabled)) { $voicemail_enabled = $settings->get('voicemail', 'enabled_default', true); } + if (!isset($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $settings->get('voicemail', 'transcription_enabled_default', false); } + if (!isset($voicemail_tutorial)) { $voicemail_tutorial = false; } + if (!isset($voicemail_recording_instructions)) { $voicemail_recording_instructions = true; } + if (!isset($voicemail_recording_options)) { $voicemail_recording_options = true; } //create token $object = new token; @@ -1714,17 +1720,16 @@ echo " ".$text['label-directory_visible']."\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-directory_visible']."\n"; @@ -1736,17 +1741,16 @@ echo " ".$text['label-directory_exten_visible']."\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-directory_exten_visible']."\n"; @@ -1797,17 +1801,16 @@ echo " ".$text['label-voicemail_enabled']."\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-voicemail_enabled']."\n"; @@ -1831,17 +1834,16 @@ echo " ".$text['label-voicemail_transcription_enabled']."\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-voicemail_transcription_enabled']."\n"; @@ -1872,17 +1874,16 @@ echo " ".$text['label-voicemail_local_after_email']."\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-voicemail_local_after_email']."\n"; @@ -1984,21 +1985,17 @@ echo " ".$text['label-call_screen_enabled']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($call_screen_enabled == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo $text['description-call_screen_enabled']."\n"; echo "
\n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "
\n"; echo $text['description-force_ping']."\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; diff --git a/app/extensions/extensions.php b/app/extensions/extensions.php index 3d37a9366b..b9a5730a13 100644 --- a/app/extensions/extensions.php +++ b/app/extensions/extensions.php @@ -147,7 +147,66 @@ $offset = $rows_per_page * $page; //get the extensions - $sql = "select e.*, "; + $sql = "select "; + $sql .= "e.extension_uuid, "; + $sql .= "e.domain_uuid, "; + $sql .= "e.extension, "; + $sql .= "e.number_alias, "; + $sql .= "e.password, "; + $sql .= "e.accountcode, "; + $sql .= "e.effective_caller_id_name, "; + $sql .= "e.effective_caller_id_number, "; + $sql .= "e.outbound_caller_id_name, "; + $sql .= "e.outbound_caller_id_number, "; + $sql .= "e.emergency_caller_id_name, "; + $sql .= "e.emergency_caller_id_number, "; + $sql .= "e.directory_first_name, "; + $sql .= "e.directory_last_name, "; + $sql .= "e.directory_visible, "; + $sql .= "e.directory_exten_visible, "; + $sql .= "e.limit_max, "; + $sql .= "e.limit_destination, "; + $sql .= "e.missed_call_app, "; + $sql .= "e.missed_call_data, "; + $sql .= "e.user_context, "; + $sql .= "e.toll_allow, "; + $sql .= "e.call_timeout, "; + $sql .= "e.call_group, "; + $sql .= "e.call_screen_enabled, "; + $sql .= "e.user_record, "; + $sql .= "e.hold_music, "; + $sql .= "e.auth_acl, "; + $sql .= "e.cidr, "; + $sql .= "e.sip_force_contact, "; + $sql .= "e.nibble_account, "; + $sql .= "e.sip_force_expires, "; + $sql .= "e.mwi_account, "; + $sql .= "e.sip_bypass_media, "; + $sql .= "e.unique_id, "; + $sql .= "e.dial_string, "; + $sql .= "e.dial_user, "; + $sql .= "e.dial_domain, "; + $sql .= "e.do_not_disturb, "; + $sql .= "e.forward_all_destination, "; + $sql .= "e.forward_all_enabled, "; + $sql .= "e.forward_busy_destination, "; + $sql .= "e.forward_busy_enabled, "; + $sql .= "e.forward_no_answer_destination, "; + $sql .= "e.forward_no_answer_enabled, "; + $sql .= "e.forward_user_not_registered_destination, "; + $sql .= "e.forward_user_not_registered_enabled, "; + $sql .= "e.follow_me_uuid, "; + $sql .= "e.follow_me_enabled, "; + $sql .= "e.follow_me_destinations, "; + $sql .= "cast(e.enabled as text), "; + $sql .= "e.description, "; + $sql .= "e.absolute_codec_string, "; + $sql .= "e.force_ping, "; + $sql .= "e.max_registrations, "; + $sql .= "e.extension_type, "; + $sql .= "e.extension_language, "; + $sql .= "e.extension_dialect, "; + $sql .= "e.extension_voice, "; $sql .= "( "; $sql .= " select device_uuid "; $sql .= " from v_device_lines "; @@ -202,7 +261,6 @@ $sql .= " or lower(call_group) like :search "; } $sql .= " or lower(user_context) like :search "; - $sql .= " or lower(enabled) like :search "; $sql .= " or lower(description) like :search "; $sql .= ") "; $parameters['search'] = '%'.$search.'%'; diff --git a/app/fax/app_config.php b/app/fax/app_config.php index b31fe4a5d8..9128dc849e 100644 --- a/app/fax/app_config.php +++ b/app/fax/app_config.php @@ -598,7 +598,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enable SSL or TLS encryption."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "fax_email_connection_validate"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Validate certificate or not."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "fax_email_connection_username"; diff --git a/app/fax/fax_advanced.php b/app/fax/fax_advanced.php index 6c92be287e..ac8b2aef45 100644 --- a/app/fax/fax_advanced.php +++ b/app/fax/fax_advanced.php @@ -287,10 +287,21 @@ echo " ".$text['label-email_connection_validate']."\n"; echo "
\n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } +// echo " \n"; echo "
\n"; echo " ".$text['description-email_connection_validate']."\n"; echo "
\n"; echo " $member_contact\n"; echo " \n"; + echo " \n"; echo " \n"; echo " \n"; //echo " \n"; //echo " \n"; + echo " \n"; echo " \n"; echo " \n"; - if (substr($input_toggle_style, 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo " \n"; + if (!empty($row['member_contact'])) { + echo " \n"; echo " \n"; echo " \n"; - if (substr($input_toggle_style, 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-fifo_enabled']."\n"; @@ -815,4 +810,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/follow_me/app_config.php b/app/follow_me/app_config.php index b059ae94f2..decd2d43a6 100644 --- a/app/follow_me/app_config.php +++ b/app/follow_me/app_config.php @@ -149,11 +149,11 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "follow_me_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "follow_me_ignore_busy"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date"; diff --git a/app/gateways/app_config.php b/app/gateways/app_config.php index b17ffc9b79..43fadf19f7 100644 --- a/app/gateways/app_config.php +++ b/app/gateways/app_config.php @@ -37,7 +37,7 @@ $apps[$x]['destinations'][$y]['name'] = "gateways"; $apps[$x]['destinations'][$y]['sql'] = "select g.gateway_uuid as destination, g.gateway as name, d.domain_name from v_gateways as g "; $apps[$x]['destinations'][$y]['sql'] .= "inner join v_domains as d on g.domain_uuid = d.domain_uuid "; - $apps[$x]['destinations'][$y]['where'] = "where g.domain_uuid = '\${domain_uuid}' and g.enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where g.domain_uuid = '\${domain_uuid}' and g.enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "gateway asc"; $apps[$x]['destinations'][$y]['field']['name'] = "gateway"; $apps[$x]['destinations'][$y]['field']['destination'] = "gateway_uuid"; @@ -129,7 +129,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "distinct_to"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "auth_username"; @@ -171,7 +171,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "register"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "register_transport"; @@ -203,15 +203,15 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_in_ping"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "caller_id_in_from"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "supress_cng"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_cid_type"; @@ -244,7 +244,7 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(255)"; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "description"; diff --git a/app/gateways/gateway_copy.php b/app/gateways/gateway_copy.php index 5bbe51f507..e41f4e8325 100644 --- a/app/gateways/gateway_copy.php +++ b/app/gateways/gateway_copy.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-2018 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -65,16 +65,19 @@ $register_proxy = $row["register_proxy"]; $outbound_proxy = $row["outbound_proxy"]; $expire_seconds = $row["expire_seconds"]; - $register = $row["register"]; + $register = $row["register"] ?? false; $register_transport = $row["register_transport"]; $contact_params = $row["contact_params"]; $retry_seconds = $row["retry_seconds"]; $extension = $row["extension"]; $codec_prefs = $row["codec_prefs"]; $ping = $row["ping"]; - $channels = $row["channels"]; - $caller_id_in_from = $row["caller_id_in_from"]; - $supress_cng = $row["supress_cng"]; + $ping_min = $row["ping_min"]; + $ping_max = $row["ping_max"]; + $contact_in_ping = $row["contact_in_ping"] ?? false; + // $channels = $row["channels"]; + $caller_id_in_from = $row["caller_id_in_from"] ?? false; + $supress_cng = $row["supress_cng"] ?? false; $sip_cid_type = $row["sip_cid_type"]; $extension_in_contact = $row["extension_in_contact"]; $effective_caller_id_name = $row["effective_caller_id_name"]; @@ -83,7 +86,7 @@ $outbound_caller_id_number = $row["outbound_caller_id_number"]; $context = $row["context"]; $profile = $row["profile"]; - $enabled = $row["enabled"]; + $enabled = $row["enabled"] ?? false; $description = $row["description"]." (".$text['label-copy'].")"; } unset($sql, $parameters, $row); @@ -118,6 +121,9 @@ $array['gateways'][0]['extension'] = $extension; $array['gateways'][0]['codec_prefs'] = $codec_prefs; $array['gateways'][0]['ping'] = $ping; + $array['gateways'][0]['ping_min'] = $ping_min; + $array['gateways'][0]['ping_max'] = $ping_max; + $array['gateways'][0]['contact_in_ping'] = $contact_in_ping; //$array['gateways'][0]['channels'] = $channels; $array['gateways'][0]['caller_id_in_from'] = $caller_id_in_from; $array['gateways'][0]['supress_cng'] = $supress_cng; @@ -135,7 +141,7 @@ unset($array); //add new gateway to session variable - if ($enabled == 'true') { + if ($enabled == true) { $_SESSION['gateways'][$gateway_uuid] = $gateway; } @@ -156,4 +162,4 @@ header("Location: gateways.php"); return; -?> +?> \ No newline at end of file diff --git a/app/gateways/gateway_edit.php b/app/gateways/gateway_edit.php index 8b5be5216c..886a08b951 100644 --- a/app/gateways/gateway_edit.php +++ b/app/gateways/gateway_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-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -88,7 +88,7 @@ $register_proxy = $_POST["register_proxy"]; $outbound_proxy = $_POST["outbound_proxy"]; $expire_seconds = $_POST["expire_seconds"]; - $register = $_POST["register"] ?? 'false'; + $register = $_POST["register"]; $register_transport = $_POST["register_transport"]; $contact_params = $_POST["contact_params"]; $retry_seconds = $_POST["retry_seconds"]; @@ -106,7 +106,7 @@ $context = $_POST["context"]; $profile = $_POST["profile"]; $hostname = $_POST["hostname"]; - $enabled = $_POST["enabled"] ?? 'false'; + $enabled = $_POST["enabled"]; $description = $_POST["description"]; } @@ -129,7 +129,7 @@ //check for all required data $msg = ''; if (empty($gateway)) { $msg .= $text['message-required']." ".$text['label-gateway']."
\n"; } - if ($register == "true") { + if ($register == 'true') { if (empty($username)) { $msg .= $text['message-required']." ".$text['label-username']."
\n"; } if (empty($password)) { $msg .= $text['message-required']." ".$text['label-password']."
\n"; } } @@ -198,7 +198,7 @@ $array['gateways'][$x]["description"] = $description; //update gateway session variable - if ($enabled == 'true') { + if ($enabled) { $_SESSION['gateways'][$gateway_uuid] = $gateway; } else { @@ -216,7 +216,7 @@ $message = $database->message; //remove xml file (if any) if not enabled - if ($enabled != 'true' && !empty($_SESSION['switch']['sip_profiles']['dir'])) { + if ($enabled != true && !empty($_SESSION['switch']['sip_profiles']['dir'])) { $gateway_xml_file = $_SESSION['switch']['sip_profiles']['dir']."/".$profile."/v_".$gateway_uuid.".xml"; if (file_exists($gateway_xml_file)) { unlink($gateway_xml_file); @@ -285,10 +285,10 @@ $ping = $row["ping"]; $ping_min = $row["ping_min"]; $ping_max = $row["ping_max"]; - $contact_in_ping = $row["contact_in_ping"]; + $contact_in_ping = $row["contact_in_ping"] ?? false; $channels = $row["channels"]; - $caller_id_in_from = $row["caller_id_in_from"]; - $supress_cng = $row["supress_cng"]; + $caller_id_in_from = $row["caller_id_in_from"] ?? false; + $supress_cng = $row["supress_cng"] ?? false; $sip_cid_type = $row["sip_cid_type"]; $codec_prefs = $row["codec_prefs"]; $extension_in_contact = $row["extension_in_contact"]; @@ -303,7 +303,7 @@ //get the sip profiles $sql = "select sip_profile_name from v_sip_profiles "; - $sql .= "where sip_profile_enabled = 'true' "; + $sql .= "where sip_profile_enabled = true "; $sql .= "order by sip_profile_name asc "; $database = new database; $sip_profiles = $database->select($sql, null, 'all'); @@ -311,13 +311,10 @@ //set defaults if (empty($gateway_uuid)) { $gateway_uuid = ""; } - if (empty($enabled)) { $enabled = "true"; } - if (empty($register)) { $register = "true"; } if (empty($retry_seconds)) { $retry_seconds = "30"; } if (empty($gateway)) { $gateway = ''; } if (empty($username)) { $username = ''; } if (empty($password)) { $password = ''; } - if (empty($distinct_to)) { $distinct_to = ''; } if (empty($auth_username)) { $auth_username = ''; } if (empty($realm)) { $realm = ''; } if (empty($from_user)) { $from_user = ''; } @@ -333,17 +330,13 @@ if (empty($ping)) { $ping = ''; } if (empty($ping_min)) { $ping_min = ''; } if (empty($ping_max)) { $ping_max = ''; } - if (empty($contact_in_ping)) { $contact_in_ping = ''; } if (empty($channels)) { $channels = ''; } - if (empty($caller_id_in_from)) { $caller_id_in_from = ''; } - if (empty($supress_cng)) { $supress_cng = ''; } if (empty($sip_cid_type)) { $sip_cid_type = ''; } if (empty($codec_prefs)) { $codec_prefs = ''; } if (empty($extension_in_contact)) { $extension_in_contact = ''; } if (empty($context)) { $context = ''; } if (empty($profile)) { $profile = ''; } if (empty($hostname)) { $hostname = ''; } - if (empty($enabled)) { $enabled = 'true'; } if (empty($description)) { $description = ''; } //create token @@ -489,17 +482,16 @@ echo " ".$text['label-register']."\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-register']."\n"; @@ -540,21 +532,17 @@ echo " ".$text['label-distinct_to']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($distinct_to == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo $text['description-distinct_to']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "
\n"; echo $text['description-caller_id_in_from']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($supress_cng == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo $text['description-supress_cng']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($contact_in_ping == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo $text['description-contact_in_ping']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; @@ -948,4 +923,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index 92aab42e34..4d723ae9d6 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.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): @@ -141,7 +141,6 @@ $sql .= ") "; $parameters['search'] = '%'.$search.'%'; } - $database = new database; $total_gateways = $database->select($sql, $parameters ?? '', 'column'); $num_rows = $total_gateways; @@ -155,7 +154,20 @@ $offset = $rows_per_page * $page; //get the list - $sql = "select * "; + $sql = "select "; + $sql .= "gateway_uuid, domain_uuid, gateway, username, password, "; + $sql .= "cast(distinct_to as text), auth_username, realm, from_user, from_domain, "; + $sql .= "proxy, register_proxy,outbound_proxy,expire_seconds, "; + $sql .= "cast(register as text), register_transport, contact_params, retry_seconds, "; + $sql .= "extension, ping, ping_min, ping_max, "; + $sql .= "cast(contact_in_ping as text) , "; + $sql .= "cast(caller_id_in_from as text), "; + $sql .= "cast(supress_cng as text), "; + $sql .= "sip_cid_type, codec_prefs, channels, "; + $sql .= "cast(extension_in_contact as text), "; + $sql .= "context, profile, hostname, "; + $sql .= "cast(enabled as text), "; + $sql .= "description "; $sql .= "from v_gateways "; $sql .= "where true "; if (!($show == "all" && permission_exists('gateway_all'))) { @@ -179,7 +191,6 @@ } $sql .= order_by($order_by, $order, 'gateway', 'asc'); $sql .= limit_offset($rows_per_page, $offset); - $database = new database; $gateways = $database->select($sql, $parameters ?? '', 'all'); unset($sql, $parameters); @@ -395,4 +406,3 @@ require_once "resources/footer.php"; ?> - diff --git a/app/ivr_menus/app_config.php b/app/ivr_menus/app_config.php index b5f39a8d4e..e148789164 100644 --- a/app/ivr_menus/app_config.php +++ b/app/ivr_menus/app_config.php @@ -35,7 +35,7 @@ $apps[$x]['destinations'][$y]['type'] = "sql"; $apps[$x]['destinations'][$y]['label'] = "ivr_menus"; $apps[$x]['destinations'][$y]['name'] = "ivr_menus"; - $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and ivr_menu_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and ivr_menu_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "natural_sort(ivr_menu_extension) asc"; $apps[$x]['destinations'][$y]['field']['ivr_menu_uuid'] = "ivr_menu_uuid"; $apps[$x]['destinations'][$y]['field']['uuid'] = "ivr_menu_uuid"; @@ -52,7 +52,7 @@ $apps[$x]['destinations'][$y]['label'] = "ivr_menus_sub"; $apps[$x]['destinations'][$y]['name'] = "ivr_menus_sub"; $apps[$x]['destinations'][$y]['sql'] = "select ivr_menu_name as name, ivr_menu_uuid as uuid from v_ivr_menus "; - $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and ivr_menu_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and ivr_menu_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "natural_sort(ivr_menu_extension) asc"; $apps[$x]['destinations'][$y]['field']['name'] = "ivr_menu_name"; $apps[$x]['destinations'][$y]['field']['uuid'] = "ivr_menu_uuid"; @@ -370,7 +370,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ivr_menu_direct_dial"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ivr_menu_ringback"; @@ -386,7 +386,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ivr_menu_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "ivr_menu_description"; @@ -484,9 +484,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ivr_menu_option_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "boolean"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['toggle'] = ['true','false']; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; diff --git a/app/ivr_menus/ivr_menu_copy.php b/app/ivr_menus/ivr_menu_copy.php deleted file mode 100644 index 830a9c577c..0000000000 --- a/app/ivr_menus/ivr_menu_copy.php +++ /dev/null @@ -1,183 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2019 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -//includes files - require_once dirname(__DIR__, 2) . "/resources/require.php"; - require_once "resources/check_auth.php"; - require_once "resources/paging.php"; - -//check permissions - if (permission_exists('ivr_menu_edit')) { - //access granted - } - else { - echo "access denied"; - exit; - } - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//set the http get/post variable(s) to a php variable - $ivr_menu_uuid = $_GET["id"]; - - if (is_uuid($ivr_menu_uuid)) { - - //get the ivr_menus data - $sql = "select * from v_ivr_menus "; - $sql .= "where ivr_menu_uuid = :ivr_menu_uuid "; - $sql .= "and domain_uuid = :domain_uuid "; - $parameters['ivr_menu_uuid'] = $ivr_menu_uuid; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $database = new database; - $ivr_menus = $database->select($sql, $parameters, 'all'); - if (!is_array($ivr_menus)) { - echo "access denied"; - exit; - } - unset($sql, $parameters); - - //get the the ivr menu options - $sql = "select * from v_ivr_menu_options "; - $sql .= "where ivr_menu_uuid = :ivr_menu_uuid "; - $sql .= "and domain_uuid = :domain_uuid "; - $sql .= "order by ivr_menu_uuid asc "; - $parameters['ivr_menu_uuid'] = $ivr_menu_uuid; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $database = new database; - $ivr_menu_options = $database->select($sql, $parameters, 'all'); - unset($sql, $parameters); - - //create the uuids - $ivr_menu_uuid = uuid(); - $dialplan_uuid = uuid(); - - //set the row id - $x = 0; - - //set the variables - $ivr_menu_name = $ivr_menus[$x]['ivr_menu_name']; - $ivr_menu_extension = $ivr_menus[$x]['ivr_menu_extension']; - $ivr_menu_ringback = $ivr_menus[$x]['ivr_menu_ringback']; - $ivr_menu_language = $ivr_menus[$x]['ivr_menu_language']; - $ivr_menu_dialect = $ivr_menus[$x]['ivr_menu_dialect']; - $ivr_menu_voice = $ivr_menus[$x]['ivr_menu_voice']; - $ivr_menu_cid_prefix = $ivr_menus[$x]['ivr_menu_cid_prefix']; - $ivr_menu_context = $ivr_menus[$x]['ivr_menu_context']; - $ivr_menu_description = $ivr_menus[$x]['ivr_menu_description'].' ('.$text['label-copy'].')'; - - //prepare the ivr menu array - $ivr_menus[$x]['ivr_menu_uuid'] = $ivr_menu_uuid; - $ivr_menus[$x]['dialplan_uuid'] = $dialplan_uuid; - $ivr_menus[$x]['ivr_menu_name'] = $ivr_menu_name; - $ivr_menus[$x]['ivr_menu_description'] = $ivr_menu_description; - - //get the the ivr menu options - $y = 0; - foreach ($ivr_menu_options as $row) { - //update the uuids - $row['ivr_menu_uuid'] = $ivr_menu_uuid; - $row['ivr_menu_option_uuid'] = uuid(); - //add the row to the array - $ivr_menus[$x]["ivr_menu_options"][$y] = $row; - //increment the ivr menu option row id - $y++; - } - - //build the xml dialplan - $dialplan_xml = "\n"; - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - if (!empty($ivr_menu_language)) { - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - } - $dialplan_xml .= " \n"; - if (!empty($ivr_menu_cid_prefix)) { - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - } - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - $dialplan_xml .= " \n"; - $dialplan_xml .= "\n"; - - //build the dialplan array - $dialplan[$x]["domain_uuid"] = $_SESSION['domain_uuid']; - $dialplan[$x]["dialplan_uuid"] = $dialplan_uuid; - $dialplan[$x]["dialplan_name"] = $ivr_menu_name; - $dialplan[$x]["dialplan_number"] = $ivr_menu_extension; - $dialplan[$x]["dialplan_context"] = $ivr_menu_context; - $dialplan[$x]["dialplan_continue"] = "false"; - $dialplan[$x]["dialplan_xml"] = $dialplan_xml; - $dialplan[$x]["dialplan_order"] = "101"; - $dialplan[$x]["dialplan_enabled"] = "true"; - $dialplan[$x]["dialplan_description"] = $ivr_menu_description; - $dialplan[$x]["app_uuid"] = "a5788e9b-58bc-bd1b-df59-fff5d51253ab"; - - //prepare the array - $array['ivr_menus'] = $ivr_menus; - $array['dialplans'] = $dialplan; - - //add the dialplan permission - $p = permissions::new(); - $p->add("dialplan_add", "temp"); - $p->add("dialplan_edit", "temp"); - - //save the array to the database - $database = new database; - $database->app_name = 'ivr_menus'; - $database->app_uuid = 'a5788e9b-58bc-bd1b-df59-fff5d51253ab'; - if (is_uuid($ivr_menu_uuid)) { - $database->uuid($ivr_menu_uuid); - } - $database->save($array); - $message = $database->message; - - //remove the temporary permission - $p->delete("dialplan_add", "temp"); - $p->delete("dialplan_edit", "temp"); - - //clear the cache - $cache = new cache; - $cache->delete("dialplan:".$ivr_menu_context); - - //set message - message::add($text['message-copy']); - } - -//redirect the user - header("Location: ivr_menus.php"); - -?> diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index 8c31f230d1..69ecfa0f28 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -142,10 +142,10 @@ $ivr_menu_max_failures = $_POST["ivr_menu_max_failures"]; $ivr_menu_max_timeouts = $_POST["ivr_menu_max_timeouts"]; $ivr_menu_digit_len = $_POST["ivr_menu_digit_len"]; - $ivr_menu_direct_dial = $_POST["ivr_menu_direct_dial"] ?? 'false'; + $ivr_menu_direct_dial = $_POST["ivr_menu_direct_dial"]; $ivr_menu_ringback = $_POST["ivr_menu_ringback"]; $ivr_menu_cid_prefix = $_POST["ivr_menu_cid_prefix"]; - $ivr_menu_enabled = $_POST["ivr_menu_enabled"] ?? 'false'; + $ivr_menu_enabled = $_POST["ivr_menu_enabled"]; $ivr_menu_description = $_POST["ivr_menu_description"]; $ivr_menu_options_delete = $_POST["ivr_menu_options_delete"] ?? null; $dialplan_uuid = $_POST["dialplan_uuid"] ?? null; @@ -228,7 +228,7 @@ if (empty($ivr_menu_max_failures)) { $msg .= $text['message-required'].$text['label-max_failures']."
\n"; } if (empty($ivr_menu_max_timeouts)) { $msg .= $text['message-required'].$text['label-max_timeouts']."
\n"; } if (empty($ivr_menu_digit_len)) { $msg .= $text['message-required'].$text['label-digit_length']."
\n"; } - if (empty($ivr_menu_direct_dial)) { $msg .= $text['message-required'].$text['label-direct_dial']."
\n"; } + //if (empty($ivr_menu_direct_dial)) { $msg .= $text['message-required'].$text['label-direct_dial']."
\n"; } //if (empty($ivr_menu_ringback)) { $msg .= $text['message-required'].$text['label-ring_back']."
\n"; } //if (empty($ivr_menu_description)) { $msg .= $text['message-required'].$text['label-description']."
\n"; } @@ -343,7 +343,7 @@ } $array['ivr_menus'][0]['ivr_menu_options'][$y]["ivr_menu_option_order"] = $row["ivr_menu_option_order"]; $array['ivr_menus'][0]['ivr_menu_options'][$y]["ivr_menu_option_description"] = $row["ivr_menu_option_description"]; - $array['ivr_menus'][0]["ivr_menu_options"][$y]["ivr_menu_option_enabled"] = !empty($row['ivr_menu_option_enabled']) ?? 'false'; + $array['ivr_menus'][0]["ivr_menu_options"][$y]["ivr_menu_option_enabled"] = $row['ivr_menu_option_enabled']; $y++; } } @@ -396,7 +396,7 @@ if (isset($ivr_menu_context)) { $array['dialplans'][0]["dialplan_context"] = $ivr_menu_context; } - $array['dialplans'][0]["dialplan_continue"] = "false"; + $array['dialplans'][0]["dialplan_continue"] = 'false'; $array['dialplans'][0]["dialplan_xml"] = $dialplan_xml; $array['dialplans'][0]["dialplan_order"] = "101"; $array['dialplans'][0]["dialplan_enabled"] = $ivr_menu_enabled; @@ -416,7 +416,7 @@ $database->app_name = 'ivr_menus'; $database->app_uuid = 'a5788e9b-58bc-bd1b-df59-fff5d51253ab'; $database->save($array); - //$message = $database->message; + $message = $database->message; //remove the temporary permission $p->delete("dialplan_add", "temp"); @@ -443,12 +443,12 @@ $sql .=" select ivr_menu_parent_uuid "; $sql .=" from v_ivr_menus "; $sql .=" where ivr_menu_parent_uuid = :ivr_menu_parent_uuid "; - $sql .=" and ivr_menu_enabled = 'true' "; + $sql .=" and ivr_menu_enabled = true "; $sql .=" union all "; $sql .=" select parent.ivr_menu_parent_uuid "; $sql .=" from v_ivr_menus as parent, ivr_menus as child "; $sql .=" where parent.ivr_menu_uuid = child.ivr_menu_parent_uuid "; - $sql .=" and parent.ivr_menu_enabled = 'true' "; + $sql .=" and parent.ivr_menu_enabled = true "; $sql .=" ) "; $sql .=" select * from ivr_menus "; $parameters['ivr_menu_parent_uuid'] = $ivr_menu_parent_uuid; @@ -568,7 +568,7 @@ $ivr_menu_options[$id]['ivr_menu_option_param'] = ''; $ivr_menu_options[$id]['ivr_menu_option_order'] = ''; $ivr_menu_options[$id]['ivr_menu_option_description'] = ''; - $ivr_menu_options[$id]['ivr_menu_option_enabled'] = ''; + $ivr_menu_options[$id]['ivr_menu_option_enabled'] = false; $id++; } @@ -612,9 +612,7 @@ } } if (empty($ivr_menu_digit_len)) { $ivr_menu_digit_len = '5'; } - if (empty($ivr_menu_direct_dial)) { $ivr_menu_direct_dial = 'false'; } if (!isset($ivr_menu_context)) { $ivr_menu_context = $_SESSION['domain_name']; } - if (empty($ivr_menu_enabled)) { $ivr_menu_enabled = 'true'; } if (!isset($ivr_menu_exit_action)) { $ivr_menu_exit_action = ''; } //get installed languages @@ -1055,12 +1053,8 @@ if (strlen($field['ivr_menu_option_order']) == 2) { $field['ivr_menu_option_order'] = "0".$field['ivr_menu_option_order']; } echo " \n"; } - $i=0; - while($i<=999) { - if (strlen($i) == 1) { echo " \n"; } - if (strlen($i) == 2) { echo " \n"; } - if (strlen($i) == 3) { echo " \n"; } - $i++; + for ($i = 0; $i <= 999; $i++) { + echo " \n"; } echo " \n"; echo "
\n"; - // switch - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - // select - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-direct_dial']."\n"; @@ -1537,17 +1527,16 @@ echo " ".$text['label-enabled']."\n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; diff --git a/app/ivr_menus/ivr_menus.php b/app/ivr_menus/ivr_menus.php index ece74b954b..7443ea133f 100644 --- a/app/ivr_menus/ivr_menus.php +++ b/app/ivr_menus/ivr_menus.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): @@ -110,7 +110,6 @@ $sql .= "and ("; $sql .= " lower(ivr_menu_name) like :search "; $sql .= " or lower(ivr_menu_extension) like :search "; - $sql .= " or lower(ivr_menu_enabled) like :search "; $sql .= " or lower(ivr_menu_description) like :search "; $sql .= ")"; $parameters['search'] = '%'.$search.'%'; @@ -129,7 +128,14 @@ $offset = $rows_per_page * $page; //get the list - $sql = "select * from v_ivr_menus "; + $sql = "select "; + $sql .= "ivr_menu_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "ivr_menu_name, "; + $sql .= "ivr_menu_extension, "; + $sql .= "cast(ivr_menu_enabled as text), "; + $sql .= "ivr_menu_description "; + $sql .= "from v_ivr_menus "; if ($show == "all" && permission_exists('ivr_menu_all')) { $sql .= "where true "; } @@ -142,7 +148,6 @@ $sql .= "and ("; $sql .= " lower(ivr_menu_name) like :search "; $sql .= " or lower(ivr_menu_extension) like :search "; - $sql .= " or lower(ivr_menu_enabled) like :search "; $sql .= " or lower(ivr_menu_description) like :search "; $sql .= ")"; $parameters['search'] = '%'.$search.'%'; diff --git a/app/ivr_menus/resources/functions/ivr_menu_xml.php b/app/ivr_menus/resources/functions/ivr_menu_xml.php index e680dac2fc..67eeef7feb 100644 --- a/app/ivr_menus/resources/functions/ivr_menu_xml.php +++ b/app/ivr_menus/resources/functions/ivr_menu_xml.php @@ -159,7 +159,7 @@ } unset($sub_sql, $sub_result, $sub_row); - if ($ivr_menu_direct_dial == "true") { + if ($ivr_menu_direct_dial == true) { $tmp .= " \n"; } $tmp .= " \n"; diff --git a/app/modules/app_config.php b/app/modules/app_config.php index 835cb0d675..11ac8d9dd0 100644 --- a/app/modules/app_config.php +++ b/app/modules/app_config.php @@ -79,12 +79,12 @@ $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "module_enabled"; $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "moduleenabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "module_default_enabled"; $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "moduledefaultenabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "module_description"; diff --git a/app/modules/module_edit.php b/app/modules/module_edit.php index e81cfe78a7..b4accadac7 100644 --- a/app/modules/module_edit.php +++ b/app/modules/module_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-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -48,8 +48,6 @@ $module_description = ''; $module_category = ''; $module_order = ''; - $module_enabled = ''; - $module_default_enabled = ''; //determin the action add or update if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { @@ -67,8 +65,8 @@ $module_description = $_POST["module_description"]; $module_category = $_POST["module_category"]; $module_order = $_POST["module_order"]; - $module_enabled = $_POST["module_enabled"] ?? 'false'; - $module_default_enabled = $_POST["module_default_enabled"] ?? 'false'; + $module_enabled = $_POST["module_enabled"]; + $module_default_enabled = $_POST["module_default_enabled"]; } //process the data @@ -93,8 +91,8 @@ if (empty($module_name)) { $msg .= $text['message-required'].$text['label-module_name']."
\n"; } //if (empty($module_description)) { $msg .= $text['message-required'].$text['label-description']."
\n"; } if (empty($module_category)) { $msg .= $text['message-required'].$text['label-module_category']."
\n"; } - if (empty($module_enabled)) { $msg .= $text['message-required'].$text['label-enabled']."
\n"; } - if (empty($module_default_enabled)) { $msg .= $text['message-required'].$text['label-default_enabled']."
\n"; } + // if (empty($module_enabled)) { $msg .= $text['message-required'].$text['label-enabled']."
\n"; } + // if (empty($module_default_enabled)) { $msg .= $text['message-required'].$text['label-default_enabled']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; @@ -169,10 +167,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($module_enabled)) { $module_enabled = 'true'; } - if (empty($module_default_enabled)) { $module_default_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -253,17 +247,16 @@ echo " ".$text['label-enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; - echo $row['module_enabled'] == 'true' ? "".$text['label-stopped']."" : $text['label-stopped']." ".escape($notice ?? null); + echo $row['module_enabled'] === true ? "".$text['label-stopped']."" : $text['label-stopped']." ".escape($notice ?? null); echo " "; - echo $text['label-'.$row['module_enabled']]; + echo $text['label-'.($row['module_enabled'] ? 'true' : 'false')]; } echo " ".escape($row["module_description"])." \n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-number_translation_enabled']."\n"; @@ -376,4 +375,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/phrases/app_config.php b/app/phrases/app_config.php index ae67766df2..a782723afa 100644 --- a/app/phrases/app_config.php +++ b/app/phrases/app_config.php @@ -35,7 +35,7 @@ $apps[$x]['destinations'][$y]['type'] = "sql"; $apps[$x]['destinations'][$y]['label'] = "phrases"; $apps[$x]['destinations'][$y]['name'] = "phrases"; - $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and phrase_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and phrase_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "phrase_name asc"; $apps[$x]['destinations'][$y]['field']['uuid'] = "phrase_uuid"; $apps[$x]['destinations'][$y]['field']['name'] = "phrase_name"; @@ -115,7 +115,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_description"; diff --git a/app/phrases/phrase_edit.php b/app/phrases/phrase_edit.php index adf7ca468e..371267c3fd 100644 --- a/app/phrases/phrase_edit.php +++ b/app/phrases/phrase_edit.php @@ -81,7 +81,7 @@ } $phrase_name = $_POST["phrase_name"]; $phrase_language = $_POST["phrase_language"]; - $phrase_enabled = $_POST["phrase_enabled"] ?? 'false'; + $phrase_enabled = $_POST["phrase_enabled"]; $phrase_description = $_POST["phrase_description"]; $phrase_details_delete = $_POST["phrase_details_delete"] ?? ''; @@ -92,7 +92,7 @@ //process the changes from the http post if (count($_POST) > 0 && empty($_POST["persistformvar"])) { - + //get the uuid if ($action == "update") { $phrase_uuid = $_POST["phrase_uuid"]; @@ -163,7 +163,6 @@ $p = permissions::new(); $p->add('phrase_detail_add', 'temp'); - $database = new database; $database->app_name = 'phrases'; $database->app_uuid = '5c6f597c-9b78-11e4-89d3-123b93f75cba'; $database->save($array); @@ -227,7 +226,6 @@ $p = permissions::new(); $p->add('phrase_detail_add', 'temp'); - $database = new database; $database->app_name = 'phrases'; $database->app_uuid = '5c6f597c-9b78-11e4-89d3-123b93f75cba'; $database->save($array); @@ -262,7 +260,7 @@ } } - + } //pre-populate the form @@ -276,7 +274,6 @@ $sql .= "and phrase_uuid = :phrase_uuid "; $parameters['domain_uuid'] = $domain_uuid; $parameters['phrase_uuid'] = $phrase_uuid; - $database = new database; $row = $database->select($sql, $parameters, 'row'); if (is_array($row) && @sizeof($row) != 0) { $phrase_name = $row["phrase_name"]; @@ -287,9 +284,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($phrase_enabled)) { $phrase_enabled = 'true'; } - //get the phrase details if (!empty($phrase_uuid)) { $sql = "select * from v_phrase_details "; @@ -298,7 +292,6 @@ $sql .= "order by phrase_detail_order asc "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['phrase_uuid'] = $phrase_uuid; - $database = new database; $phrase_details = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); } @@ -308,7 +301,6 @@ $sql .= "where domain_uuid = :domain_uuid "; $sql .= "order by recording_name asc "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $database = new database; $recordings = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -611,17 +603,16 @@ echo " ".$text['label-enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 14bba55ed3..1386df7cd4 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -337,7 +337,7 @@ if (is_array($row) && sizeof($row) != 0) { //checks either device enabled - if ($row['device_enabled'] != 'true') { + if ($row['device_enabled'] === false) { syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] provision attempted but the device is not enabled for ".escape($device_address)); if ($this->settings->get('provision','debug', false)) { echo "
device disabled
"; @@ -384,7 +384,7 @@ if (empty($device_template)) { $sql = "select * from v_devices "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and device_enabled = 'true' "; + $sql .= "and device_enabled = true "; $sql .= "limit 1 "; $parameters['domain_uuid'] = $domain_uuid; $row = $this->database->select($sql, $parameters, 'row'); @@ -544,7 +544,7 @@ $array['devices'][$x]['device_uuid'] = $device_uuid; $array['devices'][$x]['device_address'] = $device_address; $array['devices'][$x]['device_vendor'] = $device_vendor; - $array['devices'][$x]['device_enabled'] = 'true'; + $array['devices'][$x]['device_enabled'] = true; $array['devices'][$x]['device_template'] = $device_template; $array['devices'][$x]['device_description'] = $_SERVER['HTTP_USER_AGENT']; @@ -573,7 +573,7 @@ if (is_uuid($device_uuid)) { $sql = "select * from v_devices "; $sql .= "where device_uuid = :device_uuid "; - $sql .= "and device_enabled = 'true' "; + $sql .= "and device_enabled = true "; $parameters['device_uuid'] = $device_uuid; $row = $this->database->select($sql, $parameters, 'row'); if (is_array($row) && sizeof($row) != 0) { @@ -589,7 +589,7 @@ $parameters['device_uuid'] = $device_uuid; $row = $this->database->select($sql, $parameters, 'row'); if (is_array($row) && sizeof($row) != 0) { - if ($row["device_enabled"] == "true") { + if ($row["device_enabled"]) { $device_label = $row["device_label"]; //if the device vendor match then use the alternate device template @@ -614,7 +614,7 @@ if (is_uuid($device_uuid) && is_uuid($device_profile_uuid)) { $sql = "select * from v_device_profile_settings "; $sql .= "where device_profile_uuid = :device_profile_uuid "; - $sql .= "and profile_setting_enabled = 'true' "; + $sql .= "and profile_setting_enabled = true "; $parameters['device_profile_uuid'] = $device_profile_uuid; $device_profile_settings = $this->database->select($sql, $parameters, 'all'); if (is_array($device_profile_settings) && sizeof($device_profile_settings) != 0) { @@ -631,7 +631,7 @@ if (is_uuid($device_uuid)) { $sql = "select * from v_device_settings "; $sql .= "where device_uuid = :device_uuid "; - $sql .= "and device_setting_enabled = 'true' "; + $sql .= "and device_setting_enabled = true "; $parameters['device_uuid'] = $device_uuid; $device_settings = $this->database->select($sql, $parameters, 'all'); if (is_array($device_settings) && sizeof($device_settings) != 0) { @@ -685,7 +685,7 @@ //get the device lines array $sql = "select * from v_device_lines "; $sql .= "where device_uuid = :device_uuid "; - $sql .= "and (enabled = 'true' or enabled is null or enabled = '') "; + $sql .= "and (enabled = true or enabled is null) "; $parameters['device_uuid'] = $device_uuid; //$database_device_lines = $this->database->select($sql, $parameters, 'all'); foreach ($this->database->select($sql, $parameters, 'all') as $row) { @@ -925,7 +925,7 @@ $sql .= "number_alias, extension, call_group "; $sql .= "from v_extensions "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and enabled = 'true' "; + $sql .= "and enabled = true "; $sql .= "and directory_visible = 'true' "; $sql .= "order by directory_first_name, effective_caller_id_name asc "; $parameters['domain_uuid'] = $domain_uuid; @@ -1409,7 +1409,7 @@ //destination file path $dest_path = path_join($directory, $file_name); - if ($device_enabled == 'true') { + if ($device_enabled) { //output template to string for header processing $file_contents = $this->render(); diff --git a/app/provision/resources/functions/device_by.php b/app/provision/resources/functions/device_by.php index cccf2ec10a..5dca836297 100644 --- a/app/provision/resources/functions/device_by.php +++ b/app/provision/resources/functions/device_by.php @@ -3,7 +3,7 @@ function device_by_mac($device_address) { $sql = "select * from v_devices "; $sql .= "where device_address = :device_address "; - $sql .= "and device_enabled = 'true' "; + $sql .= "and device_enabled = true "; $parameters['device_address'] = $device_address; $database = new database; $row = $database->select($sql, $parameters, 'row'); @@ -17,8 +17,8 @@ function device_by_ext($ext, $domain) { $sql .= "inner join v_domains t3 on t2.domain_uuid = t3.domain_uuid "; $sql .= "where t2.user_id = :ext "; $sql .= "and t3.domain_name = :domain "; - $sql .= "and t3.domain_enabled = 'true' "; - $sql .= "and t1.device_enabled = 'true' "; + $sql .= "and t3.domain_enabled = true "; + $sql .= "and t1.device_enabled = true "; $parameters['ext'] = $ext; $parameters['domain'] = $domain; $database = new database; diff --git a/app/recordings/recording_edit.php b/app/recordings/recording_edit.php index 2926615778..9f6c1dd501 100644 --- a/app/recordings/recording_edit.php +++ b/app/recordings/recording_edit.php @@ -436,17 +436,16 @@ echo " ".$text['label-translate']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-translate']."\n"; @@ -471,17 +470,16 @@ echo " ".$text['label-create_recording']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-create_recording']."\n"; diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php index 2f8ecbae9b..d7ee2a62ea 100644 --- a/app/recordings/recordings.php +++ b/app/recordings/recordings.php @@ -396,11 +396,11 @@ d.domain_uuid = :domain_uuid and d.app_uuid = '430737df-5385-42d1-b933-22600d3fb79e' and d.dialplan_name = 'recordings' and - d.dialplan_enabled = 'true' and + d.dialplan_enabled = true and dd.dialplan_detail_tag = 'action' and dd.dialplan_detail_type = 'set' and dd.dialplan_detail_data like 'pin_number=%' and - dd.dialplan_detail_enabled = 'true' "; + dd.dialplan_detail_enabled = true "; $parameters['domain_uuid'] = $domain_uuid; $recording_password = $database->select($sql, $parameters, 'column'); unset($sql, $parameters); diff --git a/app/registrations/resources/classes/registrations.php b/app/registrations/resources/classes/registrations.php index 8c63d1d18d..f02a558698 100644 --- a/app/registrations/resources/classes/registrations.php +++ b/app/registrations/resources/classes/registrations.php @@ -124,12 +124,12 @@ //get the default settings $sql = "select sip_profile_name from v_sip_profiles "; - $sql .= "where sip_profile_enabled = 'true' "; + $sql .= "where true "; if (!empty($profile) && $profile != 'all') { $sql .= "and sip_profile_name = :sip_profile_name "; $parameters['sip_profile_name'] = $profile; } - $sql .= "and sip_profile_enabled = 'true' "; + $sql .= "and sip_profile_enabled = true "; $sip_profiles = $this->database->select($sql, $parameters ?? null, 'all'); if (!empty($sip_profiles)) { diff --git a/app/ring_groups/app_config.php b/app/ring_groups/app_config.php index 620ceb354e..51b429ee44 100644 --- a/app/ring_groups/app_config.php +++ b/app/ring_groups/app_config.php @@ -35,7 +35,7 @@ $apps[$x]['destinations'][$y]['type'] = "sql"; $apps[$x]['destinations'][$y]['label'] = "ring_groups"; $apps[$x]['destinations'][$y]['name'] = "ring_groups"; - $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and ring_group_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and ring_group_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "natural_sort(ring_group_extension) asc"; $apps[$x]['destinations'][$y]['field']['ring_group_uuid'] = "ring_group_uuid"; $apps[$x]['destinations'][$y]['field']['uuid'] = "ring_group_uuid"; @@ -293,7 +293,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the call forward destination."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_forward_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select enable or disable the ring group call forward."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_caller_id_name"; @@ -334,15 +334,15 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select the ringback."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_call_screen_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_call_forward_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Choose to follow a ring group destination's call forward."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_follow_me_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Choose to follow a ring group destination's follow me."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_missed_call_app"; @@ -358,7 +358,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the context."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select enable or disable the ring group."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_description"; diff --git a/app/ring_groups/resources/dashboard/ring_group_forward.php b/app/ring_groups/resources/dashboard/ring_group_forward.php index 6cd1c41315..22b67a8ad5 100644 --- a/app/ring_groups/resources/dashboard/ring_group_forward.php +++ b/app/ring_groups/resources/dashboard/ring_group_forward.php @@ -134,7 +134,7 @@ if (is_array($result) && @sizeof($result) != 0) { foreach ($result as $row) { - $stats['forwarding'] += $row['ring_group_forward_enabled'] == 'true' && $row['ring_group_forward_destination'] ? 1 : 0; + $stats['forwarding'] += $row['ring_group_forward_enabled'] == true && $row['ring_group_forward_destination'] ? 1 : 0; } $stats['active'] = @sizeof($result) - $stats['forwarding']; } @@ -257,29 +257,21 @@ if (permission_exists('ring_group_forward')) { echo "
"; - if ($row["ring_group_forward_enabled"] == 'true') { - echo $text['option-enabled']; - } - else { - echo $text['option-disabled']; - } + echo $row["ring_group_forward_enabled"] === true ? $text['option-enabled'] : $text['option-disabled']; } echo "
\n"; echo ""; - //$n++; if (permission_exists('ring_group_forward')) { echo "\n"; @@ -311,4 +302,4 @@ } echo "\n"; -?> +?> \ No newline at end of file diff --git a/app/ring_groups/ring_group_edit.php b/app/ring_groups/ring_group_edit.php index 08e3b2db5a..6886308153 100644 --- a/app/ring_groups/ring_group_edit.php +++ b/app/ring_groups/ring_group_edit.php @@ -200,10 +200,10 @@ $ring_group_follow_me_enabled = $_POST["ring_group_follow_me_enabled"]; $ring_group_missed_call_app = $_POST["ring_group_missed_call_app"]; $ring_group_missed_call_data = $_POST["ring_group_missed_call_data"]; - $ring_group_forward_enabled = $_POST["ring_group_forward_enabled"] ?? 'false'; + $ring_group_forward_enabled = !empty($_POST["ring_group_forward_destination"]) ? $_POST["ring_group_forward_enabled"] : 'false'; $ring_group_forward_destination = $_POST["ring_group_forward_destination"]; $ring_group_forward_toll_allow = $_POST["ring_group_forward_toll_allow"]; - $ring_group_enabled = $_POST["ring_group_enabled"] ?? 'false'; + $ring_group_enabled = $_POST["ring_group_enabled"]; $ring_group_description = $_POST["ring_group_description"]; $dialplan_uuid = $_POST["dialplan_uuid"] ?? null; //$ring_group_timeout_action = "transfer:1001 XML default"; @@ -453,7 +453,7 @@ $array['ring_groups'][0]["ring_group_destinations"][$y]["destination_delay"] = $row['destination_delay']; $array['ring_groups'][0]["ring_group_destinations"][$y]["destination_timeout"] = $row['destination_timeout']; $array['ring_groups'][0]["ring_group_destinations"][$y]["destination_prompt"] = $row['destination_prompt']; - $array['ring_groups'][0]["ring_group_destinations"][$y]["destination_enabled"] = $row['destination_enabled'] ?? 'false'; + $array['ring_groups'][0]["ring_group_destinations"][$y]["destination_enabled"] = $row['destination_enabled'] ?? false; $array['ring_groups'][0]["ring_group_destinations"][$y]["domain_uuid"] = $domain_uuid; $y++; } @@ -466,7 +466,7 @@ $array['ring_groups'][0]["ring_group_destinations"][$y]["destination_delay"] = $row['destination_delay']; $array['ring_groups'][0]["ring_group_destinations"][$y]["destination_timeout"] = $row['destination_timeout']; $array['ring_groups'][0]["ring_group_destinations"][$y]["destination_prompt"] = $row['destination_prompt']; - $array['ring_groups'][0]["ring_group_destinations"][$y]["destination_enabled"] = $row['destination_enabled'] ?? 'false'; + $array['ring_groups'][0]["ring_group_destinations"][$y]["destination_enabled"] = $row['destination_enabled']; $array['ring_groups'][0]["ring_group_destinations"][$y]["domain_uuid"] = $domain_uuid; } $y++; @@ -492,7 +492,7 @@ if (isset($ring_group_context)) { $array["dialplans"][0]["dialplan_context"] = $ring_group_context; } - $array["dialplans"][0]["dialplan_continue"] = "false"; + $array["dialplans"][0]["dialplan_continue"] = 'false'; $array["dialplans"][0]["dialplan_xml"] = $dialplan_xml; $array["dialplans"][0]["dialplan_order"] = "101"; $array["dialplans"][0]["dialplan_enabled"] = $ring_group_enabled; @@ -598,7 +598,6 @@ $destination_delay_max = $settings->get('ring_group', 'destination_delay_max', ''); $destination_timeout_max = $settings->get('ring_group', 'destination_timeout_max', '');; if (empty($ring_group_call_timeout)) { $ring_group_call_timeout = '30'; } - if (empty($ring_group_enabled)) { $ring_group_enabled = 'true'; } //get the ring group destination array if ($action == "add") { @@ -640,7 +639,7 @@ $sql = "select u.username, r.user_uuid, r.ring_group_uuid "; $sql .= "from v_ring_group_users as r, v_users as u "; $sql .= "where r.user_uuid = u.user_uuid "; - $sql .= "and u.user_enabled = 'true' "; + $sql .= "and u.user_enabled = true "; $sql .= "and r.domain_uuid = :domain_uuid "; $sql .= "and r.ring_group_uuid = :ring_group_uuid "; $sql .= "order by u.username asc "; @@ -653,15 +652,12 @@ //get the users $sql = "select * from v_users "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and user_enabled = 'true' "; + $sql .= "and user_enabled = true "; $sql .= "order by username asc "; $parameters['domain_uuid'] = $domain_uuid; $users = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); -//set defaults - if (empty($ring_group_enabled)) { $ring_group_enabled = 'true'; } - //set the default ring group context if (empty($ring_group_context)) { $ring_group_context = $domain_name; @@ -946,14 +942,7 @@ echo " \n"; echo " \n"; - if (!isset($row['ring_group_destination_uuid'])) { // new record - if (substr($settings->get('theme', 'input_toggle_style', ''), 0, 6) == 'switch') { - $onkeyup = "onkeyup=\"document.getElementById('ring_group_destinations_".$x."_destination_enabled').checked = (this.value != '' ? true : false);\""; // switch - } - else { - $onkeyup = "onkeyup=\"document.getElementById('ring_group_destinations_".$x."_destination_enabled').value = (this.value != '' ? true : false);\""; // select - } - } + $onkeyup = !isset($row['ring_group_destination_uuid']) ? "onkeyup=\"document.getElementById('ring_group_destinations_".$x."_destination_enabled').value = (this.value != '' ? true : false);\"" : null; // new record echo " \n"; echo " \n"; echo " \n"; @@ -998,19 +987,16 @@ echo " \n"; echo " \n"; echo " \n"; - // switch - if (substr($settings->get('theme', 'input_toggle_style', ''), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - // select - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo " \n"; if ($show_destination_delete && permission_exists('ring_group_destination_delete')) { @@ -1184,13 +1170,13 @@ echo "\n"; echo " \n"; echo " \n"; - if (!empty($ring_group_call_forward_enabled) && $ring_group_call_forward_enabled == "true") { + if (!empty($ring_group_call_forward_enabled) && $ring_group_call_forward_enabled == true) { echo " \n"; } else { echo " \n"; } - if (!empty($ring_group_call_forward_enabled) && $ring_group_call_forward_enabled == "false") { + if (!empty($ring_group_call_forward_enabled) && $ring_group_call_forward_enabled == false) { echo " \n"; } else { @@ -1235,13 +1221,13 @@ echo "\n"; echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " "; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " "; } echo " "; - echo ""; + echo ""; echo "
\n"; echo $text['description-ring-group-forward']."\n"; echo "\n"; @@ -1337,17 +1315,16 @@ echo " ".$text['label-enabled']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style', ''), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; @@ -1382,4 +1359,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/ring_groups/ring_groups.php b/app/ring_groups/ring_groups.php index 819d62fd2b..19c39e082f 100644 --- a/app/ring_groups/ring_groups.php +++ b/app/ring_groups/ring_groups.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) 2010-2024 + Portions created by the Initial Developer are Copyright (C) 2010-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -91,7 +91,6 @@ $sql = "select count(*) from v_ring_groups "; $sql .= "where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $domain_uuid; - $database = new database; $total_ring_groups = $database->select($sql, $parameters, 'column'); //get filtered ring group count @@ -118,12 +117,10 @@ $sql .= "lower(ring_group_name) like :search "; $sql .= "or lower(ring_group_extension) like :search "; $sql .= "or lower(ring_group_description) like :search "; - $sql .= "or lower(ring_group_enabled) like :search "; $sql .= "or lower(ring_group_strategy) like :search "; $sql .= ") "; $parameters['search'] = '%'.$search.'%'; } - $database = new database; $num_rows = $database->select($sql, $parameters, 'column'); unset($sql, $parameters); @@ -138,17 +135,21 @@ //get the list if ($show == "all" && permission_exists('ring_group_all')) { - $sql = "select * from v_ring_groups "; + $sql = "select r.ring_group_uuid, r.domain_uuid, r.ring_group_name, r.ring_group_extension, r.ring_group_strategy, "; + $sql .= "r.ring_group_forward_destination, r.ring_group_forward_enabled, cast(r.ring_group_enabled as text), r.ring_group_description "; + $sql .= "from v_ring_groups as r "; $sql .= "where true "; } - elseif (permission_exists('ring_group_domain') || permission_exists('ring_group_all')) { - $sql = "select * from v_ring_groups "; + else if (permission_exists('ring_group_domain') || permission_exists('ring_group_all')) { + $sql = "select r.ring_group_uuid, r.domain_uuid, r.ring_group_name, r.ring_group_extension, r.ring_group_strategy, "; + $sql .= "r.ring_group_forward_destination, r.ring_group_forward_enabled, cast(r.ring_group_enabled as text), r.ring_group_description "; + $sql .= "from v_ring_groups as r "; $sql .= "where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $domain_uuid; } else { - $sql = "select r.ring_group_uuid, r.ring_group_name, r.ring_group_extension, r.ring_group_strategy, "; - $sql .= "r.ring_group_forward_destination, r.ring_group_forward_enabled, r.ring_group_description "; + $sql = "select r.ring_group_uuid, r.domain_uuid, r.ring_group_name, r.ring_group_extension, r.ring_group_strategy, "; + $sql .= "r.ring_group_forward_destination, r.ring_group_forward_enabled, cast(r.ring_group_enabled as text), r.ring_group_description "; $sql .= "from v_ring_groups as r, v_ring_group_users as u "; $sql .= "where r.domain_uuid = :domain_uuid "; $sql .= "and r.ring_group_uuid = u.ring_group_uuid "; @@ -161,7 +162,6 @@ $sql .= "lower(ring_group_name) like :search "; $sql .= "or lower(ring_group_extension) like :search "; $sql .= "or lower(ring_group_description) like :search "; - $sql .= "or lower(ring_group_enabled) like :search "; $sql .= "or lower(ring_group_strategy) like :search "; $sql .= ") "; $parameters['search'] = '%'.$search.'%'; @@ -284,7 +284,7 @@ echo " \n"; echo " ".escape($row['ring_group_extension'])." \n"; echo " ".$text['option-'.escape($row['ring_group_strategy'])]." \n"; - echo " ".($row['ring_group_forward_enabled'] == 'true' ? format_phone(escape($row['ring_group_forward_destination'])) : null)." \n"; + echo " ".($row['ring_group_forward_enabled'] === true && !empty($row['ring_group_forward_destination']) ? format_phone(escape($row['ring_group_forward_destination'])) : null)." \n"; if (permission_exists('ring_group_edit')) { echo " "; echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['ring_group_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]); diff --git a/app/sip_profiles/app_config.php b/app/sip_profiles/app_config.php index 458181c15b..5344cc63af 100644 --- a/app/sip_profiles/app_config.php +++ b/app/sip_profiles/app_config.php @@ -95,7 +95,7 @@ $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_profile_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_profile_description"; @@ -208,7 +208,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the value."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_profile_setting_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Choose to enable or disable this."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_profile_setting_description"; diff --git a/app/sip_profiles/app_defaults.php b/app/sip_profiles/app_defaults.php index bad35f898c..3a1af18ac0 100644 --- a/app/sip_profiles/app_defaults.php +++ b/app/sip_profiles/app_defaults.php @@ -86,7 +86,7 @@ } //add the sip profile if it is not false - if ($sip_profile_enabled != "false") { + if ($sip_profile_enabled != false) { //add profile name and description $sip_profile_uuid = uuid(); @@ -109,7 +109,7 @@ $array['sip_profiles'][$x]['sip_profile_settings'][$y]['sip_profile_uuid'] = $sip_profile_uuid; $array['sip_profiles'][$x]['sip_profile_settings'][$y]['sip_profile_setting_name'] = $row['@attributes']['name']; $array['sip_profiles'][$x]['sip_profile_settings'][$y]['sip_profile_setting_value'] = $row['@attributes']['value']; - $array['sip_profiles'][$x]['sip_profile_settings'][$y]['sip_profile_setting_enabled'] = $row['@attributes']['enabled'] != 'false' ? 'true' : $row['@attributes']['enabled']; + $array['sip_profiles'][$x]['sip_profile_settings'][$y]['sip_profile_setting_enabled'] = $row['@attributes']['enabled'] != false ? true : $row['@attributes']['enabled']; } } @@ -219,7 +219,7 @@ //if empty, set enabled to true $sql = "update v_sip_profiles set "; - $sql .= "sip_profile_enabled = 'true' "; + $sql .= "sip_profile_enabled = true "; $sql .= "where sip_profile_enabled is null "; $sql .= "or sip_profile_enabled = '' "; $database->execute($sql); diff --git a/app/sip_profiles/sip_profile_edit.php b/app/sip_profiles/sip_profile_edit.php index 9db4fac94e..035b38bc6e 100644 --- a/app/sip_profiles/sip_profile_edit.php +++ b/app/sip_profiles/sip_profile_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) 2016-2023 + Portions created by the Initial Developer are Copyright (C) 2016-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -55,7 +55,6 @@ $sip_profile_uuid = ''; $sip_profile_name = ''; $sip_profile_hostname = ''; - $sip_profile_enabled = 'false'; $sip_profile_description = ''; $sip_profile_domains = []; $sip_profile_settings = []; @@ -87,7 +86,7 @@ $sip_profile_uuid = $_POST["sip_profile_uuid"]; $sip_profile_name = $_POST["sip_profile_name"]; $sip_profile_hostname = $_POST["sip_profile_hostname"]; - $sip_profile_enabled = $_POST["sip_profile_enabled"] ?? 'false'; + $sip_profile_enabled = $_POST["sip_profile_enabled"]; $sip_profile_description = $_POST["sip_profile_description"]; $sip_profile_domains = $_POST["sip_profile_domains"]; $sip_profile_settings = $_POST["sip_profile_settings"]; @@ -116,7 +115,6 @@ //if (empty($sip_profile_uuid)) { $msg .= $text['message-required']." ".$text['label-sip_profile_uuid']."
\n"; } if (empty($sip_profile_name)) { $msg .= $text['message-required']." ".$text['label-sip_profile_name']."
\n"; } //if (empty($sip_profile_hostname)) { $msg .= $text['message-required']." ".$text['label-sip_profile_hostname']."
\n"; } - if (empty($sip_profile_enabled)) { $msg .= $text['message-required']." ".$text['label-sip_profile_enabled']."
\n"; } if (empty($sip_profile_description)) { $msg .= $text['message-required']." ".$text['label-sip_profile_description']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -277,7 +275,12 @@ //pre-populate the form if (!empty($_GET["id"]) && empty($_POST["persistformvar"])) { $sip_profile_uuid = $_GET["id"]; - $sql = "select * from v_sip_profiles "; + $sql = "select "; + $sql .= "sip_profile_name, "; + $sql .= "sip_profile_hostname, "; + $sql .= "sip_profile_enabled, "; + $sql .= "sip_profile_description "; + $sql .= "from v_sip_profiles "; $sql .= "where sip_profile_uuid = :sip_profile_uuid "; $parameters['sip_profile_uuid'] = $sip_profile_uuid; $database = new database; @@ -291,11 +294,15 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($sip_profile_enabled)) { $sip_profile_enabled = 'true'; } - //get the child data - $sql = "select * from v_sip_profile_settings "; + $sql = "select "; + $sql .= "sip_profile_setting_uuid, "; + $sql .= "sip_profile_uuid, "; + $sql .= "sip_profile_setting_name, "; + $sql .= "sip_profile_setting_value, "; + $sql .= "sip_profile_setting_enabled, "; + $sql .= "sip_profile_setting_description "; + $sql .= "from v_sip_profile_settings "; $sql .= "where sip_profile_uuid = :sip_profile_uuid "; $sql .= "order by sip_profile_setting_name "; $parameters['sip_profile_uuid'] = $sip_profile_uuid; @@ -316,7 +323,13 @@ } //get the child data - $sql = "select * from v_sip_profile_domains "; + $sql = "select "; + $sql .= "sip_profile_domain_uuid, "; + $sql .= "sip_profile_uuid, "; + $sql .= "sip_profile_domain_name, "; + $sql .= "sip_profile_domain_alias, "; + $sql .= "sip_profile_domain_parse "; + $sql .= "from v_sip_profile_domains "; $sql .= "where sip_profile_uuid = :sip_profile_uuid "; $parameters['sip_profile_uuid'] = $sip_profile_uuid; $database = new database; @@ -363,7 +376,7 @@ //show the header $document['title'] = $text['title-sip_profile']; require_once "resources/header.php"; - + //helper scripts echo "\n"; - + //show the content echo "
\n"; @@ -489,8 +502,8 @@ if (!empty($sip_profile_uuid) && is_uuid($row["sip_profile_uuid"])) { $sip_profile_uuid = $row["sip_profile_uuid"]; } - $label_sip_profile_domain_alias = !empty($row["sip_profile_domain_alias"]) ? $text['label-'.$row["sip_profile_domain_alias"]] : ''; - $label_sip_profile_domain_parse = !empty($row["sip_profile_domain_alias"]) ? $text['label-'.$row["sip_profile_domain_alias"]] : ''; + $label_sip_profile_domain_alias = $row["sip_profile_domain_alias"] !== '' ? $text['label-'.($row["sip_profile_domain_alias"] === true ? 'true' : 'false')] : ''; + $label_sip_profile_domain_parse = $row["sip_profile_domain_parse"] !== '' ? $text['label-'.($row["sip_profile_domain_parse"] === true ? 'true' : 'false')] : ''; echo " \n"; echo " \n"; @@ -501,7 +514,6 @@ echo " \n"; echo " \n"; echo " \n"; @@ -509,7 +521,6 @@ echo " \n"; echo " \n"; echo " \n"; @@ -564,7 +575,8 @@ $x = 0; foreach ($sip_profile_settings as $row) { $bottom_border = empty($row['sip_profile_setting_uuid']) ? "border-bottom: none;" : null; - $label_sip_profile_setting_enabled = !empty($row["sip_profile_setting_enabled"]) ? $text['label-'.$row["sip_profile_setting_enabled"]] : ''; + $label_sip_profile_setting_enabled = $text['label-'.($row["sip_profile_setting_enabled"] === true ? 'true' : 'false')]; + echo " \n"; echo " \n"; echo " \n"; @@ -579,8 +591,8 @@ echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; @@ -631,17 +643,16 @@ echo " ".$text['label-sip_profile_enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-sip_profile_enabled']."\n"; diff --git a/app/sip_profiles/sip_profiles.php b/app/sip_profiles/sip_profiles.php index dce559d20f..54bb394844 100644 --- a/app/sip_profiles/sip_profiles.php +++ b/app/sip_profiles/sip_profiles.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): @@ -111,7 +111,7 @@ $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(sip_profile_uuid)', '*', $sql); + $sql = str_replace('count(sip_profile_uuid)', 'sip_profile_uuid, sip_profile_name, sip_profile_hostname, cast(sip_profile_enabled as text), sip_profile_description', $sql); $sql .= order_by($order_by, $order); $sql .= limit_offset($rows_per_page, $offset); $database = new database; diff --git a/app/sip_status/cmd.php b/app/sip_status/cmd.php index e1a1949b3b..6609b815de 100644 --- a/app/sip_status/cmd.php +++ b/app/sip_status/cmd.php @@ -54,7 +54,7 @@ $sql = "select sip_profile_setting_value from v_sip_profile_settings "; $sql .= "where sip_profile_uuid = (select sip_profile_uuid from v_sip_profiles where sip_profile_name = :profile_name limit 1) "; $sql .= "and sip_profile_setting_name = 'sip-port' "; - $sql .= "and sip_profile_setting_enabled = 'true' "; + $sql .= "and sip_profile_setting_enabled = true "; $sql .= "limit 1"; $parameters['profile_name'] = $profile; $profile_port = $database->select($sql, $parameters, 'column'); @@ -64,7 +64,7 @@ $sql = "select sip_profile_setting_value from v_sip_profile_settings "; $sql .= "where sip_profile_uuid = (select sip_profile_uuid from v_sip_profiles where sip_profile_name = :profile_name limit 1) "; $sql .= "and sip_profile_setting_name = 'tls-sip-port' "; - $sql .= "and sip_profile_setting_enabled = 'true' "; + $sql .= "and sip_profile_setting_enabled = true "; $sql .= "limit 1"; $parameters['profile_name'] = $profile; $profile_tls_port = $database->select($sql, $parameters, 'column'); diff --git a/app/sip_status/sip_status.php b/app/sip_status/sip_status.php index a3bfea8c93..a3d43977cc 100644 --- a/app/sip_status/sip_status.php +++ b/app/sip_status/sip_status.php @@ -63,7 +63,7 @@ $hostname = trim(event_socket::api('switchname')); } $sql = "select sip_profile_uuid, sip_profile_name from v_sip_profiles "; - $sql .= "where sip_profile_enabled = 'true' "; + $sql .= "where sip_profile_enabled = true "; if (!empty($hostname)) { $sql .= "and (sip_profile_hostname = :sip_profile_hostname "; $sql .= "or sip_profile_hostname = '' "; diff --git a/app/sofia_global_settings/sofia_global_setting_edit.php b/app/sofia_global_settings/sofia_global_setting_edit.php index 9bd753c199..5036f6e687 100644 --- a/app/sofia_global_settings/sofia_global_setting_edit.php +++ b/app/sofia_global_settings/sofia_global_setting_edit.php @@ -61,7 +61,7 @@ if (!empty($_POST)) { $global_setting_name = $_POST["global_setting_name"]; $global_setting_value = $_POST["global_setting_value"]; - $global_setting_enabled = $_POST["global_setting_enabled"] ?? "false"; + $global_setting_enabled = $_POST["global_setting_enabled"]; $global_setting_description = $_POST["global_setting_description"]; } @@ -113,7 +113,6 @@ $msg = ''; if (empty($global_setting_name)) { $msg .= $text['message-required']." ".$text['label-global_setting_name']."
\n"; } if (empty($global_setting_value)) { $msg .= $text['message-required']." ".$text['label-global_setting_value']."
\n"; } - if (empty($global_setting_enabled)) { $msg .= $text['message-required']." ".$text['label-global_setting_enabled']."
\n"; } //if (empty($global_setting_description)) { $msg .= $text['message-required']." ".$text['label-global_setting_description']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -161,7 +160,7 @@ $sql .= " sofia_global_setting_uuid, "; $sql .= " global_setting_name, "; $sql .= " global_setting_value, "; - $sql .= " cast(global_setting_enabled as text), "; + $sql .= " global_setting_enabled, "; $sql .= " global_setting_description "; $sql .= "from v_sofia_global_settings "; $sql .= "where sofia_global_setting_uuid = :sofia_global_setting_uuid "; @@ -177,9 +176,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($global_setting_enabled)) { $global_setting_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -251,17 +247,16 @@ echo " ".$text['label-global_setting_enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-global_setting_enabled']."\n"; diff --git a/app/sofia_global_settings/sofia_global_settings.php b/app/sofia_global_settings/sofia_global_settings.php index e4fb921589..aa280f56f2 100644 --- a/app/sofia_global_settings/sofia_global_settings.php +++ b/app/sofia_global_settings/sofia_global_settings.php @@ -265,4 +265,3 @@ require_once "resources/footer.php"; ?> - diff --git a/app/streams/app_config.php b/app/streams/app_config.php index 681dc096af..f0f7ca7b03 100644 --- a/app/streams/app_config.php +++ b/app/streams/app_config.php @@ -63,8 +63,8 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the location.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'stream_enabled'; - $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enable or disable this stream. '; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'boolean'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enable or disable this stream.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'stream_description'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; diff --git a/app/streams/stream_edit.php b/app/streams/stream_edit.php index f0c198cb3d..241bf1b9ea 100644 --- a/app/streams/stream_edit.php +++ b/app/streams/stream_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) 2018-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. */ @@ -60,7 +60,7 @@ $stream_uuid = $_POST["stream_uuid"]; $stream_name = $_POST["stream_name"]; $stream_location = $_POST["stream_location"]; - $stream_enabled = $_POST["stream_enabled"] ?? 'false'; + $stream_enabled = $_POST["stream_enabled"]; $stream_description = $_POST["stream_description"]; } @@ -231,9 +231,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($stream_enabled)) { $stream_enabled = 'true'; } - //need stream_all permission to edit a global stream if (!permission_exists('stream_all') && $domain_uuid == null) { header('Location: streams.php'); @@ -290,17 +287,16 @@ echo " ".$text['label-stream_enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-stream_enabled']."\n"; diff --git a/app/streams/streams.php b/app/streams/streams.php index 498a51c6e1..4b4ab1ee7c 100644 --- a/app/streams/streams.php +++ b/app/streams/streams.php @@ -126,13 +126,16 @@ $offset = $rows_per_page * $page; //get the list - $sql = "select * from v_streams "; + $sql = "select "; + $sql .= "stream_uuid, domain_uuid, stream_name, stream_location, "; + $sql .= "cast(stream_enabled as text), stream_description "; + $sql .= "from v_streams "; $sql .= "where true "; if (!empty($search)) { $sql .= "and ("; $sql .= " lower(stream_name) like :search "; $sql .= " or lower(stream_location) like :search "; - $sql .= " or lower(stream_enabled) like :search "; + $sql .= " or lower(cast(stream_enabled as text)) like :search "; $sql .= " or lower(stream_description) like :search "; $sql .= ") "; $parameters['search'] = '%'.strtolower($search).'%'; diff --git a/app/switch/resources/scripts/app/call_block/index.lua b/app/switch/resources/scripts/app/call_block/index.lua index e47ef4fd2d..ca660ffd82 100644 --- a/app/switch/resources/scripts/app/call_block/index.lua +++ b/app/switch/resources/scripts/app/call_block/index.lua @@ -100,7 +100,7 @@ --check to see if the call should be blocked sql = "select * from v_call_block\n"; sql = sql .. "where (domain_uuid = :domain_uuid or domain_uuid is null) \n"; - sql = sql .. "and call_block_enabled = 'true' \n"; + sql = sql .. "and call_block_enabled = true \n"; sql = sql .. "and call_block_direction = :call_block_direction \n"; sql = sql .. "and (call_block_name <> '' or call_block_number <> '') \n"; sql = sql .. "and ( \n"; diff --git a/app/switch/resources/scripts/app/caller_id/resources/scripts/database.lua b/app/switch/resources/scripts/app/caller_id/resources/scripts/database.lua index 570f6c4699..5c3fb51f41 100644 --- a/app/switch/resources/scripts/app/caller_id/resources/scripts/database.lua +++ b/app/switch/resources/scripts/app/caller_id/resources/scripts/database.lua @@ -80,8 +80,8 @@ sql = sql .. " where domain_uuid = :domain_uuid "; sql = sql .. " and ( "; sql = sql .. " phone_number = :caller_id_number "; - sql = sql .. " or phone_country_code || phone_number = :caller_id_number "; - sql = sql .. " or '+' || phone_country_code || phone_number = :caller_id_number "; + sql = sql .. " or concat(phone_country_code, phone_number) = :caller_id_number "; + sql = sql .. " or concat('+', phone_country_code, phone_number) = :caller_id_number "; sql = sql .. " ) "; sql = sql .. "); "; local params = {caller_id_number = caller_id_number, domain_uuid = domain_uuid}; diff --git a/app/switch/resources/scripts/app/failure_handler/index.lua b/app/switch/resources/scripts/app/failure_handler/index.lua index 1b34811a63..5295a851e9 100644 --- a/app/switch/resources/scripts/app/failure_handler/index.lua +++ b/app/switch/resources/scripts/app/failure_handler/index.lua @@ -58,7 +58,7 @@ sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) "; sql = sql .. "AND template_language = :template_language "; sql = sql .. "AND template_category = 'missed' " - sql = sql .. "AND template_enabled = 'true' " + 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 diff --git a/app/switch/resources/scripts/app/hangup/index.lua b/app/switch/resources/scripts/app/hangup/index.lua index ed08dc9c20..00ad14e7cb 100644 --- a/app/switch/resources/scripts/app/hangup/index.lua +++ b/app/switch/resources/scripts/app/hangup/index.lua @@ -63,7 +63,7 @@ sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) "; sql = sql .. "AND template_language = :template_language "; sql = sql .. "AND template_category = 'missed' " - sql = sql .. "AND template_enabled = 'true' " + 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 diff --git a/app/switch/resources/scripts/app/is_local/index.lua b/app/switch/resources/scripts/app/is_local/index.lua index 6d309f9c24..15b2ae8b03 100644 --- a/app/switch/resources/scripts/app/is_local/index.lua +++ b/app/switch/resources/scripts/app/is_local/index.lua @@ -68,7 +68,7 @@ sql = sql .. " OR destination_number = :destination_number "; sql = sql .. ") "; sql = sql .. "AND destination_type = 'inbound' "; - sql = sql .. "AND destination_enabled = 'true' "; + sql = sql .. "AND destination_enabled = true "; local params = {destination_number = destination_number}; if (debug["sql"]) then freeswitch.consoleLog("notice", "SQL:" .. sql .. "; destination_number: " .. destination_number .. "\n"); diff --git a/app/switch/resources/scripts/app/ring_groups/index.lua b/app/switch/resources/scripts/app/ring_groups/index.lua index d5e652cc70..6d93399dfe 100644 --- a/app/switch/resources/scripts/app/ring_groups/index.lua +++ b/app/switch/resources/scripts/app/ring_groups/index.lua @@ -95,7 +95,7 @@ end --send the ring group event - event = freeswitch.Event("CUSTOM", "RING_GROUPS"); + event = freeswitch.Event("CUSTOM", "RING_GROUPS"); event:addHeader("domain_uuid", domain_uuid); event:addHeader("domain_name", domain_name); event:addHeader("ring_group_uuid", ring_group_uuid); @@ -227,9 +227,31 @@ --get the ring group ring_group_forward_enabled = ''; ring_group_forward_destination = ''; - sql = "SELECT d.domain_name, r.* FROM v_ring_groups as r, v_domains as d "; - sql = sql .. "where r.ring_group_uuid = :ring_group_uuid "; - sql = sql .. "and r.domain_uuid = d.domain_uuid "; + sql = "SELECT d.domain_name, "; + sql = sql .. "d.domain_uuid, "; + sql = sql .. "d.domain_name, "; + sql = sql .. "r.ring_group_name, "; + sql = sql .. "r.ring_group_extension, "; + sql = sql .. "r.ring_group_greeting, "; + sql = sql .. "cast(r.ring_group_forward_enabled as text), "; + sql = sql .. "r.ring_group_forward_destination, "; + sql = sql .. "r.ring_group_forward_toll_allow, "; + sql = sql .. "r.ring_group_timeout_app, "; + sql = sql .. "r.ring_group_timeout_data, "; + sql = sql .. "r.ring_group_exit_key, "; + sql = sql .. "r.ring_group_call_timeout, "; + sql = sql .. "r.ring_group_caller_id_name, "; + sql = sql .. "r.ring_group_caller_id_number, "; + sql = sql .. "r.ring_group_cid_name_prefix, "; + sql = sql .. "r.ring_group_cid_number_prefix, "; + sql = sql .. "cast(r.ring_group_call_screen_enabled as text), "; + sql = sql .. "cast(r.ring_group_call_forward_enabled as text), "; + sql = sql .. "cast(r.ring_group_follow_me_enabled as text), "; + sql = sql .. "r.ring_group_missed_call_app, "; + sql = sql .. "r.ring_group_missed_call_data "; + sql = sql .. "FROM v_ring_groups as r, v_domains as d "; + sql = sql .. "WHERE r.ring_group_uuid = :ring_group_uuid "; + sql = sql .. "AND r.domain_uuid = d.domain_uuid "; local params = {ring_group_uuid = ring_group_uuid}; status = dbh:query(sql, params, function(row) domain_uuid = row["domain_uuid"]; @@ -438,7 +460,7 @@ sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) "; sql = sql .. "AND template_language = :template_language "; sql = sql .. "AND template_category = 'missed' "; - sql = sql .. "AND template_enabled = 'true' "; + 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 @@ -533,7 +555,7 @@ end --process the ring group - if (ring_group_forward_enabled == "true" and string.len(ring_group_forward_destination) > 0) then + if (ring_group_forward_enabled == true and string.len(ring_group_forward_destination) > 0) then --set the outbound caller id if (caller_is_local == 'true' and outbound_caller_id_name ~= nil) then @@ -578,11 +600,9 @@ WHERE ring_group_uuid = :ring_group_uuid AND r.domain_uuid = :domain_uuid - AND r.ring_group_enabled = 'true' + AND r.ring_group_enabled = true ]]; - local params = {ring_group_uuid = ring_group_uuid, domain_uuid = domain_uuid}; - dbh:query(sql, params, function(row) if (row.ring_group_strategy == "random") then if (database["type"] == "mysql") then @@ -590,11 +610,14 @@ else sql_order = 'random() * 1000000' --both postgresql and sqlite uses random() instead of rand() end - else - sql_order='d.destination_delay, d.destination_number asc' end end); + --if the sql_order is not then set a default + if (sql_order == nil) then + sql_order = 'd.destination_delay, d.destination_number asc'; + end + --get the ring group destinations sql = [[ SELECT @@ -615,8 +638,8 @@ d.ring_group_uuid = r.ring_group_uuid AND d.ring_group_uuid = :ring_group_uuid AND r.domain_uuid = :domain_uuid - AND r.ring_group_enabled = 'true' - AND d.destination_enabled = 'true' + AND r.ring_group_enabled = true + AND d.destination_enabled = true ORDER BY ]]..sql_order..[[ ]]; @@ -639,7 +662,7 @@ end --follow the forwards - if (ring_group_call_forward_enabled == "true") then + if (ring_group_call_forward_enabled == true) then count, destination_number, toll_allow = get_forward_all(0, row.destination_number, leg_domain_name); else destination_number = row.destination_number; @@ -696,7 +719,7 @@ ---add follow me destinations for key, row in pairs(destinations) do - if (ring_group_follow_me_enabled == "true") then + if (ring_group_follow_me_enabled == true) then cmd = "user_data ".. row.destination_number .."@" ..row.domain_name.." var follow_me_enabled"; if (api:executeString(cmd) == "true") then @@ -910,7 +933,7 @@ user_exists = row.user_exists; --follow the forwards - if (row.ring_group_call_forward_enabled == "true") then + if (row.ring_group_call_forward_enabled == true) then count, destination_number = get_forward_all(0, destination_number, leg_domain_name); end diff --git a/app/switch/resources/scripts/app/ring_groups/resources/scripts/call_forward.lua b/app/switch/resources/scripts/app/ring_groups/resources/scripts/call_forward.lua index 9810c4e401..434bd22a18 100644 --- a/app/switch/resources/scripts/app/ring_groups/resources/scripts/call_forward.lua +++ b/app/switch/resources/scripts/app/ring_groups/resources/scripts/call_forward.lua @@ -106,7 +106,7 @@ if not session:ready() then return end --search ring_group in database - local sql = [[SELECT ring_group_uuid as uuid, ring_group_forward_enabled as forward_enabled, + local sql = [[SELECT ring_group_uuid as uuid, cast(ring_group_forward_enabled as text) as forward_enabled, ring_group_forward_destination as forward_destination, ring_group_extension as extension FROM v_ring_groups WHERE domain_uuid = :domain_uuid 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 05ed42cb48..a1706b220f 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 @@ -185,12 +185,12 @@ function send_email(id, uuid) 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 + if (voicemail_transcription_enabled) then sql = sql .. "AND template_subcategory = 'transcription' " else sql = sql .. "AND template_subcategory = 'default' " end - sql = sql .. "AND template_enabled = 'true' " + 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 diff --git a/app/switch/resources/scripts/app/voicemail/resources/functions/tutorial.lua b/app/switch/resources/scripts/app/voicemail/resources/functions/tutorial.lua index 852aaeca41..bdd0b42d5f 100644 --- a/app/switch/resources/scripts/app/voicemail/resources/functions/tutorial.lua +++ b/app/switch/resources/scripts/app/voicemail/resources/functions/tutorial.lua @@ -180,7 +180,7 @@ session:flushDigits(); --update play tutorial in the datebase local sql = [[UPDATE v_voicemails - set voicemail_tutorial = 'false' + set voicemail_tutorial = false WHERE domain_uuid = :domain_uuid AND voicemail_id = :voicemail_id AND voicemail_enabled = 'true' ]]; diff --git a/app/switch/resources/scripts/app/voicemail/resources/scripts/delete_messages.lua b/app/switch/resources/scripts/app/voicemail/resources/scripts/delete_messages.lua index 4deef47da6..755f66b0ba 100644 --- a/app/switch/resources/scripts/app/voicemail/resources/scripts/delete_messages.lua +++ b/app/switch/resources/scripts/app/voicemail/resources/scripts/delete_messages.lua @@ -52,7 +52,7 @@ end --get the voicemail extension - sql = "SELECT * FROM v_vars WHERE var_category = 'Defaults' AND var_name = 'vm_message_ext' AND var_enabled = 'true'"; + sql = "SELECT * FROM v_vars WHERE var_category = 'Defaults' AND var_name = 'vm_message_ext' AND var_enabled = true "; dbh:query(sql, function(row) vm_message_ext = row["var_value"]; end); diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/acl.conf.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/acl.conf.lua index abf381697b..3fd1e633d4 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/acl.conf.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/acl.conf.lua @@ -103,8 +103,8 @@ if (row.access_control_name == 'providers' or row.access_control_name == 'domains') then sql = "select domain_name, domain_description from v_domains "; sql = sql .. "where domain_uuid in (select distinct(domain_uuid) "; - sql = sql .. "from v_extensions where enabled = 'true') "; - sql = sql .. "and domain_enabled = 'true' "; + sql = sql .. "from v_extensions where enabled = true) "; + sql = sql .. "and domain_enabled = true "; local params = {} if (debug["sql"]) then freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. ";\n"); diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua index 3bf0f12409..f05b189055 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua @@ -232,7 +232,7 @@ --if you change this variable also change app/call_center/call_center_agent_edit.php confirm = ""..sound_prefix..",group_confirm_file=ivr/ivr-accept_reject_voicemail.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout="..agent_call_timeout; local record = ""; - if (agent_record == "true") then + if (agent_record) then record = string.format(",execute_on_pre_bridge='record_session %s/%s/archive/${strftime(%%Y)}/${strftime(%%b)}/${strftime(%%d)}/${uuid}.${record_ext}'", recordings_dir, domain_name) end if (string.find(agent_contact, '}') == nil) then diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/conference.conf.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/conference.conf.lua index 483c8fb72a..0c286131bf 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/conference.conf.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/conference.conf.lua @@ -50,7 +50,7 @@ --start the conference controls xml:append([[ ]]); sql = [[SELECT * FROM v_conference_controls - WHERE control_enabled = 'true' ]]; + WHERE control_enabled = true ]]; if (debug["sql"]) then freeswitch.consoleLog("notice", "[conference_control] SQL: " .. sql .. "\n"); end @@ -61,7 +61,7 @@ --get the conference control details from the database sql = [[SELECT * FROM v_conference_control_details WHERE conference_control_uuid = :conference_control_uuid - AND control_enabled = 'true' ]]; + AND control_enabled = true ]]; local params = {conference_control_uuid = conference_control_uuid}; if (debug["sql"]) then freeswitch.consoleLog("notice", "[conference_control] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); @@ -80,7 +80,7 @@ --start the conference profiles xml:append([[ ]]); sql = [[SELECT * FROM v_conference_profiles - WHERE profile_enabled = 'true' ]]; + WHERE profile_enabled = true ]]; if (debug["sql"]) then freeswitch.consoleLog("notice", "[conference_profiles] SQL: " .. sql .. "\n"); end @@ -91,7 +91,7 @@ --get the conference profile parameters from the database sql = [[SELECT * FROM v_conference_profile_params WHERE conference_profile_uuid = :conference_profile_uuid - AND profile_param_enabled = 'true' ]]; + AND profile_param_enabled = true ]]; local params = {conference_profile_uuid = conference_profile_uuid}; if (debug["sql"]) then freeswitch.consoleLog("notice", "[conference_profiles] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); @@ -116,7 +116,7 @@ freeswitch.consoleLog("notice", "[xml_handler] XML_STRING: " .. XML_STRING .. "\n"); end ---send the xml to the console +--send the XML to the console if (debug["xml_string"]) then local file = assert(io.open(temp_dir .."/conference.conf.xml", "w")); file:write(XML_STRING); diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua index 225341efd3..e02316db31 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua @@ -80,12 +80,12 @@ select * from v_ivr_menus where ivr_menu_uuid = :ivr_menu_uuid - and ivr_menu_enabled = 'true' + and ivr_menu_enabled = true union all select child.* from v_ivr_menus as child, ivr_menus as parent where child.ivr_menu_parent_uuid = parent.ivr_menu_uuid - and child.ivr_menu_enabled = 'true' + and child.ivr_menu_enabled = true ) select * from ivr_menus ]]; @@ -273,7 +273,7 @@ xml:append([[ >]]); --get the ivr menu options - local sql = [[ SELECT * FROM v_ivr_menu_options WHERE ivr_menu_uuid = :ivr_menu_uuid AND ivr_menu_option_enabled = 'true' ORDER BY ivr_menu_option_order asc ]]; + local sql = [[ SELECT * FROM v_ivr_menu_options WHERE ivr_menu_uuid = :ivr_menu_uuid AND ivr_menu_option_enabled = true ORDER BY ivr_menu_option_order asc ]]; local params = {ivr_menu_uuid = ivr_menu_uuid}; if (debug["sql"]) then freeswitch.consoleLog("notice", "[ivr_menu] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); @@ -305,7 +305,7 @@ end); --direct dial - if (ivr_menu_direct_dial == "true") then + if (ivr_menu_direct_dial == true) then local negative_lookahead = ""; if (#direct_dial_exclude > 0) then negative_lookahead = "(?!^("..table.concat(direct_dial_exclude, "|")..")$)"; diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua index f280e93a57..38f48245b8 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua @@ -70,7 +70,7 @@ --gt the global settings sql = "select * from v_sofia_global_settings "; - sql = sql .. "where global_setting_enabled = 'true' "; + sql = sql .. "where global_setting_enabled = true "; sql = sql .. "order by global_setting_name asc "; local params = {}; x = 0; @@ -87,8 +87,8 @@ --run the query sql = "select p.sip_profile_uuid, p.sip_profile_name, p.sip_profile_description, s.sip_profile_setting_name, s.sip_profile_setting_value "; sql = sql .. "from v_sip_profiles as p, v_sip_profile_settings as s "; - sql = sql .. "where s.sip_profile_setting_enabled = 'true' "; - sql = sql .. "and p.sip_profile_enabled = 'true' "; + sql = sql .. "where s.sip_profile_setting_enabled = true "; + sql = sql .. "and p.sip_profile_enabled = true "; sql = sql .. "and (p.sip_profile_hostname = :hostname or p.sip_profile_hostname is null or p.sip_profile_hostname = '') "; sql = sql .. "and p.sip_profile_uuid = s.sip_profile_uuid "; sql = sql .. "order by p.sip_profile_name asc "; @@ -119,9 +119,23 @@ --xml:append([[ ]]); --get the gateways - sql = "select * from v_gateways "; + sql = "select "; + sql = sql .. "gateway_uuid, domain_uuid, gateway, username, password, "; + sql = sql .. "cast(distinct_to as text), auth_username, realm, from_user, from_domain, "; + sql = sql .. "proxy, register_proxy,outbound_proxy,expire_seconds, "; + sql = sql .. "register, register_transport, contact_params, retry_seconds, "; + sql = sql .. "extension, ping, ping_min, ping_max, "; + sql = sql .. "cast(contact_in_ping as text) , "; + sql = sql .. "cast(caller_id_in_from as text), "; + sql = sql .. "cast(supress_cng as text), + sql = sql .. "sip_cid_type, codec_prefs, channels, "; + sql = sql .. "cast(extension_in_contact as text), "; + sql = sql .. "context, profile, hostname, "; + sql = sql .. "cast(enabled as text), "; + sql = sql .. "description "; + sql = sql .. "from v_gateways "; sql = sql .. "where profile = :profile "; - sql = sql .. "and enabled = 'true' "; + sql = sql .. "and enabled = true "; sql = sql .. "and (hostname = :hostname or hostname is null or hostname = '') "; local params = {profile = sip_profile_name, hostname = hostname}; if (debug["sql"]) then diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/translate.conf.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/translate.conf.lua index c938775c0a..59092f2c00 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/translate.conf.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/translate.conf.lua @@ -73,6 +73,7 @@ --run the query sql = "select * from v_number_translations "; sql = sql .. "order by number_translation_name asc "; + sql = sql .. "number_translation_enabled = true "; if (debug["sql"]) then freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n"); end @@ -136,7 +137,7 @@ end end --if XML_STRING ---send the xml to the console +--send the XML to the console if (debug["xml_string"]) then local file = assert(io.open(temp_dir .. "/translate.conf.xml", "w")); file:write(XML_STRING); diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua index 36fb104756..f03e5f7cc8 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua @@ -193,7 +193,7 @@ sql = sql .. " or (p.dialplan_context like '%public%' and p.domain_uuid IS NULL) "; sql = sql .. ") "; sql = sql .. "AND (p.hostname = :hostname OR p.hostname IS NULL) "; - sql = sql .. "AND p.dialplan_enabled = 'true' "; + sql = sql .. "AND p.dialplan_enabled = true "; sql = sql .. "ORDER BY p.dialplan_order ASC "; local params = {destination_number = destination_number, hostname = hostname}; if (debug["sql"]) then @@ -252,7 +252,7 @@ sql = sql .. "where p.dialplan_context in (:call_context, '${domain_name}', 'global') "; end sql = sql .. "and (p.hostname = :hostname or p.hostname is null) "; - sql = sql .. "and p.dialplan_enabled = 'true' "; + sql = sql .. "and p.dialplan_enabled = true "; sql = sql .. "order by p.dialplan_order asc "; local params = {call_context = call_context, hostname = hostname}; if (debug["sql"]) then diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/directory.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/directory.lua index ae30827c5f..26ace1ed31 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/directory.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/directory.lua @@ -19,7 +19,7 @@ --process when the sip profile is rescanned, sofia is reloaded, or sip redirect local sql = "SELECT * FROM v_domains as d, v_extensions as e " sql = sql .. "where d.domain_uuid = e.domain_uuid " - sql = sql .. "and (e.directory_visible = 'true' or e.directory_exten_visible='true') " + sql = sql .. "and (e.directory_visible = true or e.directory_exten_visible = true) " if domain_name then sql = sql .. "and d.domain_name = :domain_name " else diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/group_call.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/group_call.lua index 9dc141bde6..32a08211dc 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/group_call.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/group_call.lua @@ -1,6 +1,6 @@ -- xml_handler.lua -- Part of FusionPBX --- Copyright (C) 2013 Mark J Crane +-- Copyright (C) 2013 - 2025 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -28,14 +28,12 @@ local Xml = require "resources.functions.xml"; --get the cache - if (trim(api:execute("module_exists", "mod_memcache")) == "true") then - XML_STRING = trim(api:execute("memcache", "get directory:groups:"..domain_name)); - else - XML_STRING = "-ERR NOT FOUND"; - end + local cache = require "resources.functions.cache" + local directory_groups_key = "directory:groups:"..domain_name; + XML_STRING, err = cache.get(directory_groups_key); --set the cache - if (XML_STRING == "-ERR NOT FOUND") then + if not XML_STRING then --connect to the database local Database = require "resources.functions.database"; local dbh = Database.new('system'); @@ -74,6 +72,7 @@ local sql = [[ select * from v_extensions where domain_uuid = :domain_uuid + enabled = true order by call_group asc ]]; local params = {domain_uuid = domain_uuid}; @@ -140,11 +139,18 @@ dbh:release(); --set the cache - result = trim(api:execute("memcache", "set directory:groups:"..domain_name.." '"..XML_STRING:gsub("'", "'").."' "..expire["directory"])); + local ok, err = cache.set(directory_groups_key, XML_STRING, expire["directory"]); + if debug["cache"] then + if ok then + freeswitch.consoleLog("notice", "[xml_handler] " .. directory_groups_key .. " stored in the cache\n"); + else + freeswitch.consoleLog("warning", "[xml_handler] " .. directory_groups_key .. " can not be stored in the cache: " .. tostring(err) .. "\n"); + end + end --send to the console if (debug["cache"]) then - freeswitch.consoleLog("notice", "[xml_handler] directory:groups:"..domain_name.." source: database\n"); + freeswitch.consoleLog("notice", "[xml_handler] directory:groups:"..directory_groups_key.." source: database\n"); end else @@ -154,7 +160,7 @@ --send to the console if (debug["cache"]) then if (XML_STRING) then - freeswitch.consoleLog("notice", "[xml_handler] directory:groups:"..domain_name.." source: memcache\n"); + freeswitch.consoleLog("notice", "[xml_handler] "..directory_groups_key.." source: cache\n"); end end end diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/reverse-auth-lookup.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/reverse-auth-lookup.lua index 6fb87d487d..6c989d7e5f 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/reverse-auth-lookup.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/action/reverse-auth-lookup.lua @@ -55,6 +55,7 @@ if (domain_name ~= nil) then local sql = "SELECT domain_uuid FROM v_domains "; sql = sql .. "WHERE domain_name = :domain_name "; + sql = sql .. "and domain_enabled = true "; local params = {domain_name = domain_name} if (debug["sql"]) then log.noticef("SQL: %s; params %s", sql, json.encode(params)); @@ -69,7 +70,7 @@ if (domain_uuid ~= nil) then local sql = "SELECT * FROM v_extensions WHERE domain_uuid = :domain_uuid " .. "and (extension = :user or number_alias = :user) " - .. "and enabled = 'true' "; + .. "and enabled = true "; local params = {domain_uuid=domain_uuid, user=user}; if (debug["sql"]) then log.noticef("SQL: %s; params %s", sql, json.encode(params)); diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/directory.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/directory.lua index 1970e5a740..4713eb6d20 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/directory.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/directory/directory.lua @@ -1,6 +1,6 @@ -- xml_handler.lua -- Part of FusionPBX --- Copyright (C) 2013 - 2021 Mark J Crane +-- Copyright (C) 2013 - 2025 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -42,7 +42,7 @@ --event_calling_function = params:getHeader("Event-Calling-Function"); --set the variables as a string - vm_mailto = ""; + vm_mailto = ''; --include json library local json @@ -287,9 +287,9 @@ local sql = "SELECT e.*, random() FROM v_extensions as e, v_domains as d " .. "WHERE e.domain_uuid = :domain_uuid " .. "AND d.domain_uuid = :domain_uuid " - .. "AND d.domain_enabled = 'true' " + .. "AND d.domain_enabled = true " .. "AND (e.extension = :user or e.number_alias = :user) " - .. "AND e.enabled = 'true' "; + .. "AND e.enabled = true "; local params = {domain_uuid=domain_uuid, user=user}; if (debug["sql"]) then freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); @@ -367,10 +367,26 @@ forward_no_answer_destination = row.forward_no_answer_destination; forward_user_not_registered_enabled = row.forward_user_not_registered_enabled; forward_user_not_registered_destination = row.forward_user_not_registered_destination; + follow_me_uuid = row.follow_me_uuid; + follow_me_enabled = row.follow_me_enabled; do_not_disturb = row.do_not_disturb; extension_language = row.extension_language; extension_dialect = row.extension_dialect; extension_voice = row.extension_voice; + --dial_string = row.dial_string; + + --set the boolean values as true or false strings + directory_visible = directory_visible and "true" or "false"; + directory_exten_visible = directory_exten_visible and "true" or "false"; + forward_all_enabled = forward_all_enabled and "true" or "false"; + forward_busy_enabled = forward_busy_enabled and "true" or "false"; + forward_no_answer_enabled = forward_no_answer_enabled and "true" or "false"; + call_screen_enabled = call_screen_enabled and "true" or "false"; + forward_user_not_registered_enabled = forward_user_not_registered_enabled and "true" or "false"; + force_ping = force_ping and "true" or "false"; + follow_me_enabled = follow_me_enabled and "true" or "false"; + virtual_extension = virtual_extension and "true" or "false"; + do_not_disturb = do_not_disturb and "true" or "false"; --if the extension is virtual set register to false if (row.extension_type == 'virtual') then @@ -378,12 +394,9 @@ end -- get the follow me information - if (row.follow_me_uuid ~= nil and string.len(row.follow_me_uuid) > 0) then - follow_me_uuid = row.follow_me_uuid; + if (follow_me_uuid ~= nil and string.len(follow_me_uuid) > 0) then if (do_not_disturb == "true" or forward_all_enabled == "true") then follow_me_enabled = "false"; - else - follow_me_enabled = row.follow_me_enabled; end end @@ -432,7 +445,7 @@ if (extension_uuid) then local sql = "SELECT * FROM v_extension_settings " .. "WHERE extension_uuid = :extension_uuid " - .. "and extension_setting_enabled = 'true' "; + .. "and extension_setting_enabled = true "; local params = {extension_uuid=extension_uuid}; if (debug["sql"]) then freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); @@ -461,25 +474,13 @@ freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); end dbh:query(sql, params, function(row) - if (string.len(row.voicemail_enabled) > 0) then - vm_enabled = row.voicemail_enabled; - end - vm_password = row.voicemail_password; - vm_attach_file = "true"; - if (string.len(row.voicemail_attach_file) > 0) then - vm_attach_file = row.voicemail_attach_file; - end - vm_keep_local_after_email = "true"; - if (string.len(row.voicemail_local_after_email) > 0) then - vm_keep_local_after_email = row.voicemail_local_after_email; - end - if (string.len(row.voicemail_mail_to) > 0) then - vm_mailto = row.voicemail_mail_to; - else - vm_mailto = ""; - end + vm_keep_local_after_email = voicemail_local_after_email and "true" or "false"; + vm_enabled = voicemail_enabled and "true" or "false"; + vm_attach_file = voicemail_attach_file and "true" or "false"; + vm_password = row.voicemail_password and row.voicemail_password or ''; + vm_mailto = row.voicemail_mail_to and row.voicemail_mail_to or ''; end); - end + end --if the extension does not exist set continue to false; if (extension_uuid == nil) then @@ -570,7 +571,7 @@ if (call_group ~= nil) and (string.len(call_group) > 0) then xml:append([[ ]]); end - if (call_screen_enabled ~= nil) and (string.len(call_screen_enabled) > 0) then + if (call_screen_enabled ~= nil) and (call_screen_enabled == 'true') then xml:append([[ ]]); end if (user_record ~= nil) and (string.len(user_record) > 0) then @@ -613,10 +614,10 @@ if (directory_full_name ~= nil) and (string.len(directory_full_name) > 0) then xml:append([[ ]]); end - if (directory_visible ~= nil) and (string.len(directory_visible) > 0) then + if (directory_visible ~= nil) and (directory_visible == 'true') then xml:append([[ ]]); end - if (directory_exten_visible ~= nil) and (string.len(directory_exten_visible) > 0) then + if (directory_exten_visible ~= nil) and (directory_exten_visible == 'true') then xml:append([[ ]]); end if (limit_max ~= nil) and (string.len(limit_max) > 0) then @@ -639,7 +640,7 @@ if (absolute_codec_string ~= nil) and (string.len(absolute_codec_string) > 0) then xml:append([[ ]]); end - if (force_ping ~= nil) and (string.len(force_ping) > 0) then + if (force_ping ~= nil) and (force_ping == 'true') then xml:append([[ ]]); end if (sip_bypass_media ~= nil) and (sip_bypass_media == "bypass-media") then @@ -651,37 +652,37 @@ if (sip_bypass_media ~= nil) and (sip_bypass_media == "proxy-media") then xml:append([[ ]]); end - if (forward_all_enabled ~= nil) and (string.len(forward_all_enabled) > 0) then + if (forward_all_enabled ~= nil) and (forward_all_enabled == 'true') then xml:append([[ ]]); end if (forward_all_destination ~= nil) and (string.len(forward_all_destination) > 0) then xml:append([[ ]]); end - if (forward_busy_enabled ~= nil) and (string.len(forward_busy_enabled) > 0) then + if (forward_busy_enabled ~= nil) and (forward_busy_enabled == 'true') then xml:append([[ ]]); end if (forward_busy_destination ~= nil) and (string.len(forward_busy_destination) > 0) then xml:append([[ ]]); end - if (forward_no_answer_enabled ~= nil) and (string.len(forward_no_answer_enabled) > 0) then + if (forward_no_answer_enabled ~= nil) and (forward_no_answer_enabled == 'true') then xml:append([[ ]]); end if (forward_no_answer_destination ~= nil) and (string.len(forward_no_answer_destination) > 0) then xml:append([[ ]]); end - if (forward_user_not_registered_enabled ~= nil) and (string.len(forward_user_not_registered_enabled) > 0) then + if (forward_user_not_registered_enabled ~= nil) and (forward_user_not_registered_enabled == 'true') then xml:append([[ ]]); end if (forward_user_not_registered_destination ~= nil) and (string.len(forward_user_not_registered_destination) > 0) then xml:append([[ ]]); end - if (follow_me_enabled ~= nil) and (string.len(follow_me_enabled) > 0) then + if (follow_me_enabled ~= nil) and (follow_me_enabled == 'true') then xml:append([[ ]]); end --if (follow_me_destinations ~= nil) and (string.len(follow_me_destinations) > 0) then -- xml:append([[ ]]); --end - if (do_not_disturb ~= nil) and (string.len(do_not_disturb) > 0) then + if (do_not_disturb ~= nil) and (do_not_disturb == 'true') then xml:append([[ ]]); end if (extension_language ~= nil) and (string.len(extension_language) > 0) then diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/languages/languages.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/languages/languages.lua index 70550400a3..4fd6e1028c 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/languages/languages.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/languages/languages.lua @@ -114,7 +114,7 @@ sql = sql .. "AND p.phrase_uuid = :macro_name "; sql = sql .. "AND p.phrase_language = :language "; sql = sql .. "AND p.phrase_uuid = d.phrase_uuid "; - sql = sql .. "AND p.phrase_enabled = 'true' "; + sql = sql .. "AND p.phrase_enabled = true "; sql = sql .. "ORDER BY d.domain_uuid, p.phrase_uuid, d.phrase_detail_order ASC "; local params = {domain_uuid = domain_uuid, macro_name = macro_name, language = language}; if (debug["sql"]) then diff --git a/app/switch/resources/scripts/directory.lua b/app/switch/resources/scripts/directory.lua index 5d5ea114cb..74da45d69d 100644 --- a/app/switch/resources/scripts/directory.lua +++ b/app/switch/resources/scripts/directory.lua @@ -377,7 +377,11 @@ end --get the extensions from the database - local sql = "SELECT * FROM v_extensions WHERE domain_uuid = :domain_uuid AND enabled = 'true' AND (directory_visible is null or directory_visible = 'true') ORDER BY directory_first_name, effective_caller_id_name asc; "; + local sql = "SELECT extension, effective_caller_id_name, "; + sql = sql .. "directory_first_name, directory_last_name, directory_exten_visible, user_context "; + sql = sql .. "FROM v_extensions WHERE domain_uuid = :domain_uuid AND enabled = true "; + sql = sql .. "AND (directory_visible is null or directory_visible = true) "; + sql = sql .. "ORDER BY directory_first_name, effective_caller_id_name asc; "; local params = {domain_uuid = domain_uuid}; if (debug["sql"]) then freeswitch.consoleLog("notice", "[directory] SQL: " .. sql .. "; params: " .. json.encode(params) .. "\n"); diff --git a/app/switch/resources/scripts/disa.callback.lua b/app/switch/resources/scripts/disa.callback.lua index 6b5c741063..4e86ca7235 100644 --- a/app/switch/resources/scripts/disa.callback.lua +++ b/app/switch/resources/scripts/disa.callback.lua @@ -69,7 +69,7 @@ else local sql = [[select * from v_dialplans as d, v_dialplan_details as s where (d.domain_uuid = :domain_uuid or d.domain_uuid is null) and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' - and d.dialplan_enabled = 'true' + and d.dialplan_enabled = true and d.dialplan_uuid = s.dialplan_uuid order by d.dialplan_order asc, @@ -183,7 +183,7 @@ if session1:ready() and session1:answered() then local sql = [[select * from v_dialplans as d, v_dialplan_details as s where (d.domain_uuid = :domain_uuid or d.domain_uuid is null) and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' - and d.dialplan_enabled = 'true' + and d.dialplan_enabled = true and d.dialplan_uuid = s.dialplan_uuid order by d.dialplan_order asc, diff --git a/app/switch/resources/scripts/follow_me.lua b/app/switch/resources/scripts/follow_me.lua index 111e48f72e..b38bb92297 100644 --- a/app/switch/resources/scripts/follow_me.lua +++ b/app/switch/resources/scripts/follow_me.lua @@ -83,7 +83,7 @@ local follow_me_enabled = row.follow_me_enabled; --set follow me - if (follow_me_enabled == "false") then + if (follow_me_enabled == false) then --update the display and play a message channel_display(session:get_uuid(), "Activated") session:execute("sleep", "2000"); @@ -92,7 +92,7 @@ end --unset follow me - if (follow_me_enabled == "true") then + if (follow_me_enabled == true) then --update the display and play a message channel_display(session:get_uuid(), "Cancelled") session:execute("sleep", "2000"); @@ -102,10 +102,10 @@ --enable or disable follow me sql = "update v_follow_me set "; - if (follow_me_enabled == "true") then - sql = sql .. "follow_me_enabled = 'false' "; + if (follow_me_enabled == true) then + sql = sql .. "follow_me_enabled = false "; else - sql = sql .. "follow_me_enabled = 'true' "; + sql = sql .. "follow_me_enabled = true "; end sql = sql .. "where domain_uuid = :domain_uuid "; sql = sql .. "and follow_me_uuid = :follow_me_uuid "; @@ -117,13 +117,13 @@ --update the extension sql = "update v_extensions set "; - sql = sql .. "do_not_disturb = 'false', "; - if (follow_me_enabled == "true") then - sql = sql .. "follow_me_enabled = 'false', "; + sql = sql .. "do_not_disturb = false, "; + if (follow_me_enabled == true) then + sql = sql .. "follow_me_enabled = false, "; else - sql = sql .. "follow_me_enabled = 'true', "; + sql = sql .. "follow_me_enabled = true, "; end - sql = sql .. "forward_all_enabled = 'false' "; + sql = sql .. "forward_all_enabled = false "; sql = sql .. "where domain_uuid = :domain_uuid "; sql = sql .. "and extension_uuid = :extension_uuid "; local params = {domain_uuid=domain_uuid, extension_uuid=extension_uuid}; diff --git a/app/switch/resources/scripts/ivr_menu.lua b/app/switch/resources/scripts/ivr_menu.lua index da191d0938..dafc8e5ac1 100644 --- a/app/switch/resources/scripts/ivr_menu.lua +++ b/app/switch/resources/scripts/ivr_menu.lua @@ -105,7 +105,7 @@ --get the ivr menu from the database sql = [[SELECT * FROM v_ivr_menus WHERE ivr_menu_uuid = :ivr_menu_uuid - AND ivr_menu_enabled = 'true' ]]; + AND ivr_menu_enabled = true ]]; local params = {ivr_menu_uuid = ivr_menu_uuid}; if (debug["sql"]) then log.notice("SQL: " .. sql .. "; params: " .. json.encode(params)); @@ -339,7 +339,7 @@ v_ivr_menu_options WHERE ivr_menu_uuid = :ivr_menu_uuid - AND ivr_menu_option_enabled = 'true' + AND ivr_menu_option_enabled = true ORDER BY ivr_menu_option_order asc ]]; @@ -432,7 +432,7 @@ end --direct dial - if ivr_menu_direct_dial == "true" and #digits > 0 and #digits < 6 then + if ivr_menu_direct_dial == true and #digits > 0 and #digits < 6 then -- remove *# digits = digits:gsub("[*#]", ""); diff --git a/app/switch/resources/scripts/resources/functions/route_to_bridge.lua b/app/switch/resources/scripts/resources/functions/route_to_bridge.lua index bcafe1f065..58ab7dc612 100644 --- a/app/switch/resources/scripts/resources/functions/route_to_bridge.lua +++ b/app/switch/resources/scripts/resources/functions/route_to_bridge.lua @@ -591,7 +591,7 @@ local function outbound_route_to_bridge(dbh, domain_uuid, fields, actions) local n = #actions extension_to_bridge(extension, actions, fields) -- if we found bridge or add any action and there no continue flag - if actions.bridge or (n > #actions and route.dialplan_continue == 'false') then + if actions.bridge or (n > #actions and route.dialplan_continue == false) then extension = nil return 1 end diff --git a/app/system/resources/dashboard/system_counts.php b/app/system/resources/dashboard/system_counts.php index a530bab8bf..bef68cbe83 100644 --- a/app/system/resources/dashboard/system_counts.php +++ b/app/system/resources/dashboard/system_counts.php @@ -28,7 +28,7 @@ $stats['system']['domains']['total'] = sizeof($_SESSION['domains']); $stats['system']['domains']['disabled'] = 0; foreach ($_SESSION['domains'] as $domain) { - $stats['system']['domains']['disabled'] += ($domain['domain_enabled'] != 'true') ? 1 : 0; + $stats['system']['domains']['disabled'] += ($domain['domain_enabled'] != true) ? 1 : 0; } } @@ -43,10 +43,10 @@ if (is_array($result) && sizeof($result) != 0) { $stats['system']['devices']['total'] = sizeof($result); foreach ($result as $row) { - $stats['system']['devices']['disabled'] += ($row['device_enabled'] != 'true') ? 1 : 0; + $stats['system']['devices']['disabled'] += ($row['device_enabled'] != true) ? 1 : 0; if ($row['domain_uuid'] == $_SESSION['domain_uuid']) { $stats['domain']['devices']['total']++; - $stats['domain']['devices']['disabled'] += ($row['device_enabled'] != 'true') ? 1 : 0; + $stats['domain']['devices']['disabled'] += ($row['device_enabled'] != true) ? 1 : 0; } } } @@ -64,10 +64,10 @@ if (is_array($result) && sizeof($result) != 0) { $stats['system']['extensions']['total'] = sizeof($result); foreach ($result as $row) { - $stats['system']['extensions']['disabled'] += ($row['enabled'] != 'true') ? 1 : 0; + $stats['system']['extensions']['disabled'] += ($row['enabled'] != true) ? 1 : 0; if ($row['domain_uuid'] == $_SESSION['domain_uuid']) { $stats['domain']['extensions']['total']++; - $stats['domain']['extensions']['disabled'] += ($row['enabled'] != 'true') ? 1 : 0; + $stats['domain']['extensions']['disabled'] += ($row['enabled'] != true) ? 1 : 0; } } } @@ -85,10 +85,10 @@ if (is_array($result) && sizeof($result) != 0) { $stats['system']['gateways']['total'] = sizeof($result); foreach ($result as $row) { - $stats['system']['gateways']['disabled'] += ($row['enabled'] != 'true') ? 1 : 0; + $stats['system']['gateways']['disabled'] += ($row['enabled'] != true) ? 1 : 0; if ($row['domain_uuid'] == $_SESSION['domain_uuid']) { $stats['domain']['gateways']['total']++; - $stats['domain']['gateways']['disabled'] += ($row['enabled'] != 'true') ? 1 : 0; + $stats['domain']['gateways']['disabled'] += ($row['enabled'] != true) ? 1 : 0; } } } @@ -106,10 +106,10 @@ if (is_array($result) && sizeof($result) != 0) { $stats['system']['users']['total'] = sizeof($result); foreach ($result as $row) { - $stats['system']['users']['disabled'] += ($row['user_enabled'] != 'true') ? 1 : 0; + $stats['system']['users']['disabled'] += ($row['user_enabled'] != true) ? 1 : 0; if ($row['domain_uuid'] == $_SESSION['domain_uuid']) { $stats['domain']['users']['total']++; - $stats['domain']['users']['disabled'] += ($row['user_enabled'] != 'true') ? 1 : 0; + $stats['domain']['users']['disabled'] += ($row['user_enabled'] != true) ? 1 : 0; } } } @@ -127,10 +127,10 @@ if (is_array($result) && sizeof($result) != 0) { $stats['system']['destinations']['total'] = sizeof($result); foreach ($result as $row) { - $stats['system']['destinations']['disabled'] += ($row['destination_enabled'] != 'true') ? 1 : 0; + $stats['system']['destinations']['disabled'] += ($row['destination_enabled'] != true) ? 1 : 0; if ($row['domain_uuid'] == $_SESSION['domain_uuid']) { $stats['domain']['destinations']['total']++; - $stats['domain']['destinations']['disabled'] += ($row['destination_enabled'] != 'true') ? 1 : 0; + $stats['domain']['destinations']['disabled'] += ($row['destination_enabled'] != true) ? 1 : 0; } } } @@ -148,10 +148,10 @@ if (is_array($result) && sizeof($result) != 0) { $stats['system']['call_center_queues']['total'] = sizeof($result); foreach ($result as $row) { - //$stats['system']['call_center_queues']['disabled'] += ($row['queue_enabled'] != 'true') ? 1 : 0; + //$stats['system']['call_center_queues']['disabled'] += ($row['queue_enabled'] != true) ? 1 : 0; if ($row['domain_uuid'] == $_SESSION['domain_uuid']) { $stats['domain']['call_center_queues']['total']++; - //$stats['domain']['call_center_queues']['disabled'] += ($row['queue_enabled'] != 'true') ? 1 : 0; + //$stats['domain']['call_center_queues']['disabled'] += ($row['queue_enabled'] != true) ? 1 : 0; } } } @@ -169,10 +169,10 @@ if (is_array($result) && sizeof($result) != 0) { $stats['system']['ivr_menus']['total'] = sizeof($result); foreach ($result as $row) { - $stats['system']['ivr_menus']['disabled'] += ($row['ivr_menu_enabled'] != 'true') ? 1 : 0; + $stats['system']['ivr_menus']['disabled'] += ($row['ivr_menu_enabled'] != true) ? 1 : 0; if ($row['domain_uuid'] == $_SESSION['domain_uuid']) { $stats['domain']['ivr_menus']['total']++; - $stats['domain']['ivr_menus']['disabled'] += ($row['ivr_menu_enabled'] != 'true') ? 1 : 0; + $stats['domain']['ivr_menus']['disabled'] += ($row['ivr_menu_enabled'] != true) ? 1 : 0; } } } @@ -185,15 +185,15 @@ $stats['system']['ring_groups']['disabled'] = 0; $stats['domain']['ring_groups']['total'] = 0; $stats['domain']['ring_groups']['disabled'] = 0; - $sql = "select domain_uuid, ring_group_enabled from v_ring_groups"; + $sql = "select domain_uuid, cast(ring_group_enabled as text) from v_ring_groups"; $result = $database->select($sql, null, 'all'); if (is_array($result) && sizeof($result) != 0) { $stats['system']['ring_groups']['total'] = sizeof($result); foreach ($result as $row) { - $stats['system']['ring_groups']['disabled'] += ($row['ring_group_enabled'] != 'true') ? 1 : 0; + $stats['system']['ring_groups']['disabled'] += ($row['ring_group_enabled'] != true) ? 1 : 0; if ($row['domain_uuid'] == $_SESSION['domain_uuid']) { $stats['domain']['ring_groups']['total']++; - $stats['domain']['ring_groups']['disabled'] += ($row['ring_group_enabled'] != 'true') ? 1 : 0; + $stats['domain']['ring_groups']['disabled'] += ($row['ring_group_enabled'] != true) ? 1 : 0; } } } @@ -211,10 +211,10 @@ if (is_array($result) && sizeof($result) != 0) { $stats['system']['voicemails']['total'] = sizeof($result); foreach ($result as $row) { - $stats['system']['voicemails']['disabled'] += ($row['voicemail_enabled'] != 'true') ? 1 : 0; + $stats['system']['voicemails']['disabled'] += ($row['voicemail_enabled'] != true) ? 1 : 0; if ($row['domain_uuid'] == $_SESSION['domain_uuid']) { $stats['domain']['voicemails']['total']++; - $stats['domain']['voicemails']['disabled'] += ($row['voicemail_enabled'] != 'true') ? 1 : 0; + $stats['domain']['voicemails']['disabled'] += ($row['voicemail_enabled'] != true) ? 1 : 0; } } } @@ -260,8 +260,8 @@ //get the domain active and inactive counts $sql = "select "; - $sql .= "(select count(domain_uuid) from v_domains where domain_enabled = 'true') as active, "; - $sql .= "(select count(domain_uuid) from v_domains where domain_enabled = 'false') as inactive; "; + $sql .= "(select count(domain_uuid) from v_domains where domain_enabled = true) as active, "; + $sql .= "(select count(domain_uuid) from v_domains where domain_enabled = false) as inactive; "; $row = $database->select($sql, null, 'row'); $domain_active = $row['active']; $domain_inactive = $row['inactive']; diff --git a/app/time_conditions/app_config.php b/app/time_conditions/app_config.php index 8cd1b9ed74..27c62cbe07 100644 --- a/app/time_conditions/app_config.php +++ b/app/time_conditions/app_config.php @@ -36,7 +36,7 @@ $apps[$x]['destinations'][$y]['label'] = "time_conditions"; $apps[$x]['destinations'][$y]['name'] = "time_conditions"; $apps[$x]['destinations'][$y]['sql'] = "select dialplan_uuid as time_condition_uuid, dialplan_uuid as uuid, dialplan_name as name, dialplan_number as destination, dialplan_number as extension, dialplan_context as context, dialplan_description as description from v_dialplans "; - $apps[$x]['destinations'][$y]['where'] = "where (domain_uuid = '\${domain_uuid}' or domain_uuid is null) and app_uuid = '4b821450-926b-175a-af93-a03c441818b1' and dialplan_enabled = 'true' "; + $apps[$x]['destinations'][$y]['where'] = "where (domain_uuid = '\${domain_uuid}' or domain_uuid is null) and app_uuid = '4b821450-926b-175a-af93-a03c441818b1' and dialplan_enabled = true "; $apps[$x]['destinations'][$y]['order_by'] = "natural_sort(dialplan_number) asc"; $apps[$x]['destinations'][$y]['field']['context'] = "context"; $apps[$x]['destinations'][$y]['field']['name'] = "dialplan_name"; diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index ef7ec58aca..9a0d66a9ac 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_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): @@ -80,7 +80,7 @@ if (permission_exists('time_condition_context')) { $dialplan_context = $_POST["dialplan_context"]; } - $dialplan_enabled = $_POST["dialplan_enabled"] ?? 'false'; + $dialplan_enabled = $_POST["dialplan_enabled"]; $dialplan_description = $_POST["dialplan_description"]; if (!permission_exists('time_condition_domain')) { @@ -662,7 +662,6 @@ //set the defaults if (empty($dialplan_context)) { $dialplan_context = $_SESSION['domain_name']; } - if (empty($dialplan_enabled)) { $dialplan_enabled = 'true'; } //create token $object = new token; @@ -1307,17 +1306,16 @@ if ($action == 'update') { echo " ".$text['label-enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo "\n"; @@ -1347,4 +1345,4 @@ if ($action == 'update') { //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/time_conditions/time_conditions.php b/app/time_conditions/time_conditions.php index d53a2c8755..8179fd3174 100644 --- a/app/time_conditions/time_conditions.php +++ b/app/time_conditions/time_conditions.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): @@ -100,8 +100,6 @@ $sql .= " lower(dialplan_context) like :search "; $sql .= " or lower(dialplan_name) like :search "; $sql .= " or lower(dialplan_number) like :search "; - $sql .= " or lower(dialplan_continue) like :search "; - $sql .= " or lower(dialplan_enabled) like :search "; $sql .= " or lower(dialplan_description) like :search "; $sql .= ") "; $parameters['search'] = '%'.$search.'%'; @@ -256,11 +254,11 @@ echo " ".escape($row['dialplan_order'])."\n"; if (permission_exists('time_condition_edit')) { echo " \n"; - echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['dialplan_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]); + echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.($row['dialplan_enabled'] ? 'true' : 'false')],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]); } else { echo " \n"; - echo $text['label-'.$row['dialplan_enabled']]; + echo $text['label-'.($row['dialplan_enabled'] ? 'true' : 'false')]; } echo " \n"; echo " ".$row['dialplan_description']." \n"; diff --git a/app/vars/app_config.php b/app/vars/app_config.php index 8fd7f1baa2..8d3c3efd51 100644 --- a/app/vars/app_config.php +++ b/app/vars/app_config.php @@ -84,7 +84,7 @@ $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "var_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "var_order"; diff --git a/app/vars/app_defaults.php b/app/vars/app_defaults.php index 48297dfe0d..fa632daa9f 100644 --- a/app/vars/app_defaults.php +++ b/app/vars/app_defaults.php @@ -146,7 +146,7 @@ if ($domains_processed == 1) { $array['vars'][$x]['var_name'] = 'default_country'; $array['vars'][$x]['var_value'] = $country["isocode"]; $array['vars'][$x]['var_category'] = 'Defaults'; - $array['vars'][$x]['var_enabled'] = 'true'; + $array['vars'][$x]['var_enabled'] = true; $array['vars'][$x]['var_order'] = $x; $array['vars'][$x]['var_description'] = null; $x++; @@ -165,7 +165,7 @@ if ($domains_processed == 1) { $array['vars'][$x]['var_name'] = 'default_countrycode'; $array['vars'][$x]['var_value'] = $country["countrycode"]; $array['vars'][$x]['var_category'] = 'Defaults'; - $array['vars'][$x]['var_enabled'] = 'true'; + $array['vars'][$x]['var_enabled'] = true; $array['vars'][$x]['var_order'] = $x; $array['vars'][$x]['var_description'] = null; $x++; @@ -184,7 +184,7 @@ if ($domains_processed == 1) { $array['vars'][$x]['var_name'] = 'default_exitcode'; $array['vars'][$x]['var_value'] = $country["exitcode"]; $array['vars'][$x]['var_category'] = 'Defaults'; - $array['vars'][$x]['var_enabled'] = 'true'; + $array['vars'][$x]['var_enabled'] = true; $array['vars'][$x]['var_order'] = $x; $array['vars'][$x]['var_description'] = null; $x++; diff --git a/app/vars/var_edit.php b/app/vars/var_edit.php index 2b7b73a09f..89ffd376b5 100644 --- a/app/vars/var_edit.php +++ b/app/vars/var_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-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -56,7 +56,6 @@ $var_value = ''; $var_command = ''; $var_hostname = ''; - $var_enabled = ''; $var_order = ''; $var_description = ''; @@ -67,7 +66,7 @@ $var_value = trim($_POST["var_value"]); $var_command = trim($_POST["var_command"]); $var_hostname = trim($_POST["var_hostname"]); - $var_enabled = trim($_POST["var_enabled"] ?? 'false'); + $var_enabled = $_POST["var_enabled"]; $var_order = trim($_POST["var_order"]); $var_description = trim($_POST["var_description"]); @@ -98,7 +97,7 @@ if (empty($var_name)) { $msg .= $text['message-required'].$text['label-name']."
\n"; } //if (empty($var_value)) { $msg .= $text['message-required'].$text['label-value']."
\n"; } //if (empty($var_command)) { $msg .= $text['message-required'].$text['label-command']."
\n"; } - if (empty($var_enabled)) { $msg .= $text['message-required'].$text['label-enabled']."
\n"; } + //if (empty($var_enabled)) { $msg .= $text['message-required'].$text['label-enabled']."
\n"; } if (empty($var_order)) { $msg .= $text['message-required'].$text['label-order']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -183,9 +182,6 @@ unset($sql, $parameters); } -//set the defaults - if (empty($var_enabled)) { $var_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -285,17 +281,16 @@ echo " ".$text['label-enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; diff --git a/app/vars/vars.php b/app/vars/vars.php index 02bb5f90c8..c0b528557d 100644 --- a/app/vars/vars.php +++ b/app/vars/vars.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): @@ -96,7 +96,7 @@ $sql .= " or lower(var_name) like :search "; $sql .= " or lower(var_value) like :search "; $sql .= " or lower(var_hostname) like :search "; - $sql .= " or lower(var_enabled) like :search "; + $sql .= " or lower(cast(var_enabled as text)) like :search "; $sql .= " or lower(var_description) like :search "; $sql .= ") "; $parameters['search'] = '%'.$search.'%'; @@ -114,7 +114,15 @@ $offset = $rows_per_page * $page; //get the list - $sql = "select * from v_vars "; + $sql = "select \n"; + $sql .= "var_uuid, \n"; + $sql .= "var_category, \n"; + $sql .= "var_name, \n"; + $sql .= "var_value, \n"; + $sql .= "var_hostname, \n"; + $sql .= "cast(var_enabled as text), \n"; + $sql .= "var_description \n"; + $sql .= "from v_vars "; if (!empty($_GET["search"])) { $search = strtolower($_GET["search"]); $sql .= "where ("; @@ -122,7 +130,7 @@ $sql .= " or lower(var_name) like :search "; $sql .= " or lower(var_value) like :search "; $sql .= " or lower(var_hostname) like :search "; - $sql .= " or lower(var_enabled) like :search "; + $sql .= " or lower(cast(var_enabled as text)) like :search "; $sql .= " or lower(var_description) like :search "; $sql .= ") "; $parameters['search'] = '%'.$search.'%'; @@ -286,5 +294,4 @@ //include the footer require_once "resources/footer.php"; -?> - +?> \ No newline at end of file diff --git a/app/voicemail_greetings/voicemail_greeting_edit.php b/app/voicemail_greetings/voicemail_greeting_edit.php index 858e2c5106..df6d91c005 100644 --- a/app/voicemail_greetings/voicemail_greeting_edit.php +++ b/app/voicemail_greetings/voicemail_greeting_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): @@ -41,13 +41,8 @@ $language = new text; $text = $language->get(); -//set the variables - $domain_uuid = $_SESSION['domain_uuid']; - $domain_name = $_SESSION['domain_name']; - $user_uuid = $_SESSION['user_uuid']; - //add the settings object - $settings = new settings(["domain_uuid" => $domain_uuid, "user_uuid" => $user_uuid]); + $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]); //as long as the class exists, enable speech using default settings $speech_enabled = class_exists('speech') && $settings->get('speech', 'enabled', false); @@ -68,7 +63,6 @@ if ($speech_enabled && !empty($speech_engine)) { $speech = new speech($settings); $voices = $speech->get_voices(); - $greeting_format = $speech->get_format(); //$speech_models = $speech->get_models(); //$translate_enabled = $speech->get_translate_enabled(); //$language_enabled = $speech->get_language_enabled(); @@ -162,8 +156,9 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $sql .= "from v_voicemail_greetings where domain_uuid = :domain_uuid "; $sql .= "and voicemail_id = :voicemail_id "; $sql .= "order by greeting_id asc "; - $parameters['domain_uuid'] = $domain_uuid; + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['voicemail_id'] = $voicemail_id; + $database = new database; $rows = $database->select($sql, $parameters, 'all'); $greeting_ids = array(); if (!empty($rows) && is_array($rows)) { @@ -177,7 +172,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $greeting_format = $greeting_format ?? 'wav'; //build the setting object and get the recording path - $greeting_path = $settings->get('switch', 'voicemail').'/default/'.$domain_name.'/'.$voicemail_id.'/'; + $greeting_path = $settings->get('switch', 'voicemail').'/default/'.$_SESSION['domain_name'].'/'.$voicemail_id.'/'; if ($action == 'add') { //find the next available greeting id @@ -198,6 +193,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { if ($speech_enabled && !empty($greeting_voice) && !empty($greeting_message)) { $speech->audio_path = $greeting_path; $speech->audio_filename = $greeting_filename; + $speech->audio_format = $greeting_format; //$speech->audio_model = $greeting_model ?? ''; $speech->audio_voice = $greeting_voice; //$speech->audio_language = $greeting_language; @@ -230,7 +226,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { //build data array $array['voicemail_greetings'][0]['voicemail_greeting_uuid'] = $voicemail_greeting_uuid; - $array['voicemail_greetings'][0]['domain_uuid'] = $domain_uuid; + $array['voicemail_greetings'][0]['domain_uuid'] = $_SESSION['domain_uuid']; $array['voicemail_greetings'][0]['voicemail_id'] = $voicemail_id; $array['voicemail_greetings'][0]['greeting_id'] = $greeting_id; $array['voicemail_greetings'][0]['greeting_name'] = $greeting_name; @@ -240,6 +236,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $array['voicemail_greetings'][0]['greeting_description'] = $greeting_description; //execute query + $database = new database; $database->app_name = 'voicemail_greetings'; $database->app_uuid = 'e4b4fbee-9e4d-8e46-3810-91ba663db0c2'; $database->save($array); @@ -257,12 +254,17 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { } //pre-populate the form - if ($action == 'update' && !empty($voicemail_greeting_uuid) && is_uuid($voicemail_greeting_uuid) && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) { + if ( + $action == 'update' && + !empty($voicemail_greeting_uuid) && is_uuid($voicemail_greeting_uuid) && + (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true") + ) { $sql = "select * from v_voicemail_greetings "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and voicemail_greeting_uuid = :voicemail_greeting_uuid "; - $parameters['domain_uuid'] = $domain_uuid; + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['voicemail_greeting_uuid'] = $voicemail_greeting_uuid; + $database = new database; $row = $database->select($sql, $parameters, 'row'); if (is_array($row) && @sizeof($row) != 0) { $greeting_id = $row["greeting_id"]; @@ -389,17 +391,16 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { echo " ".$text['label-translate']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-translate']."\n"; @@ -419,6 +420,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { echo "\n"; } + echo "\n"; echo "\n"; echo " ".$text['label-description']."\n"; diff --git a/app/voicemails/app_config.php b/app/voicemails/app_config.php index 6adc844b91..ef4384db37 100644 --- a/app/voicemails/app_config.php +++ b/app/voicemails/app_config.php @@ -441,6 +441,10 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the voicemail password."; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_tutorial"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "greeting_id"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select the greeting id."; @@ -450,11 +454,11 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Used to provide an alternate id for the voicemail announcement."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_recording_instructions"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_recording_options"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_mail_to"; @@ -467,7 +471,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the sms did to send voicemail to."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_transcription_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "If voicemail transcription is enabled for this user"; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_attach_file"; @@ -479,18 +483,18 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select a listening option to include with the email notification."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_local_after_email"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $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 the email."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_local_after_forward"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $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"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select to enable or disable this voicemail."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_description"; @@ -502,10 +506,6 @@ $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'] = "voicemail_tutorial"; - $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'] = "insert_date"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz'; $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date'; @@ -529,7 +529,6 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $y++; $apps[$x]['db'][$y]['table']['name'] = "v_voicemail_messages"; $apps[$x]['db'][$y]['table']['parent'] = "v_voicemails"; diff --git a/app/voicemails/app_defaults.php b/app/voicemails/app_defaults.php index 7532a6c230..b846cb8673 100644 --- a/app/voicemails/app_defaults.php +++ b/app/voicemails/app_defaults.php @@ -113,12 +113,12 @@ if ($domains_processed == 1) { unset($sql); //set default value of voicemail_recording_instructions to true - $sql = "update v_voicemails set voicemail_recording_instructions = 'true' where voicemail_recording_instructions is null"; + $sql = "update v_voicemails set voicemail_recording_instructions = true where voicemail_recording_instructions is null"; $database->execute($sql); unset($sql); //set default value of voicemail_recording_options to true - $sql = "update v_voicemails set voicemail_recording_options = 'true' where voicemail_recording_options is null"; + $sql = "update v_voicemails set voicemail_recording_options = true where voicemail_recording_options is null"; $database->execute($sql); unset($sql); diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index 98dfb71f10..28f99049c6 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -819,7 +819,7 @@ $sql .= " and template_category = 'voicemail' "; $sql .= " and template_subcategory = '".(!empty($message['message_transcription']) ? 'transcription' : 'default')."' "; $sql .= " and template_type = 'html' "; - $sql .= " and template_enabled = 'true' "; + $sql .= " and template_enabled = true "; $sql .= " and (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "limit 1 "; $parameters['template_language'] = $language_dialect; diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php index 0a092770ee..be44a23f98 100644 --- a/app/voicemails/voicemail_edit.php +++ b/app/voicemails/voicemail_edit.php @@ -101,15 +101,15 @@ $voicemail_alternate_greet_id = $_POST["voicemail_alternate_greet_id"]; $voicemail_mail_to = $_POST["voicemail_mail_to"]; $voicemail_sms_to = $_POST["voicemail_sms_to"] ?? null; - $voicemail_transcription_enabled = $_POST["voicemail_transcription_enabled"] ?? null; + $voicemail_transcription_enabled = $_POST["voicemail_transcription_enabled"]; $voicemail_file = $_POST["voicemail_file"]; - $voicemail_local_after_email = $_POST["voicemail_local_after_email"] ?? null; + $voicemail_local_after_email = $_POST["voicemail_local_after_email"]; $voicemail_destination = $_POST["voicemail_destination"]; - $voicemail_enabled = $_POST["voicemail_enabled"] ?? 'false'; + $voicemail_enabled = $_POST["voicemail_enabled"]; $voicemail_description = $_POST["voicemail_description"]; - $voicemail_tutorial = $_POST["voicemail_tutorial"] ?? null; - $voicemail_recording_instructions = $_POST["voicemail_recording_instructions"] ?? null; - $voicemail_recording_options = $_POST["voicemail_recording_options"] ?? null; + $voicemail_tutorial = $_POST["voicemail_tutorial"]; + $voicemail_recording_instructions = $_POST["voicemail_recording_instructions"]; + $voicemail_recording_options = $_POST["voicemail_recording_options"]; $voicemail_options_delete = $_POST["voicemail_options_delete"] ?? null; $voicemail_destinations_delete = $_POST["voicemail_destinations_delete"] ?? null; @@ -155,10 +155,12 @@ //get a new voicemail_uuid if ($action == "add" && permission_exists('voicemail_add')) { + //set the voicemail uuid $voicemail_uuid = uuid(); + //if adding a mailbox and don't have the transcription permission, set the default transcribe behavior if (!permission_exists('voicemail_transcription_enabled')) { - $voicemail_transcription_enabled = $settings->get('voicemail', 'transcription_enabled_default', false); + $voicemail_transcription_enabled = $settings->get('voicemail', 'transcription_enabled_default', false); } } @@ -172,18 +174,18 @@ $array['voicemails'][0]['voicemail_mail_to'] = $voicemail_mail_to; $array['voicemails'][0]['voicemail_sms_to'] = $voicemail_sms_to; $array['voicemails'][0]['voicemail_transcription_enabled'] = $voicemail_transcription_enabled; - $array['voicemails'][0]['voicemail_tutorial'] = $voicemail_tutorial ?? 'false'; + $array['voicemails'][0]['voicemail_tutorial'] = $voicemail_tutorial; if (permission_exists('voicemail_recording_instructions')) { - $array['voicemails'][0]['voicemail_recording_instructions'] = $voicemail_recording_instructions ?? 'false'; + $array['voicemails'][0]['voicemail_recording_instructions'] = $voicemail_recording_instructions; } if (permission_exists('voicemail_recording_options')) { - $array['voicemails'][0]['voicemail_recording_options'] = $voicemail_recording_options ?? 'false'; + $array['voicemails'][0]['voicemail_recording_options'] = $voicemail_recording_options; } if (permission_exists('voicemail_file')) { $array['voicemails'][0]['voicemail_file'] = $voicemail_file; } if (permission_exists('voicemail_local_after_email')) { - $array['voicemails'][0]['voicemail_local_after_email'] = $voicemail_local_after_email ?? 'false'; + $array['voicemails'][0]['voicemail_local_after_email'] = $voicemail_local_after_email; } $array['voicemails'][0]['voicemail_enabled'] = $voicemail_enabled; $array['voicemails'][0]['voicemail_description'] = $voicemail_description; @@ -241,7 +243,6 @@ } //execute insert/update - $database = new database; $database->app_name = 'voicemails'; $database->app_uuid = 'b523c2d2-64cd-46f1-9520-ca4b4098e044'; $database->save($array); @@ -331,12 +332,26 @@ //pre-populate the form if (!empty($_GET) && is_uuid($_GET["id"]) && empty($_POST["persistformvar"])) { $voicemail_uuid = $_GET["id"]; - $sql = "select * from v_voicemails "; + $sql = "select "; + $sql .= "voicemail_id, "; + $sql .= "voicemail_password, "; + $sql .= "greeting_id, "; + $sql .= "voicemail_alternate_greet_id, "; + $sql .= "voicemail_mail_to, "; + $sql .= "voicemail_sms_to, "; + $sql .= "voicemail_transcription_enabled, "; + $sql .= "voicemail_tutorial, "; + $sql .= "voicemail_recording_instructions, "; + $sql .= "voicemail_recording_options, "; + $sql .= "voicemail_file, "; + $sql .= "voicemail_local_after_email, "; + $sql .= "voicemail_enabled, "; + $sql .= "voicemail_description "; + $sql .= "from v_voicemails "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and voicemail_uuid = :voicemail_uuid "; $parameters['domain_uuid'] = $domain_uuid; $parameters['voicemail_uuid'] = $voicemail_uuid; - $database = new database; $row = $database->select($sql, $parameters, 'row'); if (!empty($row)) { $voicemail_id = $row["voicemail_id"]; @@ -367,12 +382,12 @@ } //set the defaults - if (empty($voicemail_local_after_email)) { $voicemail_local_after_email = 'true'; } - if (empty($voicemail_enabled)) { $voicemail_enabled = 'true'; } - if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $settings->get('voicemail', 'transcription_enabled_default', false); } - if (empty($voicemail_tutorial)) { $voicemail_tutorial = 'false'; } - if (empty($voicemail_recording_instructions)) { $voicemail_recording_instructions = 'true'; } - if (empty($voicemail_recording_options)) { $voicemail_recording_options = 'true'; } + if (!isset($voicemail_local_after_email)) { $voicemail_local_after_email = true; } + if (!isset($voicemail_enabled)) { $voicemail_enabled = $settings->get('voicemail', 'enabled_default', true); } + if (!isset($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $settings->get('voicemail', 'transcription_enabled_default', false); } + if (!isset($voicemail_tutorial)) { $voicemail_tutorial = false; } + if (!isset($voicemail_recording_instructions)) { $voicemail_recording_instructions = true; } + if (!isset($voicemail_recording_options)) { $voicemail_recording_options = true; } //get the greetings list $sql = "select * from v_voicemail_greetings "; @@ -381,7 +396,6 @@ $sql .= "order by greeting_name asc "; $parameters['domain_uuid'] = $domain_uuid; $parameters['voicemail_id'] = $voicemail_id; - $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (!empty($rows) && is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $row) { @@ -398,7 +412,6 @@ $sql .= "order by voicemail_option_digits, voicemail_option_order asc "; $parameters['domain_uuid'] = $domain_uuid; $parameters['voicemail_uuid'] = $voicemail_uuid; - $database = new database; $voicemail_options = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -430,12 +443,11 @@ $sql .= "from v_voicemails as v, v_voicemail_destinations as d "; $sql .= "where d.voicemail_uuid_copy = v.voicemail_uuid and "; $sql .= "v.domain_uuid = :domain_uuid and "; - $sql .= "v.voicemail_enabled = 'true' and "; + $sql .= "v.voicemail_enabled = true and "; $sql .= "d.voicemail_uuid = :voicemail_uuid "; $sql .= "order by v.voicemail_id asc"; $parameters['domain_uuid'] = $domain_uuid; $parameters['voicemail_uuid'] = $voicemail_uuid; - $database = new database; $voicemail_destinations_assigned = $database->select($sql, $parameters, 'all'); if (is_array($voicemail_destinations_assigned) && @sizeof($voicemail_destinations_assigned) != 0) { foreach ($voicemail_destinations_assigned as $field) { @@ -449,7 +461,7 @@ $sql = "select v.voicemail_id, v.voicemail_uuid "; $sql .= "from v_voicemails as v "; $sql .= "where v.domain_uuid = :domain_uuid and "; - $sql .= "v.voicemail_enabled = 'true' "; + $sql .= "v.voicemail_enabled = true "; if (is_uuid($voicemail_uuid ?? '')) { $sql .= "and v.voicemail_uuid <> :voicemail_uuid "; } @@ -461,7 +473,6 @@ if (!empty($voicemail_uuid) && is_uuid($voicemail_uuid)) { $parameters['voicemail_uuid'] = $voicemail_uuid; } - $database = new database; $voicemail_destinations_available = $database->select($sql, $parameters, 'all'); unset($sql, $parameters, $voicemail_destinations); @@ -583,17 +594,16 @@ echo " ".$text['label-voicemail_tutorial']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-voicemail_tutorial']."\n"; @@ -691,17 +701,16 @@ echo " ".$text['label-recording_instructions']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-recording_instructions']."\n"; @@ -715,17 +724,16 @@ echo " ".$text['label-recording_options']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-recording_options']."\n"; @@ -844,17 +852,16 @@ echo " ".$text['label-voicemail_transcription_enabled']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-voicemail_transcription_enabled']."\n"; @@ -885,17 +892,16 @@ echo " ".$text['label-voicemail_local_after_email']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-voicemail_local_after_email']."\n"; @@ -958,17 +964,16 @@ echo " ".$text['label-voicemail_enabled']."\n"; echo "\n"; echo "\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-voicemail_enabled']."\n"; @@ -1011,4 +1016,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/voicemails/voicemails.php b/app/voicemails/voicemails.php index ad6d6c1903..7d14bcab69 100644 --- a/app/voicemails/voicemails.php +++ b/app/voicemails/voicemails.php @@ -113,8 +113,8 @@ $sql_search = "and ("; $sql_search .= " lower(cast(voicemail_id as text)) like :search "; $sql_search .= " or lower(voicemail_mail_to) like :search "; - $sql_search .= " or lower(voicemail_local_after_email) like :search "; - $sql_search .= " or lower(voicemail_enabled) like :search "; + $sql_search .= " or lower(cast(voicemail_local_after_email as text)) like :search "; + $sql_search .= " or lower(cast(voicemail_enabled as text)) like :search "; $sql_search .= " or lower(voicemail_description) like :search "; $sql_search .= ") "; } @@ -161,7 +161,35 @@ $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(voicemail_uuid)', '*', $sql); + $sql = "select domain_uuid, voicemail_uuid, voicemail_id, voicemail_mail_to, voicemail_file, "; + $sql .= "cast(voicemail_local_after_email as text), cast(voicemail_transcription_enabled as text), cast(voicemail_enabled as text), voicemail_description "; + $sql .= "from v_voicemails "; + $sql .= "where true "; + $parameters = null; + if ($show != "all" || !permission_exists('voicemail_all')) { + $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + } + if (!permission_exists('voicemail_domain')) { + if (is_array($voicemail_uuids) && sizeof($voicemail_uuids) != 0) { + $sql .= "and ("; + foreach ($voicemail_uuids as $x => $row) { + $sql_where_or[] = 'voicemail_uuid = :voicemail_uuid_'.$x; + $parameters['voicemail_uuid_'.$x] = $row['voicemail_uuid']; + } + if (is_array($sql_where_or) && sizeof($sql_where_or) != 0) { + $sql .= implode(' or ', $sql_where_or); + } + $sql .= ")"; + } + else { + $sql .= "and voicemail_uuid is null "; + } + } + if (!empty($sql_search)) { + $sql .= $sql_search; + $parameters['search'] = '%'.$search.'%'; + } $sql .= order_by($order_by, $order, null, null, $sort); $sql .= limit_offset($rows_per_page, $offset); $voicemails = $database->select($sql, $parameters, 'all'); @@ -282,7 +310,7 @@ echo th_order_by('voicemail_file', $text['label-voicemail_file_attached'], $order_by, $order, null, "class='center hide-md-dn'"); echo th_order_by('voicemail_local_after_email', $text['label-voicemail_local_after_email'], $order_by, $order, null, "class='center hide-md-dn'"); if (permission_exists('voicemail_transcription_enabled') && $settings->get('transcribe', 'enabled', false) === true) { - echo th_order_by('voicemail_transcription_enabled', $text['label-voicemail_transcription_enabled'], $order_by, $order); + echo th_order_by('voicemail_transcription_enabled', $text['label-voicemail_transcription_enabled'], $order_by, $order, null, "class='center'"); } if (permission_exists('voicemail_message_view') || permission_exists('voicemail_greeting_view')) { echo "".$text['label-tools']."\n"; @@ -333,7 +361,7 @@ echo " ".($row['voicemail_file'] == 'attach' ? $text['label-true'] : $text['label-false'])."\n"; echo " ".ucwords(escape($row['voicemail_local_after_email']))." \n"; if (permission_exists('voicemail_transcription_enabled') && $settings->get('transcribe', 'enabled', false) === true) { - echo " ".ucwords(escape($row['voicemail_transcription_enabled']))." \n"; + echo " ".ucwords(escape($row['voicemail_transcription_enabled']))." \n"; } if (permission_exists('voicemail_message_view') || permission_exists('voicemail_greeting_view')) { echo " \n"; @@ -376,5 +404,3 @@ //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 553f6f3d07..95c5d4b1a8 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -158,7 +158,7 @@ if ($permission['xml_cdr_search_ring_groups']) { $sql = "select ring_group_uuid, ring_group_name, ring_group_extension from v_ring_groups "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ring_group_enabled = 'true' "; + $sql .= "and ring_group_enabled = true "; $sql .= "order by ring_group_extension asc "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $ring_groups = $database->select($sql, $parameters, 'all'); @@ -168,7 +168,7 @@ if ($permission['xml_cdr_search_ivr_menus']) { $sql = "select ivr_menu_uuid, ivr_menu_name, ivr_menu_extension from v_ivr_menus "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ivr_menu_enabled = 'true' "; + $sql .= "and ivr_menu_enabled = true "; $sql .= "order by ivr_menu_extension asc "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $ivr_menus = $database->select($sql, $parameters, 'all'); diff --git a/app/xml_cdr/xml_cdr_extension_summary.php b/app/xml_cdr/xml_cdr_extension_summary.php index 95335813f5..9bf82c9e0d 100644 --- a/app/xml_cdr/xml_cdr_extension_summary.php +++ b/app/xml_cdr/xml_cdr_extension_summary.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): @@ -47,7 +47,7 @@ $quick_select = $_REQUEST['quick_select']; $start_stamp_begin = $_REQUEST['start_stamp_begin']; $start_stamp_end = $_REQUEST['start_stamp_end']; - $include_internal = $_REQUEST['include_internal'] ?? '0'; + $include_internal = $_REQUEST['include_internal']; } else { $quick_select = 3; //set default @@ -154,17 +154,16 @@ echo " ".$text['label-include_internal']."\n"; echo " \n"; echo "
\n"; - if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; diff --git a/app/xml_cdr/xml_cdr_search.php b/app/xml_cdr/xml_cdr_search.php index 31dbe32516..9ab289f08c 100644 --- a/app/xml_cdr/xml_cdr_search.php +++ b/app/xml_cdr/xml_cdr_search.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2008-2024 + Copyright (C) 2008-2025 All Rights Reserved. Contributor(s): @@ -72,15 +72,13 @@ $sql .= "where domain_uuid = :domain_uuid "; $sql .= "order by extension asc, number_alias asc "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $database = new database; $extensions = $database->select($sql, $parameters, 'all'); - //get the ring groups if (permission_exists('xml_cdr_search_ring_groups')) { $sql = "select ring_group_uuid, ring_group_name, ring_group_extension from v_ring_groups "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ring_group_enabled = 'true' "; + $sql .= "and ring_group_enabled = true "; $sql .= "order by ring_group_extension asc "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $ring_groups = $database->select($sql, $parameters, 'all'); @@ -90,7 +88,7 @@ if (permission_exists('xml_cdr_search_ivr_menus')) { $sql = "select ivr_menu_uuid, ivr_menu_name, ivr_menu_extension from v_ivr_menus "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ivr_menu_enabled = 'true' "; + $sql .= "and ivr_menu_enabled = true "; $sql .= "order by ivr_menu_extension asc "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $ivr_menus = $database->select($sql, $parameters, 'all'); @@ -102,7 +100,6 @@ $sql .= "where domain_uuid = :domain_uuid "; $sql .= "order by queue_extension asc "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $database = new database; $call_center_queues = $database->select($sql, $parameters, 'all'); } @@ -257,17 +254,16 @@ echo " "; echo " ".$text['button-show_all'].""; echo " \n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " "; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo " "; echo " "; diff --git a/core/authentication/resources/classes/authentication.php b/core/authentication/resources/classes/authentication.php index 6934c4880a..e81532f845 100644 --- a/core/authentication/resources/classes/authentication.php +++ b/core/authentication/resources/classes/authentication.php @@ -327,7 +327,7 @@ class authentication { $sql = "select * from v_user_settings "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and user_uuid = :user_uuid "; - $sql .= "and user_setting_enabled = 'true' "; + $sql .= "and user_setting_enabled = true "; $parameters['domain_uuid'] = $result["domain_uuid"]; $parameters['user_uuid'] = $result["user_uuid"]; $user_settings = $database->select($sql, $parameters, 'all'); diff --git a/core/authentication/resources/classes/plugins/database.php b/core/authentication/resources/classes/plugins/database.php index 8bbf487c9a..36fc95d98c 100644 --- a/core/authentication/resources/classes/plugins/database.php +++ b/core/authentication/resources/classes/plugins/database.php @@ -212,20 +212,9 @@ class plugin_database { $sql .= " u.salt, "; $sql .= " u.api_key, "; $sql .= " u.domain_uuid "; - if ($contacts_exists) { - $sql .= ","; - $sql .= "c.contact_organization, "; - $sql .= "c.contact_name_given, "; - $sql .= "c.contact_name_family, "; - $sql .= "a.contact_attachment_uuid "; - } $sql .= "from "; $sql .= " v_domains as d, "; $sql .= " v_users as u "; - if ($contacts_exists) { - $sql .= "left join v_contacts as c on u.contact_uuid = c.contact_uuid and u.contact_uuid is not null "; - $sql .= "left join v_contact_attachments as a on u.contact_uuid = a.contact_uuid and u.contact_uuid is not null and a.attachment_primary = 1 and a.attachment_filename is not null and a.attachment_content is not null "; - } $sql .= "where "; $sql .= " u.domain_uuid = d.domain_uuid "; $sql .= " and ("; @@ -251,7 +240,7 @@ class plugin_database { $sql .= "and u.domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $this->domain_uuid; } - $sql .= "and (user_enabled = 'true' or user_enabled is null) "; + $sql .= "and (user_enabled = true or user_enabled is null) "; $row = $settings->database()->select($sql, $parameters, 'row'); if (!empty($row) && is_array($row) && @sizeof($row) != 0) { @@ -296,11 +285,29 @@ class plugin_database { $this->username = $row['username']; $this->user_email = $row['user_email']; $this->contact_uuid = $row['contact_uuid']; + + //get the user contact details if ($contacts_exists) { - $this->contact_organization = $row['contact_organization']; - $this->contact_name_given = $row['contact_name_given']; - $this->contact_name_family = $row['contact_name_family']; - $this->contact_image = $row['contact_attachment_uuid']; + $sql = "select "; + $sql .= " c.contact_organization, "; + $sql .= " c.contact_name_given, "; + $sql .= " c.contact_name_family, "; + $sql .= " a.contact_attachment_uuid, "; + $sql .= "from v_contacts as c "; + $sql .= "where contact_uuid = :contact_uuid "; + $sql .= "left join v_contact_attachments as a "; + $sql .= " on c.contact_uuid = a.contact_uuid "; + $sql .= "and a.attachment_primary = true "; + $sql .= "and a.attachment_filename is not null "; + $sql .= "and a.attachment_content is not null "; + $sql .= "and c.domain_uuid = :domain_uuid "; + $parameters['domain_uuid'] = $this->domain_uuid; + $parameters['contact_uuid'] = $this->contact_uuid; + $contact = $settings->database()->select($sql, $parameters, 'row'); + $this->contact_organization = $contact['contact_organization']; + $this->contact_name_given = $contact['contact_name_given']; + $this->contact_name_family = $contact['contact_name_family']; + $this->contact_image = $contact['contact_attachment_uuid']; } //debug info diff --git a/core/authentication/resources/classes/plugins/email.php b/core/authentication/resources/classes/plugins/email.php index aa0bfd4a38..48f2067652 100644 --- a/core/authentication/resources/classes/plugins/email.php +++ b/core/authentication/resources/classes/plugins/email.php @@ -222,7 +222,7 @@ class plugin_email { $sql .= "and template_category = :template_category "; $sql .= "and template_subcategory = :template_subcategory "; $sql .= "and template_type = :template_type "; - $sql .= "and template_enabled = 'true' "; + $sql .= "and template_enabled = true "; $parameters['domain_uuid'] = $_SESSION["domain_uuid"]; $parameters['template_language'] = $language_code; $parameters['template_category'] = 'authentication'; @@ -423,7 +423,7 @@ class plugin_email { $sql .= " v_users as u "; if ($contacts_exists) { $sql .= "left join v_contacts as c on u.contact_uuid = c.contact_uuid and u.contact_uuid is not null "; - $sql .= "left join v_contact_attachments as a on u.contact_uuid = a.contact_uuid and u.contact_uuid is not null and a.attachment_primary = 1 and a.attachment_filename is not null and a.attachment_content is not null "; + $sql .= "left join v_contact_attachments as a on u.contact_uuid = a.contact_uuid and u.contact_uuid is not null and a.attachment_primary = true and a.attachment_filename is not null and a.attachment_content is not null "; } $sql .= "where "; $sql .= " u.user_uuid = :user_uuid "; diff --git a/core/authentication/resources/classes/plugins/ldap.php b/core/authentication/resources/classes/plugins/ldap.php index de85f39089..81e97dd16a 100644 --- a/core/authentication/resources/classes/plugins/ldap.php +++ b/core/authentication/resources/classes/plugins/ldap.php @@ -169,7 +169,7 @@ class plugin_ldap { $array['users'][0]['salt'] = $salt; $array['users'][0]['add_date'] = now(); $array['users'][0]['add_user'] = strtolower($this->username); - $array['users'][0]['user_enabled'] = 'true'; + $array['users'][0]['user_enabled'] = true; //build user group insert array $array['user_groups'][0]['user_group_uuid'] = uuid(); diff --git a/core/authentication/resources/classes/plugins/totp.php b/core/authentication/resources/classes/plugins/totp.php index ccf7b8b410..aa0465315f 100644 --- a/core/authentication/resources/classes/plugins/totp.php +++ b/core/authentication/resources/classes/plugins/totp.php @@ -349,7 +349,7 @@ class plugin_totp { $sql .= " v_users as u "; if ($contacts_exists) { $sql .= "left join v_contacts as c on u.contact_uuid = c.contact_uuid and u.contact_uuid is not null "; - $sql .= "left join v_contact_attachments as a on u.contact_uuid = a.contact_uuid and u.contact_uuid is not null and a.attachment_primary = 1 and a.attachment_filename is not null and a.attachment_content is not null "; + $sql .= "left join v_contact_attachments as a on u.contact_uuid = a.contact_uuid and u.contact_uuid is not null and a.attachment_primary = true and a.attachment_filename is not null and a.attachment_content is not null "; } $sql .= "where "; $sql .= " u.user_uuid = :user_uuid "; diff --git a/core/contacts/app_config.php b/core/contacts/app_config.php index 4d127792e2..03d5862101 100644 --- a/core/contacts/app_config.php +++ b/core/contacts/app_config.php @@ -403,7 +403,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for an address."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "address_primary"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "address_street"; @@ -536,7 +536,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the extension."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_primary"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary number."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_description"; @@ -811,7 +811,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_setting_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_setting_description"; @@ -940,7 +940,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for the email address."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "email_primary"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "email_address"; @@ -1013,7 +1013,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for the url."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "url_primary"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "url_address"; @@ -1152,7 +1152,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "attachment_primary"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Primary attachments are used as the Contact photo and sent with Messages."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "attachment_filename"; diff --git a/core/contacts/contact_address_edit.php b/core/contacts/contact_address_edit.php index 4b559783ff..21d2fbf830 100644 --- a/core/contacts/contact_address_edit.php +++ b/core/contacts/contact_address_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): @@ -144,7 +144,7 @@ //if primary, unmark other primary addresses if ($email_primary) { - $sql = "update v_contact_addresses set address_primary = 0 "; + $sql = "update v_contact_addresses set address_primary = false "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and contact_uuid = :contact_uuid "; $parameters['domain_uuid'] = $domain_uuid; @@ -181,7 +181,7 @@ $array['contact_addresses'][0]['address_country'] = $address_country; $array['contact_addresses'][0]['address_latitude'] = $address_latitude; $array['contact_addresses'][0]['address_longitude'] = $address_longitude; - $array['contact_addresses'][0]['address_primary'] = $address_primary ? 1 : 0; + $array['contact_addresses'][0]['address_primary'] = $address_primary; $array['contact_addresses'][0]['address_description'] = $address_description; $database = new database; @@ -435,10 +435,17 @@ echo " ".$text['label-primary']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "
\n"; echo $text['description-address_primary']."\n"; echo "\n"; diff --git a/core/contacts/contact_attachment_edit.php b/core/contacts/contact_attachment_edit.php index 9876453650..22a253dc95 100644 --- a/core/contacts/contact_attachment_edit.php +++ b/core/contacts/contact_attachment_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): @@ -79,7 +79,7 @@ //unflag others as primary $allowed_primary_attachment = false; 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 = "update v_contact_attachments set attachment_primary = false "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and contact_uuid = :contact_uuid "; $parameters['domain_uuid'] = $domain_uuid; @@ -261,10 +261,17 @@ echo " ".$text['label-primary']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "\n"; echo "\n"; diff --git a/core/contacts/contact_edit.php b/core/contacts/contact_edit.php index 16244f7db6..8a7b9e7140 100644 --- a/core/contacts/contact_edit.php +++ b/core/contacts/contact_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) 2018-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. */ @@ -512,7 +512,7 @@ $array['contacts'][0]['contact_settings'][$y]['contact_setting_name'] = $row["contact_setting_name"]; $array['contacts'][0]['contact_settings'][$y]['contact_setting_value'] = $row["contact_setting_value"]; $array['contacts'][0]['contact_settings'][$y]['contact_setting_order'] = $row["contact_setting_order"]; - $array['contacts'][0]['contact_settings'][$y]['contact_setting_enabled'] = $row["contact_setting_enabled"] ?? 'false'; + $array['contacts'][0]['contact_settings'][$y]['contact_setting_enabled'] = $row["contact_setting_enabled"]; $array['contacts'][0]['contact_settings'][$y]['contact_setting_description'] = $row["contact_setting_description"]; $y++; } @@ -897,7 +897,7 @@ $contact_settings[$x]['contact_setting_name'] = ''; $contact_settings[$x]['contact_setting_value'] = ''; $contact_settings[$x]['contact_setting_order'] = ''; - $contact_settings[$x]['contact_setting_enabled'] = 'true'; + $contact_settings[$x]['contact_setting_enabled'] = true; $contact_settings[$x]['contact_setting_description'] = ''; } @@ -1712,7 +1712,7 @@ if (permission_exists('contact_phone_view')) { echo " \n"; echo " \n"; echo "
\n"; - if ($row['phone_primary'] == "1") { + if ($row['phone_primary'] === true) { echo " \n"; } echo "
\n"; @@ -1833,22 +1833,17 @@ if (permission_exists('contact_phone_view')) { echo " ".$text['label-primary']."\n"; echo " \n"; echo "
\n"; - - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($row['phone_primary'] == "0") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; //echo $text['description-phone_primary']."\n"; echo "
\n"; @@ -1905,7 +1900,7 @@ if (permission_exists('contact_address_view')) { echo " \n"; echo " \n"; echo "
\n"; - if ($row['address_primary'] == "1") { + if ($row['address_primary'] === true) { echo " \n"; } echo "
\n"; @@ -2096,21 +2091,17 @@ if (permission_exists('contact_address_view')) { echo " ".$text['label-primary']."\n"; echo " \n"; echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($row['address_primary'] == "0") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; echo "
\n"; @@ -2155,7 +2146,7 @@ if (permission_exists('contact_email_view')) { echo "
\n"; echo " \n"; echo "
\n"; - if ($row['email_primary'] == "1") { + if ($row['email_primary'] === true) { echo " \n"; } echo "
\n"; @@ -2182,21 +2173,17 @@ if (permission_exists('contact_email_view')) { echo " ".$text['label-primary']."\n"; echo " \n"; echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } - if ($row['email_primary'] == "0") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; //echo "
\n"; //echo $text['description-email_primary']."\n"; echo "
\n"; @@ -2248,7 +2235,7 @@ if (permission_exists('contact_url_view')) { echo " \n"; echo " \n"; echo "
\n"; - if ($row['url_primary'] == "1") { + if ($row['url_primary'] === true) { echo " \n"; } echo "
\n"; @@ -2303,34 +2290,29 @@ if (permission_exists('contact_url_view')) { echo " ".$text['label-primary']."\n"; echo " \n"; echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "
\n"; - echo "
\n"; echo " ".$text['label-url_description']."\n"; echo "
\n"; echo "
\n"; echo " \n"; echo "
\n"; - if (!empty($contact_urls) && @sizeof($contact_urls) > 1 && permission_exists('contact_url_delete')) { - if (is_uuid($row['contact_url_uuid'])) { - echo " \n"; - } - } + // if (!empty($contact_urls) && @sizeof($contact_urls) > 1 && permission_exists('contact_url_delete')) { + // if (is_uuid($row['contact_url_uuid'])) { + // echo " \n"; + // } + // } //echo "
\n"; //echo " ".$text['description-contact_organization']."\n"; echo "
\n"; @@ -2511,17 +2493,16 @@ if (permission_exists('contact_setting_view')) { echo " ".$text['label-enabled']."\n"; echo "
\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo "
\n"; @@ -2561,7 +2542,7 @@ if (permission_exists('contact_attachment_view')) { } echo "
\n"; echo "
\n"; - if ($row['attachment_primary'] == "1") { + if ($row['attachment_primary'] === true) { echo " \n"; } echo "
\n"; @@ -2614,10 +2595,17 @@ if (permission_exists('contact_attachment_view')) { echo " ".$text['label-primary']."\n"; echo " \n"; echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "
\n"; echo "
\n"; diff --git a/core/contacts/contact_email_edit.php b/core/contacts/contact_email_edit.php index 3b7fbbd21c..b9c76e5a3a 100644 --- a/core/contacts/contact_email_edit.php +++ b/core/contacts/contact_email_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): @@ -125,7 +125,7 @@ if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) { //if primary, unmark other primary emails if ($email_primary) { - $sql = "update v_contact_emails set email_primary = 0 "; + $sql = "update v_contact_emails set email_primary = false "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and contact_uuid = :contact_uuid "; $parameters['domain_uuid'] = $domain_uuid; @@ -291,10 +291,17 @@ if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) { echo " ".$text['label-primary']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "
\n"; echo $text['description-email_primary']."\n"; echo "\n"; diff --git a/core/contacts/contact_import_google.php b/core/contacts/contact_import_google.php index aebd791ff6..2065455561 100644 --- a/core/contacts/contact_import_google.php +++ b/core/contacts/contact_import_google.php @@ -80,7 +80,7 @@ if ($_POST['a'] == 'import') { $sql .= "and contact_setting_category = 'google' "; $sql .= "and contact_setting_subcategory = 'id' "; $sql .= "and contact_setting_value = :contact_setting_value "; - $sql .= "and contact_setting_enabled = 'true' "; + $sql .= "and contact_setting_enabled = true "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['contact_setting_value'] = $contact_id; $database = new database; diff --git a/core/contacts/contact_json.php b/core/contacts/contact_json.php index 92e26417b9..33cb7a9d33 100644 --- a/core/contacts/contact_json.php +++ b/core/contacts/contact_json.php @@ -57,7 +57,7 @@ $sql = "select *, "; $sql .= "( "; $sql .= " select a.contact_attachment_uuid from v_contact_attachments as a "; - $sql .= " where a.contact_uuid = c.contact_uuid and a.attachment_primary = 1 "; + $sql .= " where a.contact_uuid = c.contact_uuid and a.attachment_primary = true "; $sql .= ") as contact_attachment_uuid "; $sql .= "from v_contacts as c "; $sql .= "where true "; diff --git a/core/contacts/contact_phone_edit.php b/core/contacts/contact_phone_edit.php index 2b8420519f..ab8177d37f 100644 --- a/core/contacts/contact_phone_edit.php +++ b/core/contacts/contact_phone_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): @@ -145,7 +145,7 @@ //if primary, unmark other primary numbers if ($phone_primary) { - $sql = "update v_contact_phones set phone_primary = 0 "; + $sql = "update v_contact_phones set phone_primary = false "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and contact_uuid = :contact_uuid "; $parameters['domain_uuid'] = $domain_uuid; @@ -400,10 +400,17 @@ echo " ".$text['label-primary']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "
\n"; echo $text['description-phone_primary']."\n"; echo "\n"; diff --git a/core/contacts/contact_relation_edit.php b/core/contacts/contact_relation_edit.php index 1c94988b7f..e9cf92e89e 100644 --- a/core/contacts/contact_relation_edit.php +++ b/core/contacts/contact_relation_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): @@ -321,7 +321,7 @@ echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; @@ -332,10 +332,17 @@ echo " ".$text['label-contact_relation_reciprocal']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "
\n"; echo $text['description-contact_relation_reciprocal']."\n"; echo "\n"; diff --git a/core/contacts/contact_setting_edit.php b/core/contacts/contact_setting_edit.php index eae4fcecea..c8c31a224d 100644 --- a/core/contacts/contact_setting_edit.php +++ b/core/contacts/contact_setting_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): @@ -75,7 +75,7 @@ $contact_setting_name = strtolower($_POST["contact_setting_name"]); $contact_setting_value = $_POST["contact_setting_value"]; $contact_setting_order = $_POST["contact_setting_order"] ?? null; - $contact_setting_enabled = strtolower($_POST["contact_setting_enabled"]) ?? 'false'; + $contact_setting_enabled = strtolower($_POST["contact_setting_enabled"]) ?? false; $contact_setting_description = $_POST["contact_setting_description"]; } @@ -312,17 +312,16 @@ echo " ".$text['label-enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; diff --git a/core/contacts/contact_settings.php b/core/contacts/contact_settings.php index 3867c12f99..eba7244226 100644 --- a/core/contacts/contact_settings.php +++ b/core/contacts/contact_settings.php @@ -137,4 +137,3 @@ } ?> - diff --git a/core/contacts/contact_url_edit.php b/core/contacts/contact_url_edit.php index 7dc04ae86d..2746a891fd 100644 --- a/core/contacts/contact_url_edit.php +++ b/core/contacts/contact_url_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): @@ -128,7 +128,7 @@ //if primary, unmark other primary urls if ($url_primary) { - $sql = "update v_contact_urls set url_primary = 0 "; + $sql = "update v_contact_urls set url_primary = false "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and contact_uuid = :contact_uuid "; $parameters['domain_uuid'] = $domain_uuid; @@ -294,10 +294,17 @@ echo " ".$text['label-primary']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + } + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; + } echo "
\n"; echo $text['description-url_primary']."\n"; echo "\n"; diff --git a/core/contacts/contacts.php b/core/contacts/contacts.php index 8ffcdd4e92..46170eeb2d 100644 --- a/core/contacts/contacts.php +++ b/core/contacts/contacts.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): @@ -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 limit 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 = true limit 1) as contact_attachment_uuid "; $sql .= "from v_contacts as c "; $sql .= "where true "; if ($show != "all" || !permission_exists('contact_all')) { @@ -472,5 +472,3 @@ require_once "resources/footer.php"; ?> - - diff --git a/core/contacts/contacts_vcard.php b/core/contacts/contacts_vcard.php index f9434275df..4b55fc840e 100644 --- a/core/contacts/contacts_vcard.php +++ b/core/contacts/contacts_vcard.php @@ -94,7 +94,7 @@ if (!empty($_GET)) { $sql = "select url_address from v_contact_urls "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and contact_uuid = :contact_uuid "; - $sql .= "and url_primary = 1 "; + $sql .= "and url_primary = true "; $parameters['domain_uuid'] = $domain_uuid; $parameters['contact_uuid'] = $contact_uuid; $database = new database; diff --git a/core/dashboard/dashboard_edit.php b/core/dashboard/dashboard_edit.php index 9ad5e3a22d..22965b6d94 100644 --- a/core/dashboard/dashboard_edit.php +++ b/core/dashboard/dashboard_edit.php @@ -220,17 +220,16 @@ echo " ".$text['label-dashboard_enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-dashboard_enabled']."\n"; diff --git a/core/dashboard/dashboard_widget_edit.php b/core/dashboard/dashboard_widget_edit.php index ca2c5092ef..82050f7cbd 100644 --- a/core/dashboard/dashboard_widget_edit.php +++ b/core/dashboard/dashboard_widget_edit.php @@ -55,7 +55,7 @@ $widget_content_text_align = ''; $widget_content_details = ''; $widget_groups = []; - $widget_label_enabled = 'true'; + $widget_label_enabled = ''; $widget_label_text_color = ''; $widget_label_text_color_hover = ''; $widget_label_background_color = ''; @@ -67,7 +67,7 @@ $widget_details_state = ''; $widget_parent_uuid = ''; $widget_order = ''; - $widget_enabled = 'true'; + $widget_enabled = ''; $widget_description = ''; //action add or update @@ -96,7 +96,7 @@ $widget_content_details = $_POST["widget_content_details"] ?? ''; $widget_groups = $_POST["dashboard_widget_groups"] ?? ''; $widget_chart_type = $_POST["widget_chart_type"] ?? ''; - $widget_label_enabled = $_POST["widget_label_enabled"] ?? 'false'; + $widget_label_enabled = $_POST["widget_label_enabled"]; $widget_label_text_color = $_POST["widget_label_text_color"] ?? ''; $widget_label_text_color_hover = $_POST["widget_label_text_color_hover"] ?? ''; $widget_label_background_color = $_POST["widget_label_background_color"] ?? ''; @@ -114,7 +114,7 @@ $widget_details_state = $_POST["widget_details_state"] ?? ''; $widget_parent_uuid = $_POST["dashboard_widget_parent_uuid"] ?? ''; $widget_order = $_POST["widget_order"] ?? ''; - $widget_enabled = $_POST["widget_enabled"] ?? 'false'; + $widget_enabled = $_POST["widget_enabled"]; $widget_description = $_POST["widget_description"] ?? ''; //define the regex patterns @@ -357,7 +357,7 @@ $sql .= " widget_content_text_align, "; $sql .= " widget_content_details, "; $sql .= " widget_chart_type, "; - $sql .= " cast(widget_label_enabled as text), "; + $sql .= " widget_label_enabled, "; $sql .= " widget_label_text_color, "; $sql .= " widget_label_text_color_hover, "; $sql .= " widget_label_background_color, "; @@ -626,7 +626,7 @@ $items_to_remove[] = 'widget_width'; $items_to_remove[] = 'widget_height'; } - if ($widget_label_enabled == "false") { + if ($widget_label_enabled === false) { $items_to_remove[] = 'widget_label_text_color'; $items_to_remove[] = 'widget_label_text_color_hover'; $items_to_remove[] = 'widget_label_background_color'; @@ -763,6 +763,7 @@ document.addEventListener('DOMContentLoaded', function() { document.getElementById('widget_url').addEventListener('change', adjust_form_url); document.getElementById('widget_target').addEventListener('change', adjust_form_url); document.getElementById('widget_label_enabled').addEventListener('change', toggle_label_settings); + document.querySelector('.switch:has(#widget_label_enabled)').addEventListener('click', toggle_label_settings); }); @@ -1062,17 +1063,16 @@ document.addEventListener('DOMContentLoaded', function() { echo "\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-widget_label_enabled']."\n"; @@ -1386,17 +1386,16 @@ document.addEventListener('DOMContentLoaded', function() { echo " ".$text['label-widget_enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-widget_enabled']."\n"; diff --git a/core/dashboard/index.php b/core/dashboard/index.php index 7c823b4aa2..4f52b4d291 100644 --- a/core/dashboard/index.php +++ b/core/dashboard/index.php @@ -53,7 +53,7 @@ unset($_SESSION['login']['message']['text']); $sql = "update v_default_settings "; - $sql .= "set default_setting_enabled = 'false' "; + $sql .= "set default_setting_enabled = false "; $sql .= "where "; $sql .= "default_setting_category = 'login' "; $sql .= "and default_setting_subcategory = 'message' "; @@ -75,7 +75,7 @@ //get the dashboard uuid $sql = "select dashboard_uuid "; $sql .= "from v_dashboards "; - $sql .= "where dashboard_enabled = 'true' "; + $sql .= "where dashboard_enabled = true "; $sql .= "and ("; $sql .= " domain_uuid = :domain_uuid "; $sql .= " or domain_uuid is null "; @@ -127,7 +127,7 @@ $sql .= "cast(widget_enabled as text), "; $sql .= "widget_description "; $sql .= "from v_dashboard_widgets as d "; - $sql .= "where widget_enabled = 'true' "; + $sql .= "where widget_enabled = true "; $sql .= "and dashboard_widget_uuid in ( "; $sql .= " select dashboard_widget_uuid from v_dashboard_widget_groups where group_uuid in ( "; $sql .= " ".$group_uuids_in." "; @@ -322,7 +322,7 @@ foreach ($widgets as $row) { echo " color: ".$row['widget_icon_color'].";\n"; echo "}\n"; } - if ($row['widget_label_enabled'] == 'false' && $row['widget_path'] != 'dashboard/parent') { + if ($row['widget_label_enabled'] === false && $row['widget_path'] != 'dashboard/parent') { echo "#".$widget_id." .hud_title:first-of-type {\n"; echo " display: none;\n"; echo "}\n"; diff --git a/core/default_settings/app_languages.php b/core/default_settings/app_languages.php index 405a9938c5..b135e4f3be 100644 --- a/core/default_settings/app_languages.php +++ b/core/default_settings/app_languages.php @@ -270,33 +270,32 @@ $text['option-button_icons_never']['zh-cn'] = "绝不"; $text['option-button_icons_never']['ja-jp'] = "一度もない"; $text['option-button_icons_never']['ko-kr'] = "절대"; -$text['option-select']['en-us'] = "Select"; -$text['option-select']['en-gb'] = "Select"; -$text['option-select']['ar-eg'] = "يختار"; -$text['option-select']['de-at'] = "Auswählen"; -$text['option-select']['de-ch'] = "Auswählen"; -$text['option-select']['de-de'] = "Auswählen"; -$text['option-select']['el-gr'] = "Επιλέξτε"; -$text['option-select']['es-cl'] = "Seleccionar"; -$text['option-select']['es-mx'] = "Seleccionar"; -$text['option-select']['fr-ca'] = "Sélectionner"; -$text['option-select']['fr-fr'] = "Sélectionner"; -$text['option-select']['he-il'] = "בחר"; -$text['option-select']['it-it'] = "Selezionare"; -$text['option-select']['ka-ge'] = "არჩევა"; -$text['option-select']['nl-nl'] = "selectie"; -$text['option-select']['pl-pl'] = "Wybierz"; -$text['option-select']['pt-br'] = "Selecionar"; -$text['option-select']['pt-pt'] = "Selecionar"; -$text['option-select']['ro-ro'] = "Selectați"; -$text['option-select']['ru-ru'] = "Выбирать"; -$text['option-select']['sv-se'] = "Välj"; -$text['option-select']['uk-ua'] = "Виберіть"; -$text['option-select']['tr-tr'] = "Seç"; -$text['option-select']['tr-tr'] = "Seçme"; -$text['option-select']['zh-cn'] = "选择"; -$text['option-select']['ja-jp'] = "選択する"; -$text['option-select']['ko-kr'] = "선택하다"; +$text['option-select_box']['en-us'] = "Select Box"; +$text['option-select_box']['en-gb'] = "Select Box"; +$text['option-select_box']['ar-eg'] = "حدد المربع"; +$text['option-select_box']['de-at'] = "Auswahlfeld"; +$text['option-select_box']['de-ch'] = "Auswahlfeld"; +$text['option-select_box']['de-de'] = "Auswahlfeld"; +$text['option-select_box']['el-gr'] = "Επιλογή πλαισίου"; +$text['option-select_box']['es-cl'] = "Cuadro de selección"; +$text['option-select_box']['es-mx'] = "Cuadro de selección"; +$text['option-select_box']['fr-ca'] = "Boîte de sélection"; +$text['option-select_box']['fr-fr'] = "Boîte de sélection"; +$text['option-select_box']['he-il'] = "בחר תיבה"; +$text['option-select_box']['it-it'] = "Seleziona casella"; +$text['option-select_box']['ka-ge'] = "აირჩიეთ ველი"; +$text['option-select_box']['nl-nl'] = "Selecteer vak"; +$text['option-select_box']['pl-pl'] = "Wybierz pole"; +$text['option-select_box']['pt-br'] = "Caixa de seleção"; +$text['option-select_box']['pt-pt'] = "Caixa de seleção"; +$text['option-select_box']['ro-ro'] = "Selectați caseta"; +$text['option-select_box']['ru-ru'] = "Выбрать поле"; +$text['option-select_box']['sv-se'] = "Välj ruta"; +$text['option-select_box']['uk-ua'] = "Виберіть поле"; +$text['option-select_box']['tr-tr'] = "Seçim Kutusu"; +$text['option-select_box']['zh-cn'] = "选择框"; +$text['option-select_box']['ja-jp'] = "選択ボックス"; +$text['option-select_box']['ko-kr'] = "선택 상자"; $text['option-switch_round']['en-us'] = "Round Switch"; $text['option-switch_round']['en-gb'] = "Round Switch"; diff --git a/core/default_settings/default_setting_edit.php b/core/default_settings/default_setting_edit.php index 1bdb4040d9..2b4ce4d2ff 100644 --- a/core/default_settings/default_setting_edit.php +++ b/core/default_settings/default_setting_edit.php @@ -75,7 +75,7 @@ $default_setting_name = strtolower($_POST["default_setting_name"] ?? ''); $default_setting_value = $_POST["default_setting_value"] ?? ''; $default_setting_order = $_POST["default_setting_order"] ?? ''; - $default_setting_enabled = $_POST["default_setting_enabled"] ?? 'false'; + $default_setting_enabled = $_POST["default_setting_enabled"]; $default_setting_description = $_POST["default_setting_description"] ?? ''; } @@ -250,7 +250,7 @@ //pre-populate the form if (count($_GET) > 0 && empty($_POST["persistformvar"])) { $default_setting_uuid = $_GET["id"] ?? ''; - $sql = "select default_setting_uuid, default_setting_category, default_setting_subcategory, default_setting_name, default_setting_value, default_setting_order, cast(default_setting_enabled as text), default_setting_description "; + $sql = "select default_setting_uuid, default_setting_category, default_setting_subcategory, default_setting_name, default_setting_value, default_setting_order, default_setting_enabled, default_setting_description "; $sql .= "from v_default_settings "; $sql .= "where default_setting_uuid = :default_setting_uuid "; $parameters['default_setting_uuid'] = $default_setting_uuid; @@ -267,9 +267,6 @@ unset($sql, $parameters); } -//set the defaults - if (empty($default_setting_enabled)) { $default_setting_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -689,7 +686,7 @@ } elseif ($category == "theme" && $subcategory == "input_toggle_style" && $name == "text" ) { echo " \n"; @@ -770,6 +767,7 @@ echo "\n"; echo "\n"; echo "\n"; + echo "
\n"; echo "\n"; echo "\n"; @@ -799,23 +797,23 @@ echo "\n"; echo "
\n"; echo "
\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; diff --git a/core/user_settings/user_settings.php b/core/user_settings/user_settings.php index 66feb959c5..de69b0e937 100644 --- a/core/user_settings/user_settings.php +++ b/core/user_settings/user_settings.php @@ -336,7 +336,12 @@ echo " ".$text['option-'.$row['user_setting_value']]."\n"; } else if ($category == 'theme' && $subcategory == 'input_toggle_style' && $name == 'text') { - echo " ".$text['option-'.$row['user_setting_value']]."\n"; + if ($row['user_setting_value'] == 'select') { + echo " ".$text['option-select_box']."\n"; + } + else { + echo " ".$text['option-'.$row['user_setting_value']]."\n"; + } } else if ($category == "theme" && substr_count($subcategory, "_color") > 0 && ($name == "text" || $name == 'array')) { echo " ".(img_spacer('15px', '15px', 'background: '.escape($row['user_setting_value']).'; margin-right: 4px; vertical-align: middle; border: 1px solid '.(color_adjust($row['user_setting_value'], -0.18)).'; padding: -1px;')); diff --git a/core/users/app_config.php b/core/users/app_config.php index be4958faca..be44a1202e 100644 --- a/core/users/app_config.php +++ b/core/users/app_config.php @@ -273,7 +273,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "user_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['toggle'] = ['true','false']; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; diff --git a/core/users/app_defaults.php b/core/users/app_defaults.php index 66968669be..70e1f1b044 100644 --- a/core/users/app_defaults.php +++ b/core/users/app_defaults.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): @@ -110,7 +110,7 @@ if ($domains_processed == 1) { $sql .= " from v_users as u, v_contact_emails as e "; $sql .= " where u.contact_uuid is not null "; $sql .= " and u.contact_uuid = e.contact_uuid "; - $sql .= " and e.email_primary = 1 "; + $sql .= " and e.email_primary = true "; $sql .= ") "; $sql .= "update v_users "; $sql .= "set user_email = users.email_address "; @@ -195,7 +195,7 @@ if ($domains_processed == 1) { $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = 'Default password reset email template.'; $x++; diff --git a/core/users/resources/database/views/users.php b/core/users/resources/database/views/users.php new file mode 100644 index 0000000000..a743e00f3b --- /dev/null +++ b/core/users/resources/database/views/users.php @@ -0,0 +1,40 @@ + - 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): @@ -138,7 +138,7 @@ } $group_uuid_name = $_POST["group_uuid_name"]; $user_type = $_POST["user_type"]; - $user_enabled = $_POST["user_enabled"] ?? 'false'; + $user_enabled = $_POST["user_enabled"]; if (permission_exists('api_key')) { $api_key = $_POST["api_key"]; } @@ -619,7 +619,7 @@ //populate the form with values from db if ($action == 'edit') { $sql = "select domain_uuid, user_uuid, username, user_email, api_key, user_totp_secret, "; - $sql .= "user_type, user_enabled, contact_uuid, cast(user_enabled as text), user_status "; + $sql .= "user_type, contact_uuid, user_enabled, user_status "; $sql .= "from v_users "; $sql .= "where user_uuid = :user_uuid "; if (!permission_exists('user_all')) { @@ -652,7 +652,7 @@ //get user settings $sql = "select * from v_user_settings "; $sql .= "where user_uuid = :user_uuid "; - $sql .= "and user_setting_enabled = 'true' "; + $sql .= "and user_setting_enabled = true "; $parameters['user_uuid'] = $user_uuid; $result = $database->select($sql, $parameters, 'all'); if (is_array($result)) { @@ -674,7 +674,6 @@ } //set the defaults - if (empty($user_enabled)) { $user_enabled = "true"; } if (empty($user_totp_secret)) { $user_totp_secret = ""; } //create token @@ -1210,17 +1209,16 @@ echo " ".$text['label-enabled']."\n"; echo "\n"; echo "
\n"; echo " ".$text['label-enabled']."\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; diff --git a/core/default_settings/default_settings.php b/core/default_settings/default_settings.php index d071a01115..e836c612a4 100644 --- a/core/default_settings/default_settings.php +++ b/core/default_settings/default_settings.php @@ -548,7 +548,12 @@ echo " ".$text['option-'.$row['default_setting_value']]."\n"; } else if ($category == 'theme' && $subcategory == 'input_toggle_style' && $name == 'text') { - echo " ".$text['option-'.$row['default_setting_value']]."\n"; + if ($row['default_setting_value'] == 'select') { + echo " ".$text['option-select_box']."\n"; + } + else { + echo " ".$text['option-'.$row['default_setting_value']]."\n"; + } } else if (substr_count($subcategory, "_color") > 0 && ($name == "text" || $name == 'array')) { echo " ".(img_spacer('15px', '15px', 'background: '.escape($row['default_setting_value']).'; margin-right: 4px; vertical-align: middle; border: 1px solid '.(color_adjust($row['default_setting_value'], -0.18)).'; padding: -1px;')); diff --git a/core/domain_settings/app_languages.php b/core/domain_settings/app_languages.php index 0773e8cb01..49e86a52d9 100644 --- a/core/domain_settings/app_languages.php +++ b/core/domain_settings/app_languages.php @@ -216,32 +216,32 @@ $text['message-delete_failed']['zh-cn'] = "未检查设置"; $text['message-delete_failed']['ja-jp'] = "設定はチェックされていません"; $text['message-delete_failed']['ko-kr'] = "선택한 설정 없음"; -$text['option-select']['en-us'] = "Select"; -$text['option-select']['en-gb'] = "Select"; -$text['option-select']['ar-eg'] = "يختار"; -$text['option-select']['de-at'] = "Auswählen"; -$text['option-select']['de-ch'] = "Auswählen"; -$text['option-select']['de-de'] = "Auswählen"; -$text['option-select']['el-gr'] = "Επιλέξτε"; -$text['option-select']['es-cl'] = "Seleccionar"; -$text['option-select']['es-mx'] = "Seleccionar"; -$text['option-select']['fr-ca'] = "Sélectionner"; -$text['option-select']['fr-fr'] = "Sélectionner"; -$text['option-select']['he-il'] = "בחר"; -$text['option-select']['it-it'] = "Selezionare"; -$text['option-select']['ka-ge'] = "აირჩიეთ"; -$text['option-select']['nl-nl'] = "Selecteer"; -$text['option-select']['pl-pl'] = "Wybierz"; -$text['option-select']['pt-br'] = "Selecionar"; -$text['option-select']['pt-pt'] = "Selecionar"; -$text['option-select']['ro-ro'] = "Selectați"; -$text['option-select']['ru-ru'] = "Выбрать"; -$text['option-select']['sv-se'] = "Välj"; -$text['option-select']['uk-ua'] = "Виберіть"; -$text['option-select']['tr-tr'] = "Seçme"; -$text['option-select']['zh-cn'] = "选择"; -$text['option-select']['ja-jp'] = "選択する"; -$text['option-select']['ko-kr'] = "선택하다"; +$text['option-select_box']['en-us'] = "Select Box"; +$text['option-select_box']['en-gb'] = "Select Box"; +$text['option-select_box']['ar-eg'] = "حدد المربع"; +$text['option-select_box']['de-at'] = "Auswahlfeld"; +$text['option-select_box']['de-ch'] = "Auswahlfeld"; +$text['option-select_box']['de-de'] = "Auswahlfeld"; +$text['option-select_box']['el-gr'] = "Επιλογή πλαισίου"; +$text['option-select_box']['es-cl'] = "Cuadro de selección"; +$text['option-select_box']['es-mx'] = "Cuadro de selección"; +$text['option-select_box']['fr-ca'] = "Boîte de sélection"; +$text['option-select_box']['fr-fr'] = "Boîte de sélection"; +$text['option-select_box']['he-il'] = "בחר תיבה"; +$text['option-select_box']['it-it'] = "Seleziona casella"; +$text['option-select_box']['ka-ge'] = "აირჩიეთ ველი"; +$text['option-select_box']['nl-nl'] = "Selecteer vak"; +$text['option-select_box']['pl-pl'] = "Wybierz pole"; +$text['option-select_box']['pt-br'] = "Caixa de seleção"; +$text['option-select_box']['pt-pt'] = "Caixa de seleção"; +$text['option-select_box']['ro-ro'] = "Selectați caseta"; +$text['option-select_box']['ru-ru'] = "Выбрать поле"; +$text['option-select_box']['sv-se'] = "Välj ruta"; +$text['option-select_box']['uk-ua'] = "Виберіть поле"; +$text['option-select_box']['tr-tr'] = "Seçim Kutusu"; +$text['option-select_box']['zh-cn'] = "选择框"; +$text['option-select_box']['ja-jp'] = "選択ボックス"; +$text['option-select_box']['ko-kr'] = "선택 상자"; $text['option-switch_round']['en-us'] = "Round Switch"; $text['option-switch_round']['en-gb'] = "Round Switch"; diff --git a/core/domain_settings/domain_setting_edit.php b/core/domain_settings/domain_setting_edit.php index 8395001f5d..b8cf21cdb5 100644 --- a/core/domain_settings/domain_setting_edit.php +++ b/core/domain_settings/domain_setting_edit.php @@ -84,7 +84,7 @@ $domain_setting_name = strtolower($_POST["domain_setting_name"]); $domain_setting_value = $_POST["domain_setting_value"]; $domain_setting_order = $_POST["domain_setting_order"]; - $domain_setting_enabled = strtolower($_POST["domain_setting_enabled"] ?? 'false'); + $domain_setting_enabled = $_POST["domain_setting_enabled"]; $domain_setting_description = $_POST["domain_setting_description"]; } @@ -116,7 +116,6 @@ if (empty($domain_setting_name)) { $msg .= $text['message-required'].$text['label-type']."
\n"; } //if (empty($domain_setting_value)) { $msg .= $text['message-required'].$text['label-value']."
\n"; } if (empty($domain_setting_order)) { $msg .= $text['message-required'].$text['label-order']."
\n"; } - if (empty($domain_setting_enabled)) { $msg .= $text['message-required'].$text['label-enabled']."
\n"; } //if (empty($domain_setting_description)) { $msg .= $text['message-required'].$text['label-description']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -330,7 +329,15 @@ //pre-populate the form if (empty($_POST["persistformvar"]) && !empty($_GET["id"]) && is_uuid($_GET["id"])) { $domain_setting_uuid = $_GET["id"]; - $sql = "select domain_setting_uuid, domain_setting_category, domain_setting_subcategory, domain_setting_name, domain_setting_value, domain_setting_order, cast(domain_setting_enabled as text), domain_setting_description "; + $sql = "select "; + $sql .= "domain_setting_uuid, "; + $sql .= "domain_setting_category, "; + $sql .= "domain_setting_subcategory, "; + $sql .= "domain_setting_name, "; + $sql .= "domain_setting_value, "; + $sql .= "domain_setting_order, "; + $sql .= "domain_setting_enabled, "; + $sql .= "domain_setting_description "; $sql .= "from v_domain_settings "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and domain_setting_uuid = :domain_setting_uuid "; @@ -355,7 +362,6 @@ $domain_setting_name = $domain_setting_name ?? ''; $domain_setting_value = $domain_setting_value ?? ''; $domain_setting_order = $domain_setting_order ?? ''; - $domain_setting_enabled = $domain_setting_enabled ?? 'true'; $domain_setting_description = $domain_setting_description ?? ''; //create token @@ -718,7 +724,7 @@ } elseif ($category == "theme" && $subcategory == "input_toggle_style" && $name == "text" ) { echo " \n"; @@ -830,17 +836,16 @@ echo " ".$text['label-enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-setting_enabled']."\n"; diff --git a/core/domain_settings/domain_settings.php b/core/domain_settings/domain_settings.php index e453c7902f..3ede27278e 100644 --- a/core/domain_settings/domain_settings.php +++ b/core/domain_settings/domain_settings.php @@ -339,7 +339,12 @@ echo " ".$text['option-'.$row['domain_setting_value']]."\n"; } else if ($category == 'theme' && $subcategory == 'input_toggle_style' && $name == 'text') { - echo " ".$text['option-'.$row['domain_setting_value']]."\n"; + if ($row['domain_setting_value'] == 'select') { + echo " ".$text['option-select_box']."\n"; + } + else { + echo " ".$text['option-'.$row['domain_setting_value']]."\n"; + } } else if ($category == "theme" && substr_count($subcategory, "_color") > 0 && ($name == "text" || $name == 'array')) { echo " ".(img_spacer('15px', '15px', 'background: '.escape($row['domain_setting_value']).'; margin-right: 4px; vertical-align: middle; border: 1px solid '.(color_adjust($row['domain_setting_value'], -0.18)).'; padding: -1px;')); diff --git a/core/domains/app_defaults.php b/core/domains/app_defaults.php index bd79c2fc41..951a1ab664 100644 --- a/core/domains/app_defaults.php +++ b/core/domains/app_defaults.php @@ -28,7 +28,7 @@ if ($domains_processed == 1) { //set domain enable to true - $sql = "update v_domains set domain_enabled = 'true' "; + $sql = "update v_domains set domain_enabled = true "; $sql .= "where domain_enabled is null "; $database->execute($sql, null); unset($sql); diff --git a/core/domains/domain_edit.php b/core/domains/domain_edit.php index ca409df5eb..c665711410 100644 --- a/core/domains/domain_edit.php +++ b/core/domains/domain_edit.php @@ -38,9 +38,6 @@ exit; } -//connect to the database - $database = new database; - //add multi-lingual support $language = new text; $text = $language->get(); @@ -50,7 +47,7 @@ $domain_description = ''; //action add or update - if (!permission_exists('domain_add') || (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/") && !permission_exists('domain_all'))) { + if (!permission_exists('domain_add') || (file_exists(dirname(__DIR__, 2)."/app/domains/") && !permission_exists('domain_all'))) { //admin editing own domain/settings $domain_uuid = $_SESSION['domain_uuid']; $action = "update"; @@ -68,7 +65,7 @@ //get http post variables and set them to php variables if (!empty($_POST)) { $domain_name = strtolower($_POST["domain_name"]); - $domain_enabled = $_POST["domain_enabled"] ?? 'false'; + $domain_enabled = $_POST["domain_enabled"]; $domain_description = $_POST["domain_description"]; } @@ -133,8 +130,7 @@ if ($num_rows == 0) { - //add the domain name - $domain_enabled = 'true'; + //add the domain uuid $domain_uuid = uuid(); //build the domain array @@ -152,7 +148,7 @@ $database->save($array); //add dialplans to the domain - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/dialplans/app_config.php")) { //import the dialplans $dialplan = new dialplan; $dialplan->import($domain_array['domains']); @@ -209,7 +205,7 @@ $database->save($array); //add dialplans to the domain - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/dialplans/app_config.php")) { //import the dialplans $dialplan = new dialplan; $dialplan->import($array['domains'] ?? null); @@ -227,7 +223,7 @@ if ($original_domain_name != $domain_name) { //update dialplans - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/dialplans/app_config.php")) { $sql = "update v_dialplans set "; $sql .= "dialplan_context = replace(dialplan_context, :domain_name_old, :domain_name_new), "; $sql .= "dialplan_xml = replace(dialplan_xml, :domain_name_old, :domain_name_new) "; @@ -249,7 +245,7 @@ } //update destinations - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/destinations/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/destinations/app_config.php")) { $sql = "update v_destinations set "; $sql .= "destination_data = replace(destination_data, :destination_data_old, :destination_data_new), "; $sql .= "destination_conditions = replace(destination_conditions::text, :destination_data_old, :destination_data_new)::json, "; @@ -263,7 +259,7 @@ } //update extensions (accountcode, user_context, dial_domain) - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/extensions/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/extensions/app_config.php")) { $sql = "update v_extensions set "; $sql .= "user_context = replace(user_context, :domain_name_old, :domain_name_new), "; $sql .= "accountcode = replace(accountcode, :domain_name_old, :domain_name_new), "; @@ -277,7 +273,7 @@ } //update ivr_menus (ivr_menu_context, ivr_menu_greet_long, ivr_menu_greet_short) and ivr_menu_options (ivr_menu_option_param) - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ivr_menus/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/ivr_menus/app_config.php")) { $sql = "update v_ivr_menus set "; $sql .= "ivr_menu_context = replace(ivr_menu_context, :domain_name_old, :domain_name_new), "; $sql .= "ivr_menu_greet_long = replace(ivr_menu_greet_long, :domain_name_old, :domain_name_new), "; @@ -300,7 +296,7 @@ } //update ring_groups (ring_group_context, ring_group_forward_destination, ring_group_timeout_data) - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ring_groups/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/ring_groups/app_config.php")) { $sql = "update v_ring_groups set "; $sql .= "ring_group_context = replace(ring_group_context, :domain_name_old, :domain_name_new), "; $sql .= "ring_group_forward_destination = replace(ring_group_forward_destination, :domain_name_old, :domain_name_new), "; @@ -314,7 +310,7 @@ } //update cdr records (domain_name, context) - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/xml_cdr/app_config.php")){ + if (file_exists(dirname(__DIR__, 2)."/app/xml_cdr/app_config.php")){ $sql = "update v_xml_cdr set "; $sql .= "domain_name = :domain_name_new "; $sql .= "where domain_name = :domain_name_old "; @@ -337,7 +333,7 @@ } //update conference session recording paths - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/conference_centers/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/conference_centers/app_config.php")) { $sql = "update v_conference_sessions set "; $sql .= "recording = replace(recording, :domain_name_old, :domain_name_new) "; $sql .= "where domain_uuid = :domain_uuid "; @@ -349,7 +345,7 @@ } //update conference center greetings - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/conference_centers/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/conference_centers/app_config.php")) { $sql = "update v_conference_centers set "; $sql .= "conference_center_greeting = replace(conference_center_greeting, :domain_name_old, :domain_name_new) "; $sql .= "where domain_uuid = :domain_uuid "; @@ -361,7 +357,7 @@ } //update call center queue record templates - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_centers/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/call_centers/app_config.php")) { $sql = "update v_call_center_queues set "; $sql .= "queue_record_template = replace(queue_record_template, :domain_name_old, :domain_name_new) "; $sql .= "where domain_uuid = :domain_uuid "; @@ -373,7 +369,7 @@ } //update call center agent contacts - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_centers/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/call_centers/app_config.php")) { $sql = "update v_call_center_agents set "; $sql .= "agent_contact = replace(agent_contact, :domain_name_old, :domain_name_new) "; $sql .= "where domain_uuid = :domain_uuid "; @@ -385,7 +381,7 @@ } //update call flows data, alternate-data and contexts - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_flows/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/call_flows/app_config.php")) { $sql = "update v_call_flows set "; $sql .= "call_flow_data = replace(call_flow_data, :domain_name_old, :domain_name_new), "; $sql .= "call_flow_alternate_data = replace(call_flow_alternate_data, :domain_name_old, :domain_name_new), "; @@ -399,7 +395,7 @@ } //update device lines server_address, server_address_primary, server_address_secondary, outbound_proxy_primary, outbound_proxy_secondary - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/devices/app_config.php")) { + if (file_exists(dirname(__DIR__, 2)."/app/devices/app_config.php")) { $sql = "update v_device_lines set "; $sql .= "server_address = replace(server_address, :domain_name_old, :domain_name_new), "; $sql .= "server_address_primary = replace(server_address_primary, :domain_name_old, :domain_name_new), "; @@ -528,7 +524,7 @@ $sql = "select "; $sql .= "domain_uuid, "; $sql .= "domain_name, "; - $sql .= "cast(domain_enabled as text), "; + $sql .= "domain_enabled, "; $sql .= "domain_description "; $sql .= "from v_domains "; $sql .= "where domain_uuid = :domain_uuid "; @@ -542,9 +538,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($domain_enabled)) { $domain_enabled = 'true'; } - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -669,17 +662,16 @@ echo " ".$text['label-enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-domain_enabled']."\n"; diff --git a/core/domains/domain_json.php b/core/domains/domain_json.php index d3faa6da27..70cd9bfb03 100644 --- a/core/domains/domain_json.php +++ b/core/domains/domain_json.php @@ -66,7 +66,7 @@ $sql = "select * "; $sql .= "from v_domains "; $sql .= "where true "; - $sql .= "and domain_enabled = 'true' \n"; + $sql .= "and domain_enabled = true \n"; if (isset($search)) { $sql .= " and ( "; $sql .= " lower(domain_name) like :search "; diff --git a/core/domains/resources/dashboard/domains.php b/core/domains/resources/dashboard/domains.php index 8e1f494eac..abab153fed 100644 --- a/core/domains/resources/dashboard/domains.php +++ b/core/domains/resources/dashboard/domains.php @@ -26,7 +26,7 @@ //get the domain count for enabled domains $sql = "select count(*) as count from v_domains "; - $sql .= "where domain_enabled = 'true'; "; + $sql .= "where domain_enabled = true; "; $row = $database->select($sql, null, 'row'); $domain_count = $row['count']; unset($sql, $row); diff --git a/core/email_templates/app_config.php b/core/email_templates/app_config.php index 61650a5f3d..4b48c4c88d 100644 --- a/core/email_templates/app_config.php +++ b/core/email_templates/app_config.php @@ -84,7 +84,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Set the type as html or text.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_enabled'; - $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'boolean'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Set the status of the template.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_description'; diff --git a/core/email_templates/app_defaults.php b/core/email_templates/app_defaults.php index 9c81711e00..61b811011f 100644 --- a/core/email_templates/app_defaults.php +++ b/core/email_templates/app_defaults.php @@ -45,7 +45,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -61,7 +61,7 @@ $array['email_templates'][$x]['template_body'] .= "Lä nge \${message_duration}\n"; $array['email_templates'][$x]['template_body'] .= "Nachricht \${message}\n"; $array['email_templates'][$x]['template_type'] = 'text'; - $array['email_templates'][$x]['template_enabled'] = 'false'; + $array['email_templates'][$x]['template_enabled'] = false; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -81,7 +81,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -97,7 +97,7 @@ $array['email_templates'][$x]['template_body'] .= "Lä nge \${message_duration}\n"; $array['email_templates'][$x]['template_body'] .= "Nachricht \${message}\n"; $array['email_templates'][$x]['template_type'] = 'text'; - $array['email_templates'][$x]['template_enabled'] = 'false'; + $array['email_templates'][$x]['template_enabled'] = false; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -112,7 +112,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -132,7 +132,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -148,7 +148,7 @@ $array['email_templates'][$x]['template_body'] .= "Length \${message_duration}\n"; $array['email_templates'][$x]['template_body'] .= "Message \${message}\n"; $array['email_templates'][$x]['template_type'] = 'text'; - $array['email_templates'][$x]['template_enabled'] = 'false'; + $array['email_templates'][$x]['template_enabled'] = false; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -171,7 +171,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -190,7 +190,7 @@ $array['email_templates'][$x]['template_body'] .= "Transcription\n"; $array['email_templates'][$x]['template_body'] .= "\${message_text}\n"; $array['email_templates'][$x]['template_type'] = 'text'; - $array['email_templates'][$x]['template_enabled'] = 'false'; + $array['email_templates'][$x]['template_enabled'] = false; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -210,7 +210,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -226,7 +226,7 @@ $array['email_templates'][$x]['template_body'] .= "Length \${message_duration}\n"; $array['email_templates'][$x]['template_body'] .= "Message \${message}\n"; $array['email_templates'][$x]['template_type'] = 'text'; - $array['email_templates'][$x]['template_enabled'] = 'false'; + $array['email_templates'][$x]['template_enabled'] = false; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -249,7 +249,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -268,7 +268,7 @@ $array['email_templates'][$x]['template_body'] .= "Transcription\n"; $array['email_templates'][$x]['template_body'] .= "\${message_text}\n"; $array['email_templates'][$x]['template_type'] = 'text'; - $array['email_templates'][$x]['template_enabled'] = 'false'; + $array['email_templates'][$x]['template_enabled'] = false; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -283,7 +283,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -294,7 +294,7 @@ $array['email_templates'][$x]['template_subject'] = 'Missed Call from ${caller_id_name} <${caller_id_number}>'; $array['email_templates'][$x]['template_body'] = "Missed Call from \${caller_id_name} <\${caller_id_number}> to \${sip_to_user} ext \${dialed_user}\n"; $array['email_templates'][$x]['template_type'] = 'text'; - $array['email_templates'][$x]['template_enabled'] = 'false'; + $array['email_templates'][$x]['template_enabled'] = false; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -309,7 +309,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -320,7 +320,7 @@ $array['email_templates'][$x]['template_subject'] = 'Missed Call from ${caller_id_name} <${caller_id_number}>'; $array['email_templates'][$x]['template_body'] = "Missed Call from \${caller_id_name} <\${caller_id_number}> to \${sip_to_user} ext \${dialed_user}\n"; $array['email_templates'][$x]['template_type'] = 'text'; - $array['email_templates'][$x]['template_enabled'] = 'false'; + $array['email_templates'][$x]['template_enabled'] = false; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -340,7 +340,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -356,7 +356,7 @@ $array['email_templates'][$x]['template_body'] .= "Longueur \${message_duration}\n"; $array['email_templates'][$x]['template_body'] .= "Message \${message}\n"; $array['email_templates'][$x]['template_type'] = 'text'; - $array['email_templates'][$x]['template_enabled'] = 'false'; + $array['email_templates'][$x]['template_enabled'] = false; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -371,7 +371,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -382,7 +382,7 @@ $array['email_templates'][$x]['template_subject'] = 'Appel manqué de ${caller_id_name} <${caller_id_number}>'; $array['email_templates'][$x]['template_body'] = "Appel manqué de \${caller_id_name} <\${caller_id_number}> À \${sip_to_user} ext \${dialed_user}\n"; $array['email_templates'][$x]['template_type'] = 'text'; - $array['email_templates'][$x]['template_enabled'] = 'false'; + $array['email_templates'][$x]['template_enabled'] = false; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -397,7 +397,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -412,7 +412,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -427,7 +427,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -442,7 +442,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -457,7 +457,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -472,7 +472,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -487,7 +487,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -502,7 +502,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -522,7 +522,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -542,7 +542,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = ''; $x++; @@ -560,7 +560,7 @@ $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_body'] .= "\n"; $array['email_templates'][$x]['template_type'] = 'html'; - $array['email_templates'][$x]['template_enabled'] = 'true'; + $array['email_templates'][$x]['template_enabled'] = true; $array['email_templates'][$x]['template_description'] = 'Message sent by the Email Test feature found at the top of the Email Queue app.'; //build array of email template uuids diff --git a/core/email_templates/email_template_edit.php b/core/email_templates/email_template_edit.php index ab48ea8f9a..a9e15d3067 100644 --- a/core/email_templates/email_template_edit.php +++ b/core/email_templates/email_template_edit.php @@ -54,7 +54,7 @@ $template_subject = ''; $template_body = ''; $template_type = ''; - $template_enabled = ''; + $template_enabled = false; $template_description = ''; //get http post variables and set them to php variables @@ -66,7 +66,7 @@ $template_subject = $_POST["template_subject"]; $template_body = $_POST["template_body"]; $template_type = $_POST["template_type"]; - $template_enabled = $_POST["template_enabled"] ?? 'false'; + $template_enabled = $_POST["template_enabled"] ?? false; $template_description = $_POST["template_description"]; } @@ -95,7 +95,6 @@ if (empty($template_body)) { $msg .= $text['message-required']." ".$text['label-template_body']."
\n"; } //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."
\n"; } //if (empty($template_type)) { $msg .= $text['message-required']." ".$text['label-template_type']."
\n"; } - if (empty($template_enabled)) { $msg .= $text['message-required']." ".$text['label-template_enabled']."
\n"; } //if (empty($template_description)) { $msg .= $text['message-required']." ".$text['label-template_description']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -128,7 +127,6 @@ $array['email_templates'][0]['template_description'] = $template_description; //save to the data - $database = new database; $database->app_name = 'email_templates'; $database->app_uuid = '8173e738-2523-46d5-8943-13883befd2fd'; if (!empty($email_template_uuid)) { @@ -153,12 +151,22 @@ //pre-populate the form if (count($_GET)>0 && empty($_POST["persistformvar"])) { $email_template_uuid = $_GET["id"]; - $sql = "select * from v_email_templates "; + $sql = "select "; + $sql .= "email_template_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "template_language, "; + $sql .= "template_category, "; + $sql .= "template_subcategory, "; + $sql .= "template_subject, "; + $sql .= "template_body, "; + $sql .= "template_type, "; + $sql .= "template_enabled, "; + $sql .= "template_description "; + $sql .= "from v_email_templates "; $sql .= "where email_template_uuid = :email_template_uuid "; //$sql .= "and domain_uuid = :domain_uuid "; $parameters['email_template_uuid'] = $email_template_uuid; //$parameters['domain_uuid'] = $domain_uuid; - $database = new database; $row = $database->select($sql, $parameters, 'row'); if (!empty($row)) { $domain_uuid = $row["domain_uuid"]; @@ -174,9 +182,6 @@ unset($sql, $parameters, $row); } -//set the defaults - if (empty($template_enabled)) { $template_enabled = 'true'; } - //load editor preferences/defaults $setting_size = !empty($_SESSION["editor"]["font_size"]["text"]) ? $_SESSION["editor"]["font_size"]["text"] : '12px'; $setting_theme = !empty($_SESSION["editor"]["theme"]["text"]) ? $_SESSION["editor"]["theme"]["text"] : 'cobalt'; @@ -425,17 +430,16 @@ echo " ".$text['label-template_enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-template_enabled']."\n"; diff --git a/core/email_templates/email_templates.php b/core/email_templates/email_templates.php index 3e92c81dee..6c94bb0a57 100644 --- a/core/email_templates/email_templates.php +++ b/core/email_templates/email_templates.php @@ -100,14 +100,15 @@ $sql_search .= " or lower(template_subject) like :search "; $sql_search .= " or lower(template_body) like :search "; $sql_search .= " or lower(template_type) like :search "; - $sql_search .= " or lower(template_enabled) like :search "; $sql_search .= " or lower(template_description) like :search "; $sql_search .= ") "; $parameters['search'] = '%'.$search.'%'; } //prepare to page the results - $sql = "select count(*) from v_email_templates where true "; + $sql = "select count(*) "; + $sql .= "from v_email_templates "; + $sql .= "where true "; if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('email_template_all')) { if (!empty($sql_search)) { $sql .= "and ".$sql_search; @@ -121,7 +122,6 @@ $parameters['domain_uuid'] = $domain_uuid; } $sql .= $sql_category ?? ''; - $database = new database; $num_rows = $database->select($sql, $parameters ?? '', 'column'); //prepare to page the results @@ -136,7 +136,32 @@ $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(*)', '*', $sql); + $sql = "select "; + $sql .= "email_template_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "template_language, "; + $sql .= "template_category, "; + $sql .= "template_subcategory, "; + $sql .= "template_subject, "; + $sql .= "template_body, "; + $sql .= "template_type, "; + $sql .= "cast(template_enabled as text), "; + $sql .= "template_description "; + $sql .= "from v_email_templates "; + $sql .= "where true "; + if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('email_template_all')) { + if (!empty($sql_search)) { + $sql .= "and ".$sql_search; + } + } + else { + $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; + if (!empty($sql_search)) { + $sql .= "and ".$sql_search; + } + $parameters['domain_uuid'] = $domain_uuid; + } + $sql .= $sql_category ?? ''; if ($order_by) { $sql .= order_by($order_by, $order); } @@ -144,14 +169,12 @@ $sql .= "order by domain_uuid, template_language asc, template_category asc, template_subcategory asc, template_type asc, template_description asc "; } $sql .= limit_offset($rows_per_page, $offset); - $database = new database; $result = $database->select($sql, $parameters ?? '', 'all'); unset($sql, $parameters); //get email template categories $sql = "select distinct template_category from v_email_templates "; $sql .= "order by template_category asc "; - $database = new database; $rows = $database->select($sql, $parameters ?? '', 'all'); if (!empty($rows)) { foreach ($rows as $row) { @@ -327,4 +350,3 @@ require_once "resources/footer.php"; ?> - diff --git a/core/groups/app_config.php b/core/groups/app_config.php index 85d1fec31e..f4fad82119 100644 --- a/core/groups/app_config.php +++ b/core/groups/app_config.php @@ -113,7 +113,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "group_protected"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "group_level"; diff --git a/core/groups/group_edit.php b/core/groups/group_edit.php index 7d834222b2..25692b91cf 100644 --- a/core/groups/group_edit.php +++ b/core/groups/group_edit.php @@ -66,7 +66,7 @@ $group_name_previous = $_POST["group_name_previous"]; $domain_uuid = $_POST["domain_uuid"]; $group_level = $_POST["group_level"] ?? '10'; - $group_protected = $_POST["group_protected"] ?? 'false'; + $group_protected = $_POST["group_protected"] ?? false; $group_description = $_POST["group_description"] ?? ''; } @@ -110,7 +110,6 @@ if (empty($group_name)) { $msg .= $text['message-required']." ".$text['label-group_name']."
\n"; } //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."
\n"; } if (empty($group_level)) { $msg .= $text['message-required']." ".$text['label-group_level']."
\n"; } - //if (empty($group_protected)) { $msg .= $text['message-required']." ".$text['label-group_protected']."
\n"; } //if (empty($group_description)) { $msg .= $text['message-required']." ".$text['label-group_description']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -300,17 +299,16 @@ echo " ".$text['label-group_protected']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; //echo $text['description-group_protected']."\n"; @@ -340,4 +338,4 @@ //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> diff --git a/core/groups/groups.php b/core/groups/groups.php index c7b2bf5a4e..23610250a4 100644 --- a/core/groups/groups.php +++ b/core/groups/groups.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-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -119,7 +119,32 @@ $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(*)', '*', $sql); + $sql = "select "; + $sql .= "group_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "domain_name, "; + $sql .= "group_name, "; + $sql .= "group_permissions, "; + $sql .= "group_members, "; + $sql .= "cast(group_protected as text), "; + $sql .= "group_level, "; + $sql .= "group_description "; + $sql .= "from view_groups "; + $sql .= "where true \n"; + if ($show == 'all' && permission_exists('group_all')) { + $sql .= "and (domain_uuid is not null or domain_uuid is null) "; + } + else { + $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; + $parameters['domain_uuid'] = $domain_uuid; + } + if (!empty($search)) { + $sql .= "and ( \n"; + $sql .= " lower(group_name) like :search \n"; + $sql .= " or lower(group_description) like :search \n"; + $sql .= ") \n"; + $parameters['search'] = '%'.$search.'%'; + } $sql .= order_by($order_by, $order, 'group_name', 'asc'); $sql .= limit_offset($rows_per_page, $offset); $groups = $database->select($sql, $parameters ?? '', 'all'); diff --git a/core/groups/resources/classes/permission.php b/core/groups/resources/classes/permission.php index 779a176048..09133b4d4b 100644 --- a/core/groups/resources/classes/permission.php +++ b/core/groups/resources/classes/permission.php @@ -63,7 +63,7 @@ $sql .= "where group_name in ( "; $sql .= " select group_name "; $sql .= " from v_groups "; - $sql .= " where group_protected <> 'true' "; + $sql .= " where group_protected <> true "; $sql .= " and group_name in (".$group_names.") "; $sql .= ")"; $sql .= "and (permission_protected <> 'true' or permission_protected is null)"; @@ -76,7 +76,7 @@ $sql .= "where group_name in ( "; $sql .= " select group_name "; $sql .= " from v_groups "; - $sql .= " where group_protected <> 'true' "; + $sql .= " where group_protected <> true "; $sql .= " and group_name in (".$group_names.") "; $sql .= ");"; $database = new database; @@ -145,12 +145,12 @@ foreach ($permission['groups'] as $group_name) { //check group protection $group_uuid = null; - $group_protected = null; + $group_protected = false; if (is_array($groups)) { foreach ($groups as $group) { if ($group['group_name'] == $group_name) { $group_uuid = $group['group_uuid']; - $group_protected = $group['group_protected'] == 'true' ? true : false; + $group_protected = $group['group_protected']; break; } } diff --git a/core/groups/resources/database/views/groups.php b/core/groups/resources/database/views/groups.php new file mode 100644 index 0000000000..584df1dd95 --- /dev/null +++ b/core/groups/resources/database/views/groups.php @@ -0,0 +1,11 @@ +delete("domain_add", "temp"); } - //set the session domain id and name + //set the session domain ID and name $_SESSION['domain_uuid'] = $domain_uuid; $_SESSION['domain_name'] = $domain_name; diff --git a/core/user_settings/app_config.php b/core/user_settings/app_config.php index 0c3a39b8f8..3871bfa87e 100644 --- a/core/user_settings/app_config.php +++ b/core/user_settings/app_config.php @@ -104,9 +104,7 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "user_setting_enabled"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "boolean"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['toggle'] = ['true','false']; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; diff --git a/core/user_settings/app_languages.php b/core/user_settings/app_languages.php index ab049c295f..420195eed9 100644 --- a/core/user_settings/app_languages.php +++ b/core/user_settings/app_languages.php @@ -568,32 +568,32 @@ $text['login-message_attention']['zh-cn'] = "注意力!"; $text['login-message_attention']['ja-jp'] = "注意!"; $text['login-message_attention']['ko-kr'] = "주목!"; -$text['option-select']['en-us'] = "Select"; -$text['option-select']['en-gb'] = "Select"; -$text['option-select']['ar-eg'] = "مختارة"; -$text['option-select']['de-at'] = "Auswählen"; -$text['option-select']['de-ch'] = "Auswählen"; -$text['option-select']['de-de'] = "Auswählen"; -$text['option-select']['el-gr'] = "Επιλέξτε"; -$text['option-select']['es-cl'] = "Seleccionar"; -$text['option-select']['es-mx'] = "Seleccionar"; -$text['option-select']['fr-ca'] = "Sélectionner"; -$text['option-select']['fr-fr'] = "Sélectionner"; -$text['option-select']['he-il'] = "בחר"; -$text['option-select']['it-it'] = "Selezionare"; -$text['option-select']['ka-ge'] = "არჩევა"; -$text['option-select']['nl-nl'] = "selectie"; -$text['option-select']['pl-pl'] = "Wybierz"; -$text['option-select']['pt-br'] = "Selecionar"; -$text['option-select']['pt-pt'] = "Selecionar"; -$text['option-select']['ro-ro'] = "Selectați"; -$text['option-select']['ru-ru'] = "Выбрать"; -$text['option-select']['sv-se'] = "Välj"; -$text['option-select']['uk-ua'] = "Зареєструватися"; -$text['option-select']['tr-tr'] = "Seç"; -$text['option-select']['zh-cn'] = "选择"; -$text['option-select']['ja-jp'] = "選択する"; -$text['option-select']['ko-kr'] = "선택하다"; +$text['option-select_box']['en-us'] = "Select Box"; +$text['option-select_box']['en-gb'] = "Select Box"; +$text['option-select_box']['ar-eg'] = "حدد المربع"; +$text['option-select_box']['de-at'] = "Auswahlfeld"; +$text['option-select_box']['de-ch'] = "Auswahlfeld"; +$text['option-select_box']['de-de'] = "Auswahlfeld"; +$text['option-select_box']['el-gr'] = "Επιλογή πλαισίου"; +$text['option-select_box']['es-cl'] = "Cuadro de selección"; +$text['option-select_box']['es-mx'] = "Cuadro de selección"; +$text['option-select_box']['fr-ca'] = "Boîte de sélection"; +$text['option-select_box']['fr-fr'] = "Boîte de sélection"; +$text['option-select_box']['he-il'] = "בחר תיבה"; +$text['option-select_box']['it-it'] = "Seleziona casella"; +$text['option-select_box']['ka-ge'] = "აირჩიეთ ველი"; +$text['option-select_box']['nl-nl'] = "Selecteer vak"; +$text['option-select_box']['pl-pl'] = "Wybierz pole"; +$text['option-select_box']['pt-br'] = "Caixa de seleção"; +$text['option-select_box']['pt-pt'] = "Caixa de seleção"; +$text['option-select_box']['ro-ro'] = "Selectați caseta"; +$text['option-select_box']['ru-ru'] = "Выбрать поле"; +$text['option-select_box']['sv-se'] = "Välj ruta"; +$text['option-select_box']['uk-ua'] = "Виберіть поле"; +$text['option-select_box']['tr-tr'] = "Seçim Kutusu"; +$text['option-select_box']['zh-cn'] = "选择框"; +$text['option-select_box']['ja-jp'] = "選択ボックス"; +$text['option-select_box']['ko-kr'] = "선택 상자"; $text['option-switch_round']['en-us'] = "Round Switch"; $text['option-switch_round']['en-gb'] = "Round Switch"; diff --git a/core/user_settings/user_setting_edit.php b/core/user_settings/user_setting_edit.php index 373b36f95f..c1d2a017dd 100644 --- a/core/user_settings/user_setting_edit.php +++ b/core/user_settings/user_setting_edit.php @@ -84,7 +84,7 @@ $user_setting_name = strtolower($_POST["user_setting_name"] ?? ''); $user_setting_value = $_POST["user_setting_value"] ?? ''; $user_setting_order = $_POST["user_setting_order"] ?? ''; - $user_setting_enabled = strtolower($_POST["user_setting_enabled"] ?? 'false'); + $user_setting_enabled = $_POST["user_setting_enabled"]; $user_setting_description = $_POST["user_setting_description"] ?? ''; } @@ -316,7 +316,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { //pre-populate the form if (!empty($_GET["id"]) && empty($_POST["persistformvar"])) { $user_setting_uuid = $_GET["id"]; - $sql = "select user_setting_category, user_setting_subcategory, user_setting_name, user_setting_value, user_setting_order, cast(user_setting_enabled as text), user_setting_description "; + $sql = "select user_setting_category, user_setting_subcategory, user_setting_name, user_setting_value, user_setting_order, user_setting_enabled, user_setting_description "; $sql .= "from v_user_settings "; $sql .= "where user_setting_uuid = :user_setting_uuid "; $sql .= "and user_uuid = :user_uuid "; @@ -593,8 +593,8 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { } else if ($user_setting_category == "theme" && $user_setting_subcategory == "domain_visible" && $user_setting_name == "text" ) { echo " \n"; } else if ($user_setting_category == "theme" && $user_setting_subcategory == "menu_brand_type" && $user_setting_name == "text" ) { @@ -660,7 +660,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { } elseif ($user_setting_category == "theme" && $user_setting_subcategory == "input_toggle_style" && $user_setting_name == "text" ) { echo " \n"; @@ -695,7 +695,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { } else { echo " \n"; - echo " \n"; + echo " \n"; } echo " \n"; } @@ -752,20 +752,18 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { echo " ".$text['label-enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; - //echo $text['description-setting_enabled']."\n"; echo "
\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; } - else { - echo " \n"; + echo " \n"; + if ($input_toggle_style_switch) { + echo " \n"; + echo " \n"; } echo "
\n"; echo $text['description-enabled']."\n"; diff --git a/resources/classes/database.php b/resources/classes/database.php index 591db49209..649bff9f3d 100644 --- a/resources/classes/database.php +++ b/resources/classes/database.php @@ -3459,6 +3459,87 @@ class database { } } + /** + * Gets a list of database views from the file system. + * @param string $action options: list, create, drop + * @return array shows list of views, list of views that were updated + */ + public function views(string $action) { + + $files = glob(dirname(__DIR__, 2) . "/*/*/resources/database/views/*.php"); + foreach($files as $id => $file) { + $view = array(); + try { + include $file; + $views[$id] = $view; + } catch (\Exception $e) { + $views[$id]['error'] = $e->getMessage(); + } finally { + $views[$id]['file'] = $file; + } + } + + //view list + if ($action === 'list') { + return $views; + } + + //update views + if ($action === 'create') { + $array = array(); + foreach($views as $id => $row) { + if (!empty($row['name']) && !empty($row['sql'])) { + //set the variables + $view_name = $row['name']; + $view_sql = $row['sql']; + //$view_version = $row['version']; + //$view_description = $row['description']; + + //create and run the view sql + $sql = "CREATE OR REPLACE VIEW ".$view_name." AS (\n"; + $sql .= $view_sql."\n"; + $sql .= ")\n"; + $this->execute($sql); + + //build the return array + $views[$id]['result'] = $this->message; + } + else { + //build the return array + $views[$id]['result'] = 'Name or SQL empty'; + } + } + + //return views array + return $views; + } + + //drop views + if ($action === 'drop') { + $array = array(); + foreach($views as $id => $row) { + if (!empty($row['name'])) { + //set the variables + $view_name = $row['name']; + + //create and run the view sql + $sql = "DROP VIEW ".$view_name.";"; + $this->execute($sql); + + //build the return array + $views[$id]['result'] = 'Dropped'; + } + else { + //build the return array + $views[$id]['result'] = 'Name or SQL empty'; + } + } + + //return views array + return $views; + } + } + /** * Returns a sanitized string value safe for database or table name. * @param string $value To be sanitized diff --git a/resources/classes/schema.php b/resources/classes/schema.php index f5ef6b2774..b5a5e649ae 100644 --- a/resources/classes/schema.php +++ b/resources/classes/schema.php @@ -18,7 +18,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2013 - 2023 + Copyright (C) 2013 - 2025 All Rights Reserved. Contributor(s): @@ -648,7 +648,7 @@ break; case 'timestamptz': $using = $field_name . "::timestamp with time zone"; break; - case 'boolean': $using = $field_name . "::boolean"; + case 'boolean': $using = $field_name . "::text::boolean"; break; default: unset($using); } @@ -820,17 +820,25 @@ } //$this->db->beginTransaction(); $update_array = explode(";", $sql_update); - foreach ($update_array as $sql) { - if (strlen(trim($sql))) { - try { - $this->database->db->query(trim($sql)); - if ($format == "text") { - $response .= " $sql;\n"; + if (is_array($update_array) && count($update_array)) { + //drop views so that alter table statements complete + $result = $this->database->views('drop'); + + foreach ($update_array as $sql) { + if (strlen(trim($sql))) { + try { + $this->database->db->query(trim($sql)); + if ($format == "text") { + $response .= " $sql;\n"; + } + } catch (PDOException $error) { + $response .= " error: " . $error->getMessage() . " sql: $sql\n"; } - } catch (PDOException $error) { - $response .= " error: " . $error->getMessage() . " sql: $sql\n"; } } + + //recreate the views + $result = $this->database->views('create'); } //$this->db->commit(); $response .= "\n"; diff --git a/resources/classes/settings.php b/resources/classes/settings.php index d8223ed7f8..6821431844 100644 --- a/resources/classes/settings.php +++ b/resources/classes/settings.php @@ -1,10 +1,10 @@ @@ -402,11 +402,10 @@ class settings implements clear_cache { private function device_profile_settings() { //get the device profile settings - $sql = "select profile_setting_name, profile_setting_value from v_device_profile_settings" - . " where device_profile_uuid = :device_profile_uuid" - . " and domain_uuid = :domain_uuid" - . " and profile_setting_enabled = 'true'" - ; + $sql = "select profile_setting_name, profile_setting_value from v_device_profile_settings "; + $sql .= "where device_profile_uuid = :device_profile_uuid "; + $sql .= "and domain_uuid = :domain_uuid "; + $sql .= "and profile_setting_enabled = true "; $params = []; $params['device_profile_uuid'] = $this->device_profile_uuid; $params['domain_uuid'] = $this->domain_uuid; @@ -428,11 +427,10 @@ class settings implements clear_cache { private function device_settings() { //get the device settings - $sql = "select device_setting_subcategory, device_setting_value from v_device_settings" - . " where device_setting_uuid = :device_uuid" - . " and domain_uuid = :domain_uuid" - . " and device_setting_enabled = 'true'" - ; + $sql = "select device_setting_subcategory, device_setting_value from v_device_settings "; + $sql .= "where device_setting_uuid = :device_uuid "; + $sql .= "and domain_uuid = :domain_uuid "; + $sql .= "and device_setting_enabled = true "; $params = []; $params['device_uuid'] = $this->device_uuid; $params['domain_uuid'] = $this->domain_uuid; diff --git a/resources/footer.php b/resources/footer.php index 1a6c32c2d0..9c3b34eccd 100644 --- a/resources/footer.php +++ b/resources/footer.php @@ -258,6 +258,7 @@ $view->assign('container_close', ''); $view->assign('document_body', $body); $view->assign('current_year', date('Y')); + //login logo //determine logo source if (isset($_SESSION['theme']['logo_login']['text']) && $_SESSION['theme']['logo_login']['text'] != '') { @@ -285,10 +286,16 @@ $view->assign('login_logo_source', $login_logo_source); $view->assign('login_logo_width', $login_logo_width); $view->assign('login_logo_height', $login_logo_height); -//login page - //$view->assign('login_page', $login_page); + + //login page + //$view->assign('login_page', $login_page); + //messages $view->assign('messages', message::html(true, ' ')); + + //set the input toggle style options: select, switch_round, switch_square + $view->assign('input_toggle_style_switch', $input_toggle_style_switch); + //session timer if ($authenticated && file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH.'/app/session_timer/session_timer.php') && diff --git a/resources/header.php b/resources/header.php index eeec6b8168..f247a4ef17 100644 --- a/resources/header.php +++ b/resources/header.php @@ -150,6 +150,14 @@ break; } +//get the input toggle style options: select, switch_round, switch_square + if (substr($settings->get('theme', 'input_toggle_style', 'switch_round'), 0, 6) == 'switch') { + $input_toggle_style_switch = true; + } + else { + $input_toggle_style_switch = false; + } + //start the output buffer ob_start(); @@ -158,4 +166,4 @@ require_once("app/translate/translate_header.php"); } -?> +?> \ No newline at end of file diff --git a/resources/login.php b/resources/login.php index 3c2d1e3af7..0bcf21bfce 100644 --- a/resources/login.php +++ b/resources/login.php @@ -128,7 +128,7 @@ $sql .= "and template_category = 'password_reset' "; $sql .= "and template_subcategory = 'default' "; $sql .= "and template_type = 'html' "; - $sql .= "and template_enabled = 'true' "; + $sql .= "and template_enabled = true "; $parameters['template_language'] = $user_language_code ? $user_language_code : $settings->get('domain', 'language', 'en-us'); $parameters['domain_uuid'] = $domain_uuid; $row = $database->select($sql, $parameters, 'row'); diff --git a/resources/switch.php b/resources/switch.php index 52fd7a28c7..d0a12a9659 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -277,7 +277,7 @@ function save_var_xml() { //build the xml $sql = "select * from v_vars "; - $sql .= "where var_enabled = 'true' "; + $sql .= "where var_enabled = true "; $sql .= "order by var_category, var_order asc "; $database = new database; $variables = $database->select($sql, null, 'all'); @@ -351,8 +351,8 @@ function outbound_route_to_bridge($domain_uuid, $destination_number, array $chan } $sql .= "and (hostname = :hostname or hostname is null) "; $sql .= "and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' "; - $sql .= "and d.dialplan_enabled = 'true' "; - $sql .= "and (dd.dialplan_detail_enabled = 'true' or dd.dialplan_detail_enabled is null) "; + $sql .= "and d.dialplan_enabled = true "; + $sql .= "and (dd.dialplan_detail_enabled = true or dd.dialplan_detail_enabled is null) "; $sql .= "order by d.domain_uuid, d.dialplan_order, dd.dialplan_detail_order "; $parameters['hostname'] = $hostname; $database = new database; @@ -423,7 +423,7 @@ function outbound_route_to_bridge($domain_uuid, $destination_number, array $chan } } - if (!empty($bridge_array) && $dialplan["dialplan_continue"] == "false") { + if (!empty($bridge_array) && $dialplan["dialplan_continue"] == false) { break; } } @@ -446,7 +446,7 @@ function extension_exists($extension) { $sql .= "extension = :extension "; $sql .= "or number_alias = :extension "; $sql .= ") "; - $sql .= "and enabled = 'true' "; + $sql .= "and enabled = true "; $parameters['domain_uuid'] = $domain_uuid; $parameters['extension'] = $extension; $database = new database; @@ -888,7 +888,7 @@ if (!function_exists('save_sip_profile_xml')) { $sip_profile_name = $row['sip_profile_name']; $sip_profile_enabled = $row['sip_profile_enabled']; - if ($sip_profile_enabled == 'false') { + if ($sip_profile_enabled == false) { $fout = fopen($profile_dir.'/'.$sip_profile_name.".xml","w"); if ($fout) { fclose($fout); @@ -907,7 +907,7 @@ if (!function_exists('save_sip_profile_xml')) { //get the sip profile settings $sql = "select * from v_sip_profile_settings "; $sql .= "where sip_profile_uuid = :sip_profile_uuid "; - $sql .= "and sip_profile_setting_enabled = 'true' "; + $sql .= "and sip_profile_setting_enabled = true "; $parameters['sip_profile_uuid'] = $sip_profile_uuid; $database = new database; $result_2 = $database->select($sql, $parameters, 'all'); diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index 24593d96d5..4df45e51eb 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -308,7 +308,7 @@ if (!function_exists('fax_split_dtmf')) { //get the enabled domains from the database //$domains = domains::fetch($database); $domains = []; - $result = $database->select("select domain_uuid, domain_name from v_domains where domain_enabled = 'true'"); + $result = $database->select("select domain_uuid, domain_name from v_domains where domain_enabled = true "); if (is_array($result) && @sizeof($result) != 0) { foreach ($result as $row) { //set the domain variables @@ -476,7 +476,7 @@ if (!function_exists('fax_split_dtmf')) { $sql .= "and template_category = :template_category "; $sql .= "and template_subcategory = :template_subcategory "; $sql .= "and template_type = :template_type "; - $sql .= "and template_enabled = 'true' "; + $sql .= "and template_enabled = true "; $parameters['domain_uuid'] = $domain_uuid; $parameters['template_language'] = $language_code; $parameters['template_category'] = 'fax'; diff --git a/themes/default/css.php b/themes/default/css.php index 469c49c1dd..dadfed4dd5 100644 --- a/themes/default/css.php +++ b/themes/default/css.php @@ -2329,7 +2329,7 @@ else { //default: white } - .switch > input { + .switch > select { display: none; } @@ -2399,14 +2399,14 @@ else { //default: white transition: all 0.25s ease; } - input:checked + .slider { /* when enabled */ + select:has(option[value="true"]:checked) + .slider { /* when enabled */ background: ; } - input:focus + .slider { /* when focused, required for switch movement */ + select:focus + .slider { /* when focused, required for switch movement */ } - input:checked + .slider:before { /* distance switch moves horizontally */ + select:has(option[value="true"]:checked) + .slider:before { /* distance switch moves horizontally */ text-align: center; @@ -2549,6 +2549,7 @@ else { //default: white border-bottom: 1px solid ; padding: ; text-align: left; + text-wrap: wrap; vertical-align: middle; color: ; font-family: ; diff --git a/themes/default/template.php b/themes/default/template.php index ec2c1bf7b7..8fbf034094 100644 --- a/themes/default/template.php +++ b/themes/default/template.php @@ -706,6 +706,18 @@ })(jQuery); {/literal} + //slide toggle + {literal} + var switches = document.getElementsByClassName('switch'); + var toggle = function(){ + this.children[0].value = (this.children[0].value == 'false' ? 'true' : 'false'); + this.children[0].dispatchEvent(new Event('change')); + }; + for (var i = 0; i < switches.length; i++) { + switches[i].addEventListener('click', toggle, false); + } + {/literal} + {literal} }); //document ready end {/literal}