diff --git a/app/access_controls/resources/classes/access_controls.php b/app/access_controls/resources/classes/access_controls.php index 4d8efd2add..25ca525c01 100644 --- a/app/access_controls/resources/classes/access_controls.php +++ b/app/access_controls/resources/classes/access_controls.php @@ -2,11 +2,7 @@ /** * access controls class - * - * @method null download */ -if (!class_exists('access_controls')) { - class access_controls { /** @@ -264,6 +260,3 @@ if (!class_exists('access_controls')) { } } } - -} -?> diff --git a/app/basic_operator_panel/resources/classes/basic_operator_panel.php b/app/basic_operator_panel/resources/classes/basic_operator_panel.php index 234726fb46..7d1ba52ce2 100644 --- a/app/basic_operator_panel/resources/classes/basic_operator_panel.php +++ b/app/basic_operator_panel/resources/classes/basic_operator_panel.php @@ -27,7 +27,6 @@ /** * Define the operator_panel class */ -if (!class_exists('basic_operator_panel')) { class basic_operator_panel { /** @@ -245,6 +244,3 @@ if (!class_exists('basic_operator_panel')) { return $result; } } -} - -?> diff --git a/app/basic_operator_panel/resources/content.php b/app/basic_operator_panel/resources/content.php index 341a59e444..db831c2a64 100644 --- a/app/basic_operator_panel/resources/content.php +++ b/app/basic_operator_panel/resources/content.php @@ -353,7 +353,7 @@ if (is_array($activity)) { } else { //unregistered extension - if (!empty($_SESSION['operator_panel']['show_unregistered']['boolean']) && $_SESSION['operator_panel']['show_unregistered']['boolean'] == 'true') { + if (filter_var($_SESSION['operator_panel']['show_unregistered']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { $css_class = "ur_ext"; } else { @@ -551,7 +551,7 @@ if (is_array($activity)) { if (in_array($extension, $_SESSION['user']['extensions'])) { $user_extensions[] = $block; - } elseif (!empty($ext['call_group']) && filter_var($_SESSION['operator_panel']['group_extensions']['boolean'], FILTER_VALIDATE_BOOLEAN)) { + } elseif (!empty($ext['call_group']) && filter_var($_SESSION['operator_panel']['group_extensions']['boolean'] ?? false, FILTER_VALIDATE_BOOLEAN)) { $grouped_extensions[$ext['call_group']][] = $block; } else { $other_extensions[] = $block; diff --git a/app/bridges/bridges.php b/app/bridges/bridges.php index 95cf85dcef..0b263b3e60 100644 --- a/app/bridges/bridges.php +++ b/app/bridges/bridges.php @@ -47,7 +47,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get the http post data if (!empty($_POST['bridges'])) { @@ -226,7 +226,7 @@ echo th_order_by('bridge_destination', $text['label-bridge_destination'], $order_by, $order); echo th_order_by('bridge_enabled', $text['label-bridge_enabled'], $order_by, $order, null, "class='center'"); echo " ".$text['label-bridge_description']."\n"; - if (permission_exists('bridge_edit') && !empty($list_row_edit_button) && $list_row_edit_button == 'true') { + if (permission_exists('bridge_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -270,7 +270,7 @@ } echo " \n"; echo " ".escape($row['bridge_description'])."\n"; - if (permission_exists('bridge_edit') && !empty($list_row_edit_button) && $list_row_edit_button == 'true') { + if (permission_exists('bridge_edit') && $list_row_edit_button) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/bridges/resources/classes/bridges.php b/app/bridges/resources/classes/bridges.php index a4fba27236..c9c1170b85 100644 --- a/app/bridges/resources/classes/bridges.php +++ b/app/bridges/resources/classes/bridges.php @@ -25,7 +25,6 @@ */ //define the bridges class -if (!class_exists('bridges')) { class bridges { /** @@ -255,6 +254,3 @@ if (!class_exists('bridges')) { } } -} - -?> \ No newline at end of file diff --git a/app/call_block/call_block.php b/app/call_block/call_block.php index 6ed672bc6d..3d6ae3c27e 100644 --- a/app/call_block/call_block.php +++ b/app/call_block/call_block.php @@ -46,7 +46,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get posted data if (!empty($_POST['call_blocks'])) { @@ -301,7 +301,7 @@ echo th_order_by('call_block_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('insert_date', $text['label-date-added'], $order_by, $order, null, "class='shrink no-wrap'"); echo "".$text['label-description']."\n"; - if (permission_exists('call_block_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_block_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -385,7 +385,7 @@ echo " \n"; echo " ".$row['date_formatted']." ".$row['time_formatted']."\n"; echo " ".escape($row['call_block_description'])."\n"; - if (permission_exists('call_block_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_block_edit') && $list_row_edit_button) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/call_block/call_block_edit.php b/app/call_block/call_block_edit.php index b4e986a149..aae31bc257 100644 --- a/app/call_block/call_block_edit.php +++ b/app/call_block/call_block_edit.php @@ -674,6 +674,8 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr echo modal::create(['id'=>'modal-block','type'=>'general','message'=>$text['confirm-block'],'actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_block','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_form_submit('form_list');"])]); } + echo "
\n"; + foreach (['inbound','outbound'] as $direction) { echo "\n"; echo "\n"; @@ -754,6 +756,8 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr echo "
\n"; } + echo "
\n"; + echo "
\n"; echo "\n"; echo "\n"; diff --git a/app/call_block/resources/classes/call_block.php b/app/call_block/resources/classes/call_block.php index 1d1fc8ef2b..1faf6501dc 100644 --- a/app/call_block/resources/classes/call_block.php +++ b/app/call_block/resources/classes/call_block.php @@ -2,10 +2,7 @@ /** * call block class - * - * @method null download */ -if (!class_exists('call_block')) { class call_block { /** @@ -459,6 +456,3 @@ if (!class_exists('call_block')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/app/call_broadcast/call_broadcast.php b/app/call_broadcast/call_broadcast.php index 6e6cd20c00..aac61a9d67 100644 --- a/app/call_broadcast/call_broadcast.php +++ b/app/call_broadcast/call_broadcast.php @@ -47,7 +47,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get posted data if (!empty($_POST['call_broadcasts'])) { @@ -219,7 +219,7 @@ echo th_order_by('broadcast_concurrent_limit', $text['label-concurrent-limit'], $order_by, $order); echo th_order_by('broadcast_start_time', $text['label-start_time'], $order_by, $order); echo th_order_by('broadcast_description', $text['label-description'], $order_by, $order); - if (permission_exists('call_broadcast_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_broadcast_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -266,7 +266,7 @@ } echo " ".escape($broadcast_start_time ?? '')."\n"; echo " ".escape($row['broadcast_description'])."\n"; - if (permission_exists('call_broadcast_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_broadcast_edit') && $list_row_edit_button) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/call_broadcast/resources/classes/call_broadcast.php b/app/call_broadcast/resources/classes/call_broadcast.php index 4b3f45cc20..08c7011ddf 100644 --- a/app/call_broadcast/resources/classes/call_broadcast.php +++ b/app/call_broadcast/resources/classes/call_broadcast.php @@ -27,10 +27,7 @@ /** * call broadcast class - * - * @method null download */ -if (!class_exists('call_broadcast')) { class call_broadcast { /** @@ -177,6 +174,3 @@ if (!class_exists('call_broadcast')) { } } -} - -?> \ No newline at end of file diff --git a/app/call_centers/call_center_agents.php b/app/call_centers/call_center_agents.php index 9d76bf34bb..634b1468ac 100644 --- a/app/call_centers/call_center_agents.php +++ b/app/call_centers/call_center_agents.php @@ -43,7 +43,7 @@ $text = $language->get(); //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get posted data if (!empty($_POST['call_center_agents'])) { @@ -206,7 +206,7 @@ //echo th_order_by('agent_wrap_up_time', $text['label-wrap_up_time'], $order_by, $order); //echo th_order_by('agent_reject_delay_time', $text['label-reject_delay_time'], $order_by, $order); //echo th_order_by('agent_busy_delay_time', $text['label-busy_delay_time'], $order_by, $order); - if (permission_exists('call_center_agent_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_center_agent_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -270,7 +270,7 @@ //echo " ".$row[agent_wrap_up_time]."\n"; //echo " ".$row[agent_reject_delay_time]."\n"; //echo " ".$row[agent_busy_delay_time]."\n"; - if (permission_exists('call_center_agent_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_center_agent_edit') && $list_row_edit_button) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/call_centers/call_center_queues.php b/app/call_centers/call_center_queues.php index 52ef61e629..50b9e93ee3 100644 --- a/app/call_centers/call_center_queues.php +++ b/app/call_centers/call_center_queues.php @@ -46,7 +46,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get posted data if (!empty($_POST['call_center_queues']) && is_array($_POST['call_center_queues'])) { @@ -219,7 +219,7 @@ //echo th_order_by('queue_abandoned_resume_allowed', $text['label-abandoned_resume_allowed'], $order_by, $order); //echo th_order_by('queue_tier_rule_wait_multiply_level', $text['label-tier_rule_wait_multiply_level'], $order_by, $order); echo th_order_by('queue_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('call_center_queue_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_center_queue_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -273,7 +273,7 @@ //echo " ".escape($row[queue_abandoned_resume_allowed])." \n"; //echo " ".escape($row[queue_tier_rule_wait_multiply_level])." \n"; echo " ".escape($row['queue_description'])."\n"; - if (permission_exists('call_center_queue_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_center_queue_edit') && $list_row_edit_button) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/call_centers/resources/classes/call_center.php b/app/call_centers/resources/classes/call_center.php index f84b6e1014..11ce9dc30e 100644 --- a/app/call_centers/resources/classes/call_center.php +++ b/app/call_centers/resources/classes/call_center.php @@ -26,11 +26,8 @@ /** * cache class provides an abstracted cache - * - * @method string dialplan - builds the dialplan for call center */ //define the call center class - if (!class_exists('call_center')) { class call_center { /** * define the variables @@ -611,7 +608,6 @@ } //method } //class - } /* $o = new call_center; @@ -625,5 +621,3 @@ $c->destination_number = ""; $c->queue_cc_exit_keys = ""; $c->dialplan(); */ - -?> diff --git a/app/call_centers/waveform.php b/app/call_centers/waveform.php index 3408037311..04f03fa01e 100644 --- a/app/call_centers/waveform.php +++ b/app/call_centers/waveform.php @@ -27,8 +27,7 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; - + use maximal\audio\Waveform; //check permisions @@ -96,8 +95,8 @@ Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba - Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom - Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis + Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom + Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis $height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null; $wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string } diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index 2cbd2d6a53..85d5182497 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -46,7 +46,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get search $search = $_REQUEST['search'] ?? null; @@ -235,7 +235,7 @@ } echo th_order_by('call_flow_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('call_flow_description', $text['label-call_flow_description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('call_flow_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_flow_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -291,7 +291,7 @@ echo escape($row['call_flow_enabled']); } echo " ".escape($row['call_flow_description'])." \n"; - if (permission_exists('call_flow_edit') && $list_row_edit_button == 'true') { + if (permission_exists('call_flow_edit') && $list_row_edit_button) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/call_flows/resources/classes/call_flows.php b/app/call_flows/resources/classes/call_flows.php index c9a54f66e2..83a2d4497b 100644 --- a/app/call_flows/resources/classes/call_flows.php +++ b/app/call_flows/resources/classes/call_flows.php @@ -25,7 +25,6 @@ */ //define the call_flows class -if (!class_exists('call_flows')) { class call_flows { /** @@ -410,6 +409,3 @@ if (!class_exists('call_flows')) { } //method } //class -} - -?> diff --git a/app/call_flows/waveform.php b/app/call_flows/waveform.php index 3408037311..8b760cd949 100644 --- a/app/call_flows/waveform.php +++ b/app/call_flows/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; @@ -96,8 +95,8 @@ Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba - Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom - Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis + Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom + Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis $height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null; $wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string } diff --git a/app/call_forward/call_forward.php b/app/call_forward/call_forward.php index 45c6c2abbd..e7de481ed3 100644 --- a/app/call_forward/call_forward.php +++ b/app/call_forward/call_forward.php @@ -296,8 +296,8 @@ echo " " . $text['label-dnd'] . "\n"; } echo " " . $text['label-description'] . "\n"; - $list_row_edit_button = $_SESSION['theme']['list_row_edit_button']['boolean'] ?? 'false'; - if ( $list_row_edit_button === 'true') { + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); + if ($list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -402,7 +402,7 @@ echo " \n"; } echo " " . escape($row['description']) . " \n"; - if ($list_row_edit_button === 'true') { + if ($list_row_edit_button) { echo " "; echo button::create(['type' => 'button', 'title' => $text['button-edit'], 'icon' => $_SESSION['theme']['button_icon_edit'], 'link' => $list_row_url]); echo " \n"; diff --git a/app/call_forward/call_forward_edit.php b/app/call_forward/call_forward_edit.php index a1b2bc6e72..c3916334fb 100644 --- a/app/call_forward/call_forward_edit.php +++ b/app/call_forward/call_forward_edit.php @@ -341,7 +341,7 @@ */ //send feature event notify to the phone - if (!empty($_SESSION['device']['feature_sync']['boolean']) && $_SESSION['device']['feature_sync']['boolean'] == "true") { + if (filter_var($_SESSION['device']['feature_sync']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { $ring_count = ceil($call_timeout / 6); $feature_event_notify = new feature_event_notify; $feature_event_notify->domain_name = $_SESSION['domain_name']; @@ -358,7 +358,7 @@ else { $feature_event_notify->forward_all_destination = $forward_all_destination; } - + if ($forward_busy_destination == "") { $feature_event_notify->forward_busy_destination = "0"; } @@ -421,7 +421,6 @@ //synchronize configuration if (!empty($_SESSION['switch']['extensions']['dir']) && is_readable($_SESSION['switch']['extensions']['dir'])) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); @@ -504,7 +503,7 @@ } //prepare the autocomplete - if(!empty($_SESSION['follow_me']['follow_me_autocomplete']['boolean']) && $_SESSION['follow_me']['follow_me_autocomplete']['boolean'] == 'true') { + if(filter_var($_SESSION['follow_me']['follow_me_autocomplete']['boolean'] ?? false, FILTER_VALIDATE_BOOLEAN)) { echo "\n"; echo "\n"; echo " - \n"; + echo " function get_destinations(id, destination_type, action, search) {\n"; + echo " var xhttp = new XMLHttpRequest();\n"; + echo " xhttp.onreadystatechange = function() {\n"; + echo " if (this.readyState == 4 && this.status == 200) {\n"; + echo " document.getElementById(id).innerHTML = this.responseText;\n"; + echo " }\n"; + echo " };\n"; + echo " if (action) {\n"; + echo " xhttp.open(\"GET\", \"/app/destinations/resources/destinations.php?destination_type=\"+destination_type+\"&action=\"+action, true);\n"; + echo " }\n"; + echo " else {\n"; + echo " xhttp.open(\"GET\", \"/app/destinations/resources/destinations.php?destination_type=\"+destination_type, true);\n"; + echo " }\n"; + echo " xhttp.send();\n"; + echo " }\n"; + echo "\n"; //get the destinations $destinations = $this->get($destination_type); @@ -1308,7 +1302,7 @@ if (!class_exists('destinations')) { } //method } //class -} + /* $obj = new destinations; //$destinations = $obj->destinations; @@ -1319,5 +1313,3 @@ echo $obj->select('ivr', 'example4', ''); echo $obj->select('ivr', 'example5', ''); echo $obj->select('ivr', 'example6', ''); */ - -?> diff --git a/app/devices/device_download.php b/app/devices/device_download.php index fdac9dcbb9..529e24cb0f 100644 --- a/app/devices/device_download.php +++ b/app/devices/device_download.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): @@ -252,6 +252,7 @@ $x = 0; foreach ($available_columns as $table_name => $columns) { $table_name_label = ucwords(str_replace(['-','_',],' ', $table_name)); + echo "
\n"; echo "
\n"; echo "".$table_name_label."\n"; echo "
\n"; @@ -284,6 +285,7 @@ echo "\n"; echo "
\n"; echo "
\n"; + echo "
\n"; } } diff --git a/app/devices/device_profiles.php b/app/devices/device_profiles.php index d9cbfe0054..eb2bbc8d7c 100644 --- a/app/devices/device_profiles.php +++ b/app/devices/device_profiles.php @@ -229,7 +229,7 @@ echo th_order_by('device_profile_name', $text['label-device_profile_name'], $order_by, $order); echo th_order_by('device_profile_enabled', $text['label-device_profile_enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('device_profile_description', $text['label-device_profile_description'], $order_by, $order, null, "class='hide-xs'"); - if (permission_exists('device_profile_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('device_profile_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -278,7 +278,7 @@ } echo " \n"; echo " ".escape($row['device_profile_description'])." \n"; - if (permission_exists('device_profile_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('device_profile_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/devices/device_vendor_functions.php b/app/devices/device_vendor_functions.php index 7a7dea5425..fdfa897f5e 100644 --- a/app/devices/device_vendor_functions.php +++ b/app/devices/device_vendor_functions.php @@ -176,7 +176,7 @@ echo "".$text['label-groups']."\n"; echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('device_vendor_function_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('device_vendor_function_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -256,7 +256,7 @@ } echo " \n"; echo " ".escape($row['description'])."\n"; - if (permission_exists('device_vendor_function_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('device_vendor_function_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/devices/device_vendors.php b/app/devices/device_vendors.php index 9aed554771..4543867188 100644 --- a/app/devices/device_vendors.php +++ b/app/devices/device_vendors.php @@ -170,7 +170,7 @@ echo th_order_by('name', $text['label-name'], $order_by, $order); echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-xs'"); - if (permission_exists('device_vendor_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('device_vendor_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -202,7 +202,7 @@ echo $text['label-'.$row['enabled']]; } echo " ".escape($row['description'])." \n"; - if (permission_exists('device_vendor_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('device_vendor_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/devices/resources/classes/device.php b/app/devices/resources/classes/device.php index 899962262e..3ab557c4a9 100644 --- a/app/devices/resources/classes/device.php +++ b/app/devices/resources/classes/device.php @@ -1382,7 +1382,7 @@ //save the array $this->database->app_name = $this->app_name; - $this->databasee->app_uuid = $this->app_uuid; + $this->database->app_uuid = $this->app_uuid; $this->database->save($array); unset($array); diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 7c6a8a44ec..2db18d3f3c 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_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-2024 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -318,7 +318,7 @@ $tmp_prefix == $dialplan_expression ? $outbound_prefix = "" : $outbound_prefix = $tmp_prefix; - + if ($gateway_type == "gateway") { $dialplan_name = $gateway_name.".".$abbrv; if ($abbrv == "988") { @@ -863,7 +863,7 @@ } else { $sql .= "and domain_uuid = :domain_uuid "; - + } $parameters['domain_uuid'] = $domain_uuid; $database = new database; @@ -939,6 +939,7 @@ function type_onchange(dialplan_detail_type) { echo $text['description-outbound-routes']."\n"; echo "

\n"; + echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo "
\n"; @@ -1346,17 +1347,18 @@ function type_onchange(dialplan_detail_type) { echo "
"; - echo "

"; + echo "\n"; + echo "
\n"; + echo "

\n"; if (!empty($action) && $action == "update") { echo "\n"; } echo "\n"; - echo ""; + echo "\n"; //show the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> diff --git a/app/dialplans/dialplan_xml.php b/app/dialplans/dialplan_xml.php index 7ee63f5d36..4fa94cc679 100644 --- a/app/dialplans/dialplan_xml.php +++ b/app/dialplans/dialplan_xml.php @@ -181,9 +181,9 @@ // 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'; - $setting_invisibles = isset($_SESSION["editor"]["invisibles"]["boolean"]) && $_SESSION["editor"]["invisibles"]["boolean"] != '' ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false'; - $setting_indenting = isset($_SESSION["editor"]["indent_guides"]["boolean"]) && $_SESSION["editor"]["indent_guides"]["boolean"] != '' ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false'; - $setting_numbering = isset($_SESSION["editor"]["line_numbers"]["boolean"]) && $_SESSION["editor"]["line_numbers"]["boolean"] != '' ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true'; + $setting_invisibles = isset($_SESSION['editor']['invisibles']['text']) ? $_SESSION['editor']['invisibles']["text"] : 'false'; + $setting_indenting = isset($_SESSION['editor']['indent_guides']['text']) ? $_SESSION['editor']['indent_guides']["text"]: 'false'; + $setting_numbering = isset($_SESSION['editor']['line_numbers']['text']) ? $_SESSION['editor']['line_numbers']["text"] : 'true'; //create token $object = new token; diff --git a/app/dialplans/dialplans.php b/app/dialplans/dialplans.php index 81c7f11b16..8b43fee286 100644 --- a/app/dialplans/dialplans.php +++ b/app/dialplans/dialplans.php @@ -134,15 +134,15 @@ $show = !empty($_GET["show"]) ? $_GET["show"] : ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; - $button_icon_add = !empty($_SESSION['theme']['button_icon_add']) ? $_SESSION['theme']['button_icon_add'] : ''; - $button_icon_copy = !empty($_SESSION['theme']['button_icon_copy']) ? $_SESSION['theme']['button_icon_copy'] : ''; - $button_icon_toggle = !empty($_SESSION['theme']['button_icon_toggle']) ? $_SESSION['theme']['button_icon_toggle'] : ''; - $button_icon_all = !empty($_SESSION['theme']['button_icon_all']) ? $_SESSION['theme']['button_icon_all'] : ''; - $button_icon_delete = !empty($_SESSION['theme']['button_icon_delete']) ? $_SESSION['theme']['button_icon_delete'] : ''; - $button_icon_search = !empty($_SESSION['theme']['button_icon_search']) ? $_SESSION['theme']['button_icon_search'] : ''; - $button_icon_edit = !empty($_SESSION['theme']['button_icon_edit']) ? $_SESSION['theme']['button_icon_edit'] : ''; - $button_icon_reset = !empty($_SESSION['theme']['button_icon_reset']) ? $_SESSION['theme']['button_icon_reset'] : ''; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); + $button_icon_add = $_SESSION['theme']['button_icon_add'] ?? ''; + $button_icon_copy = $_SESSION['theme']['button_icon_copy'] ?? ''; + $button_icon_toggle = $_SESSION['theme']['button_icon_toggle'] ?? ''; + $button_icon_all = $_SESSION['theme']['button_icon_all'] ?? ''; + $button_icon_delete = $_SESSION['theme']['button_icon_delete'] ?? ''; + $button_icon_search = $_SESSION['theme']['button_icon_search'] ?? ''; + $button_icon_edit = $_SESSION['theme']['button_icon_edit'] ?? ''; + $button_icon_reset = $_SESSION['theme']['button_icon_reset'] ?? ''; //get the number of rows in the dialplan $sql = "select count(*) from v_dialplans "; @@ -541,7 +541,7 @@ ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && permission_exists('outbound_route_edit')) || ($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7" && permission_exists('fifo_edit')) || ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) || - permission_exists('dialplan_edit')) && $list_row_edit_button == 'true' + permission_exists('dialplan_edit')) && $list_row_edit_button ) { echo "  \n"; } @@ -625,7 +625,7 @@ } echo " \n"; echo " ".escape($row['dialplan_description'])." \n"; - if ($list_row_edit_button == 'true' && ( + if ($list_row_edit_button && ( (!is_uuid($app_uuid) && permission_exists('dialplan_edit')) || ($row['app_uuid'] == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) || ($row['app_uuid'] == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && permission_exists('outbound_route_edit')) || diff --git a/app/dialplans/resources/classes/dialplan.php b/app/dialplans/resources/classes/dialplan.php index 5c5b1cee7b..0147b6b313 100644 --- a/app/dialplans/resources/classes/dialplan.php +++ b/app/dialplans/resources/classes/dialplan.php @@ -25,7 +25,6 @@ */ //define the dialplan class - if (!class_exists('dialplan')) { class dialplan { //variables @@ -1580,6 +1579,3 @@ } //class - } - -?> diff --git a/app/email_queue/email_queue.php b/app/email_queue/email_queue.php index 13e1d92e8e..4b56e90628 100644 --- a/app/email_queue/email_queue.php +++ b/app/email_queue/email_queue.php @@ -329,7 +329,7 @@ echo th_order_by('email_retry_count', $text['label-email_retry_count'], $order_by, $order); //echo th_order_by('email_action_before', $text['label-email_action_before'], $order_by, $order); echo "".$text['label-email_action_after']."\n"; - if (permission_exists('email_queue_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('email_queue_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -373,7 +373,7 @@ echo " ".escape($row['email_retry_count'])."\n"; //echo " ".escape($row['email_action_before'])."\n"; echo " ".escape($row['email_action_after'])."\n"; - if (permission_exists('email_queue_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('email_queue_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/email_queue/email_queue_edit.php b/app/email_queue/email_queue_edit.php index 882ece7875..c29b29cdf5 100644 --- a/app/email_queue/email_queue_edit.php +++ b/app/email_queue/email_queue_edit.php @@ -236,9 +236,9 @@ //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'; - $setting_invisibles = !empty($_SESSION["editor"]["invisibles"]["boolean"]) ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false'; - $setting_indenting = !empty($_SESSION["editor"]["indent_guides"]["boolean"]) ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false'; - $setting_numbering = !empty($_SESSION["editor"]["line_numbers"]["boolean"]) ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true'; + $setting_invisibles = isset($_SESSION['editor']['invisibles']['text']) ? $_SESSION['editor']['invisibles']["text"] : 'false'; + $setting_indenting = isset($_SESSION['editor']['indent_guides']['text']) ? $_SESSION['editor']['indent_guides']["text"]: 'false'; + $setting_numbering = isset($_SESSION['editor']['line_numbers']['text']) ? $_SESSION['editor']['line_numbers']["text"] : 'true'; //create token $object = new token; @@ -518,7 +518,7 @@ echo "\n"; echo "\n"; - if ($_SESSION['email_queue']['save_response']['boolean'] == 'true') { + if (filter_var($_SESSION['email_queue']['save_response']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "\n"; echo "\n"; echo " ".$text['label-email_response']."\n"; diff --git a/app/email_queue/resources/classes/email_queue.php b/app/email_queue/resources/classes/email_queue.php index 77bc6542ee..a7efc72c7e 100644 --- a/app/email_queue/resources/classes/email_queue.php +++ b/app/email_queue/resources/classes/email_queue.php @@ -2,12 +2,7 @@ /** * email_queue class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('email_queue')) { class email_queue { /** @@ -225,6 +220,3 @@ if (!class_exists('email_queue')) { } } -} - -?> diff --git a/app/email_queue/resources/jobs/email_queue.php b/app/email_queue/resources/jobs/email_queue.php index 9e1d3952eb..0167e54796 100755 --- a/app/email_queue/resources/jobs/email_queue.php +++ b/app/email_queue/resources/jobs/email_queue.php @@ -11,7 +11,6 @@ //includes files require_once "resources/pdo.php"; - include "resources/classes/permissions.php"; require $_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/functions/transcribe.php"; //increase limits diff --git a/app/email_queue/resources/jobs/email_send.php b/app/email_queue/resources/jobs/email_send.php index bdfa84c3d1..a0b3f8d213 100755 --- a/app/email_queue/resources/jobs/email_send.php +++ b/app/email_queue/resources/jobs/email_send.php @@ -10,7 +10,6 @@ } //include files - include "resources/classes/permissions.php"; include_once "resources/phpmailer/class.phpmailer.php"; include_once "resources/phpmailer/class.smtp.php"; @@ -298,7 +297,7 @@ //echo "Body: ".$email_body."\n"; //update the message transcription - if (isset($voicemail_transcription_enabled) && $voicemail_transcription_enabled == 'true' && isset($transcribe_message)) { + if (isset($voicemail_transcription_enabled) && $voicemail_transcription_enabled && isset($transcribe_message)) { $sql = "update v_voicemail_messages "; $sql .= "set message_transcription = :message_transcription "; $sql .= "where voicemail_message_uuid = :voicemail_message_uuid; "; diff --git a/app/email_queue/resources/service/email_queue.php b/app/email_queue/resources/service/email_queue.php index f12a023502..684dbc7b8e 100644 --- a/app/email_queue/resources/service/email_queue.php +++ b/app/email_queue/resources/service/email_queue.php @@ -9,9 +9,6 @@ exit; } -//include files - include "resources/classes/permissions.php"; - //increase limits set_time_limit(0); ini_set('max_execution_time', 0); diff --git a/app/emergency/app_languages.php b/app/emergency/app_languages.php index 455852ef7d..65ba296d10 100644 --- a/app/emergency/app_languages.php +++ b/app/emergency/app_languages.php @@ -162,4 +162,58 @@ $text['label-emergency_event']['zh-cn'] = "事件"; $text['label-emergency_event']['ja-jp'] = "イベント"; $text['label-emergency_event']['ko-kr'] = "이벤트"; +$text['label-emergency_call_status']['en-us'] = "Call Status"; +$text['label-emergency_call_status']['en-gb'] = "Call Status"; +$text['label-emergency_call_status']['ar-eg'] = ""; +$text['label-emergency_call_status']['de-at'] = ""; +$text['label-emergency_call_status']['de-ch'] = ""; +$text['label-emergency_call_status']['de-de'] = ""; +$text['label-emergency_call_status']['el-gr'] = ""; +$text['label-emergency_call_status']['es-cl'] = ""; +$text['label-emergency_call_status']['es-mx'] = ""; +$text['label-emergency_call_status']['fr-ca'] = ""; +$text['label-emergency_call_status']['fr-fr'] = ""; +$text['label-emergency_call_status']['he-il'] = ""; +$text['label-emergency_call_status']['it-it'] = ""; +$text['label-emergency_call_status']['ka-ge'] = ""; +$text['label-emergency_call_status']['nl-nl'] = ""; +$text['label-emergency_call_status']['pl-pl'] = ""; +$text['label-emergency_call_status']['pt-br'] = ""; +$text['label-emergency_call_status']['pt-pt'] = ""; +$text['label-emergency_call_status']['ro-ro'] = ""; +$text['label-emergency_call_status']['ru-ru'] = ""; +$text['label-emergency_call_status']['sv-se'] = ""; +$text['label-emergency_call_status']['uk-ua'] = ""; +$text['label-emergency_call_status']['tr-tr'] = ""; +$text['label-emergency_call_status']['zh-cn'] = ""; +$text['label-emergency_call_status']['ja-jp'] = ""; +$text['label-emergency_call_status']['ko-kr'] = ""; + +$text['label-recording']['en-us'] = "Recording"; +$text['label-recording']['en-gb'] = "Recording"; +$text['label-recording']['ar-eg'] = "تسجيل"; +$text['label-recording']['de-at'] = "Aufnahme"; +$text['label-recording']['de-ch'] = "Aufnahme"; +$text['label-recording']['de-de'] = "Aufnahme"; +$text['label-recording']['el-gr'] = "Εγγραφή"; +$text['label-recording']['es-cl'] = "Grabación"; +$text['label-recording']['es-mx'] = "Grabación"; +$text['label-recording']['fr-ca'] = "Enregistrement"; +$text['label-recording']['fr-fr'] = "Enregistrement"; +$text['label-recording']['he-il'] = "הקלטה"; +$text['label-recording']['it-it'] = "Registrazione"; +$text['label-recording']['ka-ge'] = "ჩანაწერი"; +$text['label-recording']['nl-nl'] = "Opname"; +$text['label-recording']['pl-pl'] = "Nagranie"; +$text['label-recording']['pt-br'] = "Gravação"; +$text['label-recording']['pt-pt'] = "Gravação"; +$text['label-recording']['ro-ro'] = "Înregistrare"; +$text['label-recording']['ru-ru'] = "Запись"; +$text['label-recording']['sv-se'] = "Inspelning"; +$text['label-recording']['uk-ua'] = "Запис"; +$text['label-recording']['tr-tr'] = "Kayıt"; +$text['label-recording']['zh-cn'] = "记录"; +$text['label-recording']['ja-jp'] = "録音"; +$text['label-recording']['ko-kr'] = "녹음"; + ?> diff --git a/app/emergency/download.php b/app/emergency/download.php new file mode 100644 index 0000000000..7e2e09200e --- /dev/null +++ b/app/emergency/download.php @@ -0,0 +1,48 @@ + + Portions created by the Initial Developer are Copyright (C) 2016-2020 + 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"; + +//check permisions + if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//download + if (is_uuid($_GET['id'])) { + $obj = new call_recordings; + $obj->recording_uuid = $_GET['id']; + $obj->binary = isset($_GET['binary']) ? true : false; + $obj->download(); + } + +?> diff --git a/app/emergency/emergency.php b/app/emergency/emergency.php index 6452043b3c..d592926679 100644 --- a/app/emergency/emergency.php +++ b/app/emergency/emergency.php @@ -30,6 +30,14 @@ $database = new database; $database->app_name = 'emergency_logs'; $database->app_uuid = 'de63b1ae-7750-11ee-b3a5-005056a27559'; +//set permissions for CDR details and call recordings +$permission = array(); +$permission['xml_cdr_hangup_cause'] = permission_exists('xml_cdr_hangup_cause'); +$permission['xml_cdr_status'] = permission_exists('xml_cdr_status'); +$permission['xml_cdr_recording'] = permission_exists('xml_cdr_recording'); +$permission['xml_cdr_recording_play'] = permission_exists('xml_cdr_recording_play'); +$permission['xml_cdr_recording_download'] = permission_exists('xml_cdr_recording_download'); + //process the http post data by action if (!empty($action) && !empty($emergency_logs) && is_array($emergency_logs) && @sizeof($emergency_logs) != 0) { @@ -115,31 +123,38 @@ else { } //get the list -$sql = "select emergency_log_uuid, "; -$sql .= "domain_uuid, "; -$sql .= "extension, "; -$sql .= "event, "; -$sql .= "to_char(timezone(:time_zone, insert_date), 'DD Mon YYYY') as date_formatted, "; -$sql .= "to_char(timezone(:time_zone, insert_date), 'HH12:MI:SS am') as time_formatted, "; -$sql .= "insert_date "; -$sql .= "from v_emergency_logs "; +$sql = "select e.emergency_log_uuid, "; +$sql .= "e.domain_uuid, "; +$sql .= "e.extension, "; +$sql .= "e.event, "; +$sql .= "to_char(timezone(:time_zone, e.insert_date), 'DD Mon YYYY') as date_formatted, "; +$sql .= "to_char(timezone(:time_zone, e.insert_date), 'HH12:MI:SS am') as time_formatted, "; +$sql .= "e.insert_date, "; +$sql .= "c.status as status, "; +$sql .= "concat(c.record_path, '/', c.record_name) as recording, "; //temp +$sql .= "c.record_path as call_recording_path, "; +$sql .= "c.record_name as call_recording_name "; +$sql .= "from v_emergency_logs e "; +$sql .= "left join v_xml_cdr c "; +$sql .= "on e.emergency_log_uuid = c.xml_cdr_uuid "; if ($show == 'all') { $sql .= "where true "; } else { - $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "where e.domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; } if (!empty($search)) { $sql .= "and ( "; - $sql .= " lower(event) like :search "; + $sql .= " lower(e.event) like :search "; $sql .= ") "; $parameters['search'] = '%'.$search.'%'; } -$sql .= "order by insert_date desc "; +$sql .= "order by e.insert_date desc "; $sql .= limit_offset($rows_per_page, $offset); $parameters['time_zone'] = $time_zone; $emergency_logs = $database->select($sql, $parameters ?? null, 'all'); + unset($sql, $parameters); //create token @@ -193,6 +208,12 @@ echo "".$text['label-emergency_date']."\n"; echo "".$text['label-emergency_time']."\n"; echo "".$text['label-emergency_extension']."\n"; echo "".$text['label-emergency_event']."\n"; +if ($permission['xml_cdr_recording'] && ($permission['xml_cdr_recording_play'] || $permission['xml_cdr_recording_download'])) { + echo "".$text['label-recording']."\n"; +} +if ($permission['xml_cdr_status'] || $permission['xml_cdr_hangup_cause']) { + echo "".$text['label-emergency_call_status']."\n"; +} echo "\n"; if (!empty($emergency_logs) && is_array($emergency_logs) && @sizeof($emergency_logs) != 0) { @@ -206,6 +227,43 @@ if (!empty($emergency_logs) && is_array($emergency_logs) && @sizeof($emergency_l echo " ".escape($row['time_formatted'])."\n"; echo " ".escape($row['extension'])."\n"; echo " ".escape($row['event'])."\n"; + if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) { + echo " "; + if ($row['recording'] !== '/') { + if (permission_exists('call_recording_play')) { + $recording_file_ext = pathinfo($row['call_recording_name'], PATHINFO_EXTENSION); + switch ($recording_file_ext) { + case "wav" : $recording_type = "audio/wav"; break; + case "mp3" : $recording_type = "audio/mpeg"; break; + case "ogg" : $recording_type = "audio/ogg"; break; + } + echo ""; + echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.escape($row['emergency_log_uuid']),'onclick'=>"recording_play('".escape($row['emergency_log_uuid'])."')"]); + } + if (permission_exists('call_recording_download')) { + echo button::create(['type'=>'button','title'=>$text['label-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>'download.php?id='.urlencode($row['emergency_log_uuid']).'&binary']); + } + } + echo " \n"; + } +// debug: display file directory and filename of the call recording + /* + if ($permission['xml_cdr_recording'] && ($permission['xml_cdr_recording_play'] || $permission['xml_cdr_recording_download'])) { + if ($row['recording'] !== '/') { + echo "" . escape($row['recording']) . "\n"; + } + } + */ + $domain_name = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; + if ($permission['xml_cdr_status'] || $permission['xml_cdr_hangup_cause']) { + if (!empty($_GET['show']) && $_GET['show'] == 'all' && permission_exists('emergency_logs_view_all')) { + echo " " . (isset($row['status']) && $row['status'] !== '' ? "".escape($row['status'])."" : ' ') . "\n"; + } + else { + //echo " " . (isset($row['status']) && $row['status'] !== '' ? escape($row['status']) : '') . "\n"; + echo " " . (isset($row['status']) && $row['status'] !== '' ? "".escape($row['status'])."" : ' ') . "\n"; + } + } echo "\n"; $x++; } diff --git a/app/event_guard/event_guard_logs.php b/app/event_guard/event_guard_logs.php index 38dce4027f..d2cb196070 100644 --- a/app/event_guard/event_guard_logs.php +++ b/app/event_guard/event_guard_logs.php @@ -236,7 +236,7 @@ echo th_order_by('extension', $text['label-extension'], $order_by, $order); echo "".$text['label-user_agent']."\n"; echo th_order_by('log_status', $text['label-log_status'], $order_by, $order); - if (permission_exists('event_guard_log_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('event_guard_log_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -277,7 +277,7 @@ echo " ".escape($row['extension'])."\n"; echo " ".escape($row['user_agent'])."\n"; echo " ".escape($text['label-'.$row['log_status']])."\n"; - if (permission_exists('event_guard_log_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('event_guard_log_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/event_guard/resources/classes/event_guard.php b/app/event_guard/resources/classes/event_guard.php index 02bafd1bc2..69ff9aefcf 100644 --- a/app/event_guard/resources/classes/event_guard.php +++ b/app/event_guard/resources/classes/event_guard.php @@ -26,12 +26,7 @@ /** * event_guard_logs class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('event_guard')) { class event_guard { /** @@ -303,6 +298,3 @@ if (!class_exists('event_guard')) { } } -} - -?> diff --git a/app/extension_settings/extension_settings.php b/app/extension_settings/extension_settings.php index 0b6d568ae8..c2716b6afb 100644 --- a/app/extension_settings/extension_settings.php +++ b/app/extension_settings/extension_settings.php @@ -44,7 +44,7 @@ $id = ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get the http post data if (!empty($_POST['extension_settings'])) { @@ -272,7 +272,7 @@ echo " ".$text['label-extension_setting_enabled']."\n"; echo " ".$text['label-extension_setting_description']."\n"; - if (permission_exists('extension_setting_edit') && $list_row_edit_button == 'true') { + if (permission_exists('extension_setting_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -305,7 +305,7 @@ } echo " \n"; echo " ".escape($row['extension_setting_description'])."\n"; - if (permission_exists('extension_setting_edit') && $list_row_edit_button == 'true') { + if (permission_exists('extension_setting_edit') && $list_row_edit_button) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/extension_settings/resources/classes/extension_settings.php b/app/extension_settings/resources/classes/extension_settings.php index b473669e9d..15c5b2cc01 100644 --- a/app/extension_settings/resources/classes/extension_settings.php +++ b/app/extension_settings/resources/classes/extension_settings.php @@ -26,12 +26,7 @@ /** * extension_settings class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('extension_settings')) { class extension_settings { /** @@ -272,6 +267,3 @@ if (!class_exists('extension_settings')) { } } -} - -?> diff --git a/app/extensions/app_languages.php b/app/extensions/app_languages.php index ee1eee2d55..36b623abf6 100644 --- a/app/extensions/app_languages.php +++ b/app/extensions/app_languages.php @@ -2698,32 +2698,32 @@ $text['description-voicemail_password']['zh-cn'] = "在此处输入数字语音 $text['description-voicemail_password']['ja-jp'] = "ここに数値のボイスメール パスワードを入力します。"; $text['description-voicemail_password']['ko-kr'] = "여기에 숫자 음성사서함 암호를 입력합니다."; -$text['description-voicemail_mail_to']['en-us'] = "Enter the email address to send voicemail to (optional)."; -$text['description-voicemail_mail_to']['en-gb'] = "Enter the email address to send voicemail to (optional)."; -$text['description-voicemail_mail_to']['ar-eg'] = "أدخل العنوان الإلكتروني لإرسال البريد الصوتي إلى (اختياري)."; -$text['description-voicemail_mail_to']['de-at'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['de-ch'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['de-de'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['el-gr'] = "Εισαγάγετε τη διεύθυνση email στην οποία θα στείλετε αυτόματο τηλεφωνητή (προαιρετικό)."; -$text['description-voicemail_mail_to']['es-cl'] = "Ingrese una dirección de correo electrónico para enviar el correo de voz (opcional)."; -$text['description-voicemail_mail_to']['es-mx'] = "Ingrese una dirección de correo electrónico para enviar el correo de voz (opcional)."; -$text['description-voicemail_mail_to']['fr-ca'] = "Insérer le courriel où sera envoyé le message de notification (optionnel)."; -$text['description-voicemail_mail_to']['fr-fr'] = "Insérer le courriel où sera envoyé le message de notification (optionnel)."; -$text['description-voicemail_mail_to']['he-il'] = "היכנס לכתובת הדואר האלקטרוני כדי לשלוח הודעות קוליות (אופציונלי)."; -$text['description-voicemail_mail_to']['it-it'] = "Inserire l'indirizzo email a cui recapitare i messaggi vocali (opzionale)."; -$text['description-voicemail_mail_to']['ka-ge'] = "შეიყვანეთ ელფოსტის მისამართი, რომელზეც ხმოვანი ფოსტა გამოიგზავნება (არასავალდებულო)."; -$text['description-voicemail_mail_to']['nl-nl'] = "Voer het E-mail adres om de voicemail naar te sturen (optioneel)."; -$text['description-voicemail_mail_to']['pl-pl'] = "Dodaj adres email na który będą wysyłane pliki poczty głosowej"; -$text['description-voicemail_mail_to']['pt-br'] = "Insira o endereço de email para enviar o correio de voz (opcional)."; -$text['description-voicemail_mail_to']['pt-pt'] = "Introduza o endereço de email para enviar o correio de voz (opcional)."; -$text['description-voicemail_mail_to']['ro-ro'] = "Introduceți adresa de e-mail la care trimiteți mesajul vocal (opțional)."; -$text['description-voicemail_mail_to']['ru-ru'] = "Введите адрес электронной почты, чтобы отправить голосовую почту (опционально)."; -$text['description-voicemail_mail_to']['sv-se'] = "Ange E-post adressen för röstbrevlådan (valfritt)."; -$text['description-voicemail_mail_to']['uk-ua'] = "Введіть адресу електронної пошти для відправки голосового повідомлення (за бажанням)."; -$text['description-voicemail_mail_to']['tr-tr'] = "Sesli mesajın gönderileceği e-posta adresini girin (isteğe bağlı)."; -$text['description-voicemail_mail_to']['zh-cn'] = "输入要向其发送语音邮件的电子邮件地址(可选)。"; -$text['description-voicemail_mail_to']['ja-jp'] = "ボイスメールの送信先の電子メール アドレスを入力します (オプション)。"; -$text['description-voicemail_mail_to']['ko-kr'] = "음성 메일을 보낼 이메일 주소를 입력합니다(선택 사항)."; +$text['description-voicemail_mail_to']['en-us'] = "Enter the email address to send voicemail to (optional). Multiple addresses may be separated by commas."; +$text['description-voicemail_mail_to']['en-gb'] = "Enter the email address to send voicemail to (optional). Multiple addresses may be separated by commas."; +$text['description-voicemail_mail_to']['ar-eg'] = "أدخل عنوان البريد الإلكتروني لإرسال البريد الصوتي إليه (اختياري). يمكن فصل العناوين المتعددة بفواصل."; +$text['description-voicemail_mail_to']['de-at'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['de-ch'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['de-de'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['el-gr'] = "Εισαγάγετε τη διεύθυνση email για αποστολή του φωνητικού μηνύματος (προαιρετικό). Πολλαπλές διευθύνσεις μπορούν να διαχωριστούν με κόμματα."; +$text['description-voicemail_mail_to']['es-cl'] = "Ingrese la dirección de correo electrónico para enviar el correo de voz (opcional). Se pueden separar múltiples direcciones con comas."; +$text['description-voicemail_mail_to']['es-mx'] = "Ingrese la dirección de correo electrónico para enviar el correo de voz (opcional). Se pueden separar múltiples direcciones con comas."; +$text['description-voicemail_mail_to']['fr-ca'] = "Entrez l'adresse e-mail à laquelle envoyer la messagerie vocale (facultatif). Plusieurs adresses peuvent être séparées par des virgules."; +$text['description-voicemail_mail_to']['fr-fr'] = "Entrez l'adresse e-mail à laquelle envoyer la messagerie vocale (facultatif). Plusieurs adresses peuvent être séparées par des virgules."; +$text['description-voicemail_mail_to']['he-il'] = "הזן את כתובת האימייל לשליחת הדואר הקולי (אופציונלי). ניתן להפריד בין כתובות מרובות באמצעות פסיקים."; +$text['description-voicemail_mail_to']['it-it'] = "Inserisci l'indirizzo email a cui inviare la segreteria telefonica (opzionale). Più indirizzi possono essere separati da virgole."; +$text['description-voicemail_mail_to']['ka-ge'] = "შეიყვანეთ ელ.ფოსტის მისამართი, რომელზეც გაიგზავნება ხმოვანი ფოსტა (არასავალდებულო). შესაძლებელია მრავალი მისამართის მძიმით გამოყოფა."; +$text['description-voicemail_mail_to']['nl-nl'] = "Voer het e-mailadres in om de voicemail naartoe te sturen (optioneel). Meerdere adressen kunnen worden gescheiden door komma's."; +$text['description-voicemail_mail_to']['pl-pl'] = "Wprowadź adres e-mail, na który ma zostać wysłana poczta głosowa (opcjonalnie). Wiele adresów można oddzielić przecinkami."; +$text['description-voicemail_mail_to']['pt-br'] = "Digite o endereço de e-mail para enviar o correio de voz (opcional). Vários endereços podem ser separados por vírgulas."; +$text['description-voicemail_mail_to']['pt-pt'] = "Digite o endereço de e-mail para enviar o correio de voz (opcional). Vários endereços podem ser separados por vírgulas."; +$text['description-voicemail_mail_to']['ro-ro'] = "Introduceți adresa de e-mail la care se va trimite mesageria vocală (opțional). Mai multe adrese pot fi separate prin virgule."; +$text['description-voicemail_mail_to']['ru-ru'] = "Введите адрес электронной почты для отправки голосовой почты (необязательно). Несколько адресов можно разделять запятыми."; +$text['description-voicemail_mail_to']['sv-se'] = "Ange e-postadressen som röstbrevet ska skickas till (valfritt). Flera adresser kan separeras med kommatecken."; +$text['description-voicemail_mail_to']['uk-ua'] = "Введіть адресу електронної пошти для надсилання голосової пошти (необов’язково). Декілька адрес можна розділити комами."; +$text['description-voicemail_mail_to']['tr-tr'] = "Sesli mesajın gönderileceği e-posta adresini girin (isteğe bağlı). Birden fazla adres virgülle ayrılabilir."; +$text['description-voicemail_mail_to']['zh-cn'] = "输入要发送语音邮件的电子邮件地址(可选)。多个地址可用逗号分隔。"; +$text['description-voicemail_mail_to']['ja-jp'] = "ボイスメールを送信するメールアドレスを入力してください(オプション)。複数のアドレスはコンマで区切ることができます。"; +$text['description-voicemail_mail_to']['ko-kr'] = "보이스메일을 보낼 이메일 주소를 입력하세요(선택 사항). 여러 개의 주소는 쉼표로 구분할 수 있습니다."; $text['description-voicemail_local_after_email']['en-us'] = "Choose whether to keep the voicemail in the system after sending the email notification."; $text['description-voicemail_local_after_email']['en-gb'] = "Choose whether to keep the voicemail in the system after sending the email notification."; diff --git a/app/extensions/extension_copy.php b/app/extensions/extension_copy.php index 9148d21b6b..0aeca685a4 100644 --- a/app/extensions/extension_copy.php +++ b/app/extensions/extension_copy.php @@ -186,7 +186,6 @@ //synchronize configuration if (is_writable($_SESSION['switch']['extensions']['dir'])) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 0bddf373df..f99c45b1b6 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -850,7 +850,6 @@ //synchronize configuration if (is_writable($switch_extensions)) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); @@ -2037,7 +2036,6 @@ echo " ".$text['label-hold_music']."\n"; echo "\n"; echo "\n"; - require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $options = ''; $moh = new switch_music_on_hold; echo $moh->select('hold_music', $hold_music ?? '', $options); diff --git a/app/extensions/extensions.php b/app/extensions/extensions.php index fac86bdfb3..6a1b23ff72 100644 --- a/app/extensions/extensions.php +++ b/app/extensions/extensions.php @@ -331,7 +331,7 @@ } echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('extension_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('extension_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -425,7 +425,7 @@ } echo " \n"; echo " ".escape($row['description'])."\n"; - if (permission_exists('extension_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('extension_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php index 8a8eab1afa..53d0f9f90a 100644 --- a/app/extensions/resources/classes/extension.php +++ b/app/extensions/resources/classes/extension.php @@ -25,7 +25,6 @@ */ //define the directory class -if (!class_exists('extension')) { class extension { /** @@ -795,6 +794,3 @@ if (!class_exists('extension')) { } } -} - -?> diff --git a/app/fax/fax.php b/app/fax/fax.php index 125a7b1305..84c26ba525 100644 --- a/app/fax/fax.php +++ b/app/fax/fax.php @@ -239,7 +239,7 @@ echo th_order_by('fax_email', $text['label-email'], $order_by, $order); echo " ".$text['label-tools'].""; echo th_order_by('fax_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('fax_extension_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('fax_extension_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -305,7 +305,7 @@ echo " \n"; echo " ".escape($row['fax_description'])." \n"; - if (permission_exists('fax_extension_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('fax_extension_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index a22080e67c..8a52178671 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -29,7 +29,6 @@ require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/functions/object_to_array.php"; require_once "resources/functions/parse_message.php"; -require_once "resources/classes/text.php"; //get accounts to monitor $sql = "select d.domain_name, f.* "; diff --git a/app/fax/fax_logs.php b/app/fax/fax_logs.php index b3e4ea1f73..7560845a50 100644 --- a/app/fax/fax_logs.php +++ b/app/fax/fax_logs.php @@ -179,7 +179,7 @@ //echo th_order_by('fax_retry_sleep', $text['label-fax_retry_sleep'], $order_by, $order); echo th_order_by('fax_uri', $text['label-fax_destination'], $order_by, $order, null, null, "&id=".$fax_uuid); //echo th_order_by('fax_epoch', $text['label-fax_epoch'], $order_by, $order); - if (!empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -213,7 +213,7 @@ //echo " ".$row['fax_retry_sleep']." \n"; echo " ".basename($row['fax_uri'])." \n"; //echo " ".$row['fax_epoch']." \n"; - if (!empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 9c6b59e9f7..6a1996df08 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.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): @@ -28,22 +28,25 @@ Corey Moullas */ +//includes files + require_once dirname(__DIR__, 2) . "/resources/require.php"; + //check if windows if (stristr(PHP_OS, 'WIN')) { $IS_WINDOWS = true; } else { $IS_WINDOWS = false; } -//executed via command line -if (defined('STDIN')) { +//command line + if (defined('STDIN')) { - //add multi-lingual support - $language = new text; - $text = $language->get($setting->get('domain','language','en-us'), 'app/fax'); + //add multi-lingual support + $language = new text; + $text = $language->get($settings->get('domain','language','en-us'), 'app/fax'); -} -//executed via browser -else { + } - //includes files - require_once dirname(__DIR__, 2) . "/resources/require.php"; +//web server + if (!defined('STDIN')) { + + //additional include require_once "resources/check_auth.php"; //set the domain_uuid and domain_name @@ -51,11 +54,6 @@ else { $domain_name = $_SESSION['domain_name']; $user_uuid = $_SESSION['user_uuid']; - //initialize the settings object - if (empty($settings)) { - $setting = new settings(["domain_uuid" => $domain_uuid]); - } - //check permissions if (permission_exists('fax_send')) { //access granted @@ -121,12 +119,12 @@ else { } //set the fax directory - if (!empty($setting->get('switch','storage'))) { - $fax_dir = $setting->get('switch','storage').'/fax/'.$domain_name; + if (!empty($settings->get('switch','storage'))) { + $fax_dir = $settings->get('switch','storage').'/fax/'.$domain_name; } //set fax cover font to generate pdf - $fax_cover_font = $setting->get('fax','cover_font') ?? null; + $fax_cover_font = $settings->get('fax','cover_font') ?? null; } //define function correct_path @@ -171,14 +169,14 @@ if (!function_exists('fax_split_dtmf')) { $dir_fax_temp = $fax_dir.'/'.$fax_extension.'/temp'; //make sure the directories exist - if (!empty($setting->get('switch','storage')) && !is_dir($setting->get('switch','storage'))) { - mkdir($setting->get('switch','storage'), 0770); + if (!empty($settings->get('switch','storage')) && !is_dir($settings->get('switch','storage'))) { + mkdir($settings->get('switch','storage'), 0770); } - if (!empty($setting->get('switch','storage')) && !is_dir($setting->get('switch','storage').'/fax')) { - mkdir($setting->get('switch','storage').'/fax', 0770); + if (!empty($settings->get('switch','storage')) && !is_dir($settings->get('switch','storage').'/fax')) { + mkdir($settings->get('switch','storage').'/fax', 0770); } - if (!empty($setting->get('switch','storage')) && !is_dir($setting->get('switch','storage').'/fax/'.$domain_name)) { - mkdir($setting->get('switch','storage').'/fax/'.$domain_name, 0770); + if (!empty($settings->get('switch','storage')) && !is_dir($settings->get('switch','storage').'/fax/'.$domain_name)) { + mkdir($settings->get('switch','storage').'/fax/'.$domain_name, 0770); } if (!is_dir($fax_dir.'/'.$fax_extension)) { mkdir($fax_dir.'/'.$fax_extension, 0770); @@ -301,7 +299,7 @@ if (!function_exists('fax_split_dtmf')) { } //un/authorized file extensions - $allowed_file_extensions = $setting->get('fax','allowed_extension'); + $allowed_file_extensions = $settings->get('fax','allowed_extension'); $disallowed_file_extensions = explode(',','sh,ssh,so,dll,exe,bat,vbs,zip,rar,z,tar,tbz,tgz,gz'); //process uploaded or emailed files (if any) @@ -410,19 +408,19 @@ if (!function_exists('fax_split_dtmf')) { //logo $display_logo = false; - if (empty($setting->get('fax','cover_logo'))) { + if (empty($settings->get('fax','cover_logo'))) { $logo = ''; //explicitly empty } - else if ($setting->get('fax','cover_logo') != '') { - if (substr($setting->get('fax','cover_logo'), 0, 4) == 'http') { - $logo = $setting->get('fax','cover_logo'); + else if ($settings->get('fax','cover_logo') != '') { + if (substr($settings->get('fax','cover_logo'), 0, 4) == 'http') { + $logo = $settings->get('fax','cover_logo'); } - else if (substr($setting->get('fax','cover_logo'), 0, 1) == '/') { - if (substr($setting->get('fax','cover_logo'), 0, strlen($_SERVER['DOCUMENT_ROOT'])) != $_SERVER['DOCUMENT_ROOT']) { - $logo = $_SERVER['DOCUMENT_ROOT'].$setting->get('fax','cover_logo'); + else if (substr($settings->get('fax','cover_logo'), 0, 1) == '/') { + if (substr($settings->get('fax','cover_logo'), 0, strlen($_SERVER['DOCUMENT_ROOT'])) != $_SERVER['DOCUMENT_ROOT']) { + $logo = $_SERVER['DOCUMENT_ROOT'].$settings->get('fax','cover_logo'); } else { - $logo = $setting->get('fax','cover_logo'); + $logo = $settings->get('fax','cover_logo'); } } } @@ -497,7 +495,7 @@ if (!function_exists('fax_split_dtmf')) { $pdf->SetFont($pdf_font, "", 12); $pdf->SetXY($x + 2.0, $y + 1.65); if (defined('STDIN') || ($_REQUEST['submit'] != '' && $_REQUEST['submit'] != 'preview')) { - $date = new DateTime('now', new DateTimeZone( $setting->get('domain','time_zone', date_default_timezone_get() ) )); + $date = new DateTime('now', new DateTimeZone( $settings->get('domain','time_zone', date_default_timezone_get() ) )); $pdf->Write(0.3, $date->format('d M Y @ h:i:s A')); } $pdf->SetXY($x + 2.0, $y + 1.95); @@ -569,7 +567,7 @@ if (!function_exists('fax_split_dtmf')) { } else { //determine cover message box height, and difference, to adjust footer position accordingly - $cover_message_height = $setting->get('fax','cover_message_height'); + $cover_message_height = $settings->get('fax','cover_message_height'); $cover_message_height = (float) ($cover_message_height ?? 6.15); $height_difference = 6.15 - $cover_message_height; @@ -677,7 +675,7 @@ if (!function_exists('fax_split_dtmf')) { } //prepare variables send the fax - $mail_from_address = (!empty($setting->get('fax','smtp_from'))) ? $setting->get('fax','smtp_from') : $setting->get('email','smtp_from'); + $mail_from_address = (!empty($settings->get('fax','smtp_from'))) ? $settings->get('fax','smtp_from') : $settings->get('email','smtp_from'); //get the fax mail to address and fax prefix $sql = "select * from v_fax where fax_uuid = :fax_uuid "; @@ -805,7 +803,7 @@ if (!function_exists('fax_split_dtmf')) { //send the external call $fax_variables = ''; - foreach($setting->get('fax','variable') as $variable) { + foreach($settings->get('fax','variable') as $variable) { $fax_variables .= $variable.","; } } @@ -897,7 +895,7 @@ if (!defined('STDIN')) { $sql .= "and cp.phone_type_fax = 1 "; $sql .= "and cp.phone_number is not null "; $sql .= "and cp.phone_number <> '' "; - if ($setting->get('contact','permissions', false)) { + if ($settings->get('contact','permissions', false)) { if (is_array($user_group_uuids) && @sizeof($user_group_uuids) != 0) { //only show contacts assigned to current user's group(s) and those not assigned to any group $sql .= "and ("; @@ -1013,7 +1011,7 @@ if (!defined('STDIN')) { echo "
\n"; echo "
".$text['header-new_fax']."
\n"; echo "
\n"; - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$setting->get('theme','button_icon_back'),'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'fax.php']); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme','button_icon_back'),'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'fax.php']); if ($domain_enabled == true) { echo button::create(['type'=>'submit','label'=>$text['button-preview'],'icon'=>'eye','name'=>'submit','value'=>'preview']); echo button::create(['type'=>'submit','label'=>$text['button-send'],'icon'=>'paper-plane','id'=>'btn_save','name'=>'submit','value'=>'send','style'=>'margin-left: 15px;']); @@ -1036,7 +1034,7 @@ if (!defined('STDIN')) { echo " ".$text['label-fax-header']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo " ".$text['description-fax-header']."\n"; echo "\n"; @@ -1104,7 +1102,7 @@ if (!defined('STDIN')) { for ($f = 1; $f <= 3; $f++) { echo " 1) ? "style='display: none;'" : null).">"; echo " "; - echo button::create(['type'=>'button','label'=>$text['button-clear'],'icon'=>$setting->get('theme','button_icon_reset'),'onclick'=>"reset_file_input('fax_files_".$f."'); document.getElementById('file_list_".$f."').innerHTML='';"]); + echo button::create(['type'=>'button','label'=>$text['button-clear'],'icon'=>$settings->get('theme','button_icon_reset'),'onclick'=>"reset_file_input('fax_files_".$f."'); document.getElementById('file_list_".$f."').innerHTML='';"]); echo "
"; echo " "; echo "
\n"; @@ -1119,9 +1117,9 @@ if (!defined('STDIN')) { echo "\n"; echo "\n"; echo " \n"; echo "
\n"; echo " ".$text['description-fax-resolution']."\n"; @@ -1134,9 +1132,9 @@ if (!defined('STDIN')) { echo "\n"; echo "\n"; echo " \n"; echo "
\n"; echo " ".$text['description-fax-page-size']."\n"; @@ -1144,7 +1142,7 @@ if (!defined('STDIN')) { echo "\n"; if (permission_exists('fax_subject')) { - $cover_subject_required = $setting->get('fax','cover_subject_required') ?? ''; + $cover_subject_required = $settings->get('fax','cover_subject_required') ?? ''; $class = ($cover_subject_required == 'true') ? 'vncellreq' : 'vncell'; $required = ($cover_subject_required == 'true') ? 'required' : ''; echo "\n"; @@ -1160,7 +1158,7 @@ if (!defined('STDIN')) { } if (permission_exists('fax_message')) { - $cover_message_required = $setting->get('fax','cover_message_required') ?? ''; + $cover_message_required = $settings->get('fax','cover_message_required') ?? ''; $class = ($cover_message_required == 'true') ? 'vncellreq' : 'vncell'; $required = ($cover_message_required == 'true') ? 'required' : ''; echo "\n"; @@ -1168,7 +1166,7 @@ if (!defined('STDIN')) { echo " ".$text['label-fax-message']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo " ".$text['description-fax-message']."\n"; echo "\n"; @@ -1181,7 +1179,7 @@ if (!defined('STDIN')) { echo " ".$text['label-fax-footer']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo " ".$text['description-fax-footer']."\n"; echo "\n"; @@ -1228,4 +1226,4 @@ function showgrid($pdf) { } } */ -?> \ No newline at end of file +?> diff --git a/app/fax/resources/classes/fax.php b/app/fax/resources/classes/fax.php index d3b6b8748d..e1a24157ce 100644 --- a/app/fax/resources/classes/fax.php +++ b/app/fax/resources/classes/fax.php @@ -25,7 +25,6 @@ */ //define the fax class -if (!class_exists('fax')) { class fax { /** @@ -725,7 +724,6 @@ if (!class_exists('fax')) { } } //class -} /* $o = new fax; @@ -738,5 +736,3 @@ $c->destination_number = $fax_destination_number; $c->fax_description = $fax_description; $c->dialplan(); */ - -?> \ No newline at end of file diff --git a/app/fax_queue/resources/classes/fax_queue.php b/app/fax_queue/resources/classes/fax_queue.php index f5d2897ef1..0f2378a066 100644 --- a/app/fax_queue/resources/classes/fax_queue.php +++ b/app/fax_queue/resources/classes/fax_queue.php @@ -26,12 +26,7 @@ /** * fax_queue class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('fax_queue')) { class fax_queue { /** @@ -274,6 +269,3 @@ if (!class_exists('fax_queue')) { } } } -} - -?> diff --git a/app/fax_queue/resources/service/fax_queue.php b/app/fax_queue/resources/service/fax_queue.php index 6084254ebf..db9eb1e654 100644 --- a/app/fax_queue/resources/service/fax_queue.php +++ b/app/fax_queue/resources/service/fax_queue.php @@ -8,7 +8,6 @@ //includes files require_once dirname(__DIR__, 4) . "/resources/require.php"; require_once "resources/pdo.php"; - include "resources/classes/permissions.php"; //increase limits set_time_limit(0); diff --git a/app/fifo/fifo_edit.php b/app/fifo/fifo_edit.php index e247ab121b..164caebe18 100644 --- a/app/fifo/fifo_edit.php +++ b/app/fifo/fifo_edit.php @@ -136,6 +136,27 @@ } } + //validate the data + $fifo_extension = preg_replace('#[^a-zA-Z0-9.\-\*]#', '', $fifo_extension ?? ''); + $fifo_order = preg_replace('#[^0-9]#', '', $fifo_order ?? ''); + $fifo_exit_key = preg_replace('#[^0-9]#', '', $fifo_exit_key ?? ''); + $fifo_timeout_seconds = preg_replace('#[^0-9]#', '', $fifo_timeout_seconds ?? ''); + $fifo_agent_status = preg_replace('#[^a-zA-Z0-9.\-\*]#', '', $fifo_agent_status ?? ''); + $fifo_agent_queue = preg_replace('#[^a-zA-Z0-9.\-\*]#', '', $fifo_agent_queue ?? ''); + if (!empty($fifo_uuid) && !is_uuid($fifo_uuid)) { throw new Exception("invalid uuid"); } + if (!empty($dialplan_uuid) && !is_uuid($dialplan_uuid)) { throw new Exception("invalid uuid"); } + + if (is_array($fifo_members)) { + $i = 0; + foreach ($fifo_members as $row) { + $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'; + $i++; + } + } + //check for all required data $msg = ''; if (strlen($fifo_name) == 0) { $msg .= $text['message-required']." ".$text['label-fifo_name']."
\n"; } @@ -192,21 +213,20 @@ $array['fifo'][0]['fifo_timeout_seconds'] = $fifo_timeout_seconds; $array['fifo'][0]['fifo_exit_key'] = $fifo_exit_key; $array['fifo'][0]['fifo_exit_action'] = $fifo_exit_action; - $array['fifo'][0]['fifo_exit_key'] = $fifo_exit_key; $array['fifo'][0]['fifo_music'] = $fifo_music; $array['fifo'][0]['fifo_order'] = $fifo_order; $array['fifo'][0]['fifo_enabled'] = $fifo_enabled; $array['fifo'][0]['fifo_description'] = $fifo_description; - $y = 0; if (is_array($fifo_members)) { + $y = 0; foreach ($fifo_members as $row) { if (!empty($row['member_contact']) && strlen($row['member_contact']) > 0) { $array['fifo'][0]['fifo_members'][$y]['fifo_member_uuid'] = $row["fifo_member_uuid"]; $array['fifo'][0]['fifo_members'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['fifo'][0]['fifo_members'][$y]['member_contact'] = $row["member_contact"]; - $array['fifo'][0]['fifo_members'][$y]['member_call_timeout'] = $row["member_call_timeout"]; + $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"]; + $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'; $y++; } @@ -216,6 +236,11 @@ //send commands for agent login or agent logout if (is_array($fifo_members)) { foreach ($fifo_members as $row) { + //empty row skip iteration + if (empty($row["member_contact"])) { + continue; + } + //build the command to add or remove the agent from the FIFO queue if ($row["member_enabled"] == 'true') { $command = "fifo_member add ".$fifo_extension."@".$_SESSION['domain_name']." {fifo_member_wait=nowait}".$row["member_contact"]." 5 ".$row['member_call_timeout']." ".$row['member_wrap_up_time']; @@ -223,8 +248,9 @@ else { $command = "fifo_member del ".$fifo_extension."@".$_SESSION['domain_name']." {fifo_member_wait=nowait}".$row["member_contact"]; } + if ($event_socket->is_connected()) { - $response = event_socket::api($command); + $response = $event_socket->command('api '.$command); } } } diff --git a/app/fifo/resources/classes/fifo.php b/app/fifo/resources/classes/fifo.php index 4338f3f48e..450f5cd4c3 100644 --- a/app/fifo/resources/classes/fifo.php +++ b/app/fifo/resources/classes/fifo.php @@ -2,12 +2,7 @@ /** * fifo class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('fifo')) { class fifo { /** @@ -283,6 +278,3 @@ if (!class_exists('fifo')) { } } -} - -?> \ No newline at end of file diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index 06f3a7bcc7..1f0bd727c3 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.php @@ -118,7 +118,7 @@ $show = !empty($_GET["show"]) ? $_GET["show"] : ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get total gateway count from the database $sql = "select count(*) from v_gateways where true "; @@ -278,7 +278,7 @@ echo th_order_by('hostname', $text['label-hostname'], $order_by, $order, null, "class='hide-sm-dn'"); echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('gateway_edit') && $list_row_edit_button == 'true') { + if (permission_exists('gateway_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -371,9 +371,9 @@ } echo " \n"; echo " ".escape($row["description"])." \n"; - if (permission_exists('gateway_edit') && $list_row_edit_button == 'true') { + if (permission_exists('gateway_edit') && $list_row_edit_button) { echo " "; - echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$list_row_edit_button,'link'=>$list_row_url]); + echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; } echo "\n"; diff --git a/app/gateways/resources/classes/gateways.php b/app/gateways/resources/classes/gateways.php index cbfba52633..83ab122ad9 100644 --- a/app/gateways/resources/classes/gateways.php +++ b/app/gateways/resources/classes/gateways.php @@ -25,7 +25,6 @@ */ //define the gateways class -if (!class_exists('gateways')) { class gateways { /** @@ -583,6 +582,3 @@ if (!class_exists('gateways')) { } } -} - -?> \ No newline at end of file diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index 80f658a42f..b6fd64cf61 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -349,7 +349,7 @@ $dialplan_xml = "\n"; $dialplan_xml .= " \n"; $dialplan_xml .= " \n"; - if ($_SESSION['ivr_menu']['answer']['boolean'] == 'true') { + if (filter_var($_SESSION['ivr_menu']['answer']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { $dialplan_xml .= " \n"; } $dialplan_xml .= " \n"; diff --git a/app/ivr_menus/ivr_menus.php b/app/ivr_menus/ivr_menus.php index 287a2a66f5..edb964215d 100644 --- a/app/ivr_menus/ivr_menus.php +++ b/app/ivr_menus/ivr_menus.php @@ -94,7 +94,7 @@ $show = $_GET["show"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //prepare to page the results $sql = "select count(*) from v_ivr_menus "; @@ -228,7 +228,7 @@ echo th_order_by('ivr_menu_extension', $text['label-extension'], $order_by, $order); echo th_order_by('ivr_menu_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('ivr_menu_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('ivr_menu_edit') && $list_row_edit_button == 'true') { + if (permission_exists('ivr_menu_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -278,7 +278,7 @@ } echo " \n"; echo " ".escape($row['ivr_menu_description'])." \n"; - if (permission_exists('ivr_menu_edit') && $list_row_edit_button == 'true') { + if (permission_exists('ivr_menu_edit') && $list_row_edit_button) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/ivr_menus/resources/classes/ivr_menu.php b/app/ivr_menus/resources/classes/ivr_menu.php index 50a0fde239..2d91d84c15 100644 --- a/app/ivr_menus/resources/classes/ivr_menu.php +++ b/app/ivr_menus/resources/classes/ivr_menu.php @@ -25,7 +25,6 @@ */ //define the ivr_menu class -if (!class_exists('ivr_menu')) { class ivr_menu { /** @@ -489,6 +488,3 @@ if (!class_exists('ivr_menu')) { } } -} - -?> diff --git a/app/ivr_menus/waveform.php b/app/ivr_menus/waveform.php index 3408037311..8b760cd949 100644 --- a/app/ivr_menus/waveform.php +++ b/app/ivr_menus/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; @@ -96,8 +95,8 @@ Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba - Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom - Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis + Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom + Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis $height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null; $wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string } diff --git a/app/modules/modules.php b/app/modules/modules.php index bb3a16a2dc..cdc8b56f06 100644 --- a/app/modules/modules.php +++ b/app/modules/modules.php @@ -60,7 +60,7 @@ } //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //process the http post data by action if ($action != '' && is_array($modules) && @sizeof($modules) != 0) { @@ -185,7 +185,7 @@ } echo "".$text['label-enabled']."\n"; echo "".$text['label-description']."\n"; - if (permission_exists('module_edit') && $list_row_edit_button == 'true') { + if (permission_exists('module_edit') && $list_row_edit_button) { echo " \n"; } echo "\n"; @@ -261,7 +261,7 @@ } echo " \n"; echo " ".escape($row["module_description"])." \n"; - if (permission_exists('module_edit') && $list_row_edit_button == 'true') { + if (permission_exists('module_edit') && $list_row_edit_button) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/modules/resources/classes/modules.php b/app/modules/resources/classes/modules.php index 28b83949e0..8559b657b4 100644 --- a/app/modules/resources/classes/modules.php +++ b/app/modules/resources/classes/modules.php @@ -25,7 +25,6 @@ */ //define the modules class -if (!class_exists('modules')) { class modules { /** @@ -1101,10 +1100,8 @@ if (!class_exists('modules')) { } //class -} /* -require_once "resources/classes/modules.php"; $mod = new modules; $mod->dir = $_SESSION['switch']['mod']['dir']; echo $mod->dir."\n"; @@ -1138,5 +1135,3 @@ echo $mod->dir."\n"; //print_r($result); //echo "\n"; */ - -?> diff --git a/app/music_on_hold/music_on_hold.php b/app/music_on_hold/music_on_hold.php index 95c4443a81..ae92335afb 100644 --- a/app/music_on_hold/music_on_hold.php +++ b/app/music_on_hold/music_on_hold.php @@ -308,7 +308,6 @@ $cache = new cache; $cache->delete("configuration:local_stream.conf"); - //require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $music = new switch_music_on_hold; $music->reload(); diff --git a/app/music_on_hold/resources/classes/switch_music_on_hold.php b/app/music_on_hold/resources/classes/switch_music_on_hold.php index 71d628eca2..55d90e86b1 100644 --- a/app/music_on_hold/resources/classes/switch_music_on_hold.php +++ b/app/music_on_hold/resources/classes/switch_music_on_hold.php @@ -27,7 +27,6 @@ */ //define the switch_music_on_hold class -if (!class_exists('switch_music_on_hold')) { class switch_music_on_hold { /** @@ -85,7 +84,6 @@ if (!class_exists('switch_music_on_hold')) { } //recordings if (is_dir($_SERVER["PROJECT_ROOT"].'/app/recordings')) { - require_once "app/recordings/resources/classes/switch_recordings.php"; $recordings_c = new switch_recordings; $recordings = $recordings_c->list_recordings(); if (is_array($recordings) && sizeof($recordings) > 0) { @@ -447,12 +445,9 @@ if (!class_exists('switch_music_on_hold')) { } //method } //class -} + //build and save the XML - //require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; //$moh = new switch_music_on_hold; //$moh->xml(); //$moh->save(); - -?> \ No newline at end of file diff --git a/app/music_on_hold/waveform.php b/app/music_on_hold/waveform.php index ee56d2e5ac..47fafbd10c 100644 --- a/app/music_on_hold/waveform.php +++ b/app/music_on_hold/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; @@ -87,8 +86,8 @@ Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba - Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom - Waveform::$singleAxis = Waveform::$singlePhase === true ? false : (empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false); // combine channels into single axis + Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom + Waveform::$singleAxis = Waveform::$singlePhase === true ? false : (filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'); // combine channels into single axis $height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null; $wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string } diff --git a/app/number_translations/number_translations.php b/app/number_translations/number_translations.php index 3b58216bf3..073c1b2c65 100644 --- a/app/number_translations/number_translations.php +++ b/app/number_translations/number_translations.php @@ -46,7 +46,7 @@ $search = $_GET["search"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get the http post data if (!empty($_POST['number_translations'])) { @@ -217,7 +217,7 @@ echo th_order_by('number_translation_name', $text['label-number_translation_name'], $order_by, $order); echo th_order_by('number_translation_enabled', $text['label-number_translation_enabled'], $order_by, $order, null, "class='center'"); echo " ".$text['label-number_translation_description']."\n"; - if (permission_exists('number_translation_edit') && $list_row_edit_button == 'true') { + if (permission_exists('number_translation_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -258,7 +258,7 @@ } echo " \n"; echo " ".escape($row['number_translation_description'])."\n"; - if (permission_exists('number_translation_edit') && $list_row_edit_button == 'true') { + if (permission_exists('number_translation_edit') && $list_row_edit_button) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/number_translations/resources/classes/number_translations.php b/app/number_translations/resources/classes/number_translations.php index 22a2836401..c0abf97057 100644 --- a/app/number_translations/resources/classes/number_translations.php +++ b/app/number_translations/resources/classes/number_translations.php @@ -25,7 +25,6 @@ */ //define the number translations class -if (!class_exists('number_translations')) { class number_translations { /** @@ -414,11 +413,8 @@ if (!class_exists('number_translations')) { } //method } //class -} /* $obj = new number_translations; $obj->delete(); */ - -?> \ No newline at end of file diff --git a/app/phrases/phrases.php b/app/phrases/phrases.php index 0edd4f6559..df01fbf03f 100644 --- a/app/phrases/phrases.php +++ b/app/phrases/phrases.php @@ -203,7 +203,7 @@ echo th_order_by('phrase_language', $text['label-language'], $order_by, $order); echo th_order_by('phrase_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('phrase_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn' style='min-width: 40%;'"); - if (permission_exists('phrase_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('phrase_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -253,7 +253,7 @@ } echo " \n"; echo " ".escape($row['phrase_description'])." \n"; - if (permission_exists('phrase_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('phrase_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/phrases/resources/classes/phrases.php b/app/phrases/resources/classes/phrases.php index 2ed6f0f893..8fa677fe8a 100644 --- a/app/phrases/resources/classes/phrases.php +++ b/app/phrases/resources/classes/phrases.php @@ -25,7 +25,6 @@ */ //define the phrases class -if (!class_exists('phrases')) { class phrases { /** @@ -431,6 +430,3 @@ if (!class_exists('phrases')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/app/pin_numbers/pin_download.php b/app/pin_numbers/pin_download.php index d16c4b11d3..a0bd83ce91 100644 --- a/app/pin_numbers/pin_download.php +++ b/app/pin_numbers/pin_download.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-2019 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -133,6 +133,7 @@ echo "
\n"; echo "
\n"; + echo "
\n"; echo "\n"; echo "\n"; echo "
\n"; @@ -156,6 +157,7 @@ } echo "
\n"; + echo "
\n"; echo "

\n"; echo "\n"; @@ -165,4 +167,4 @@ //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> diff --git a/app/pin_numbers/pin_number_edit.php b/app/pin_numbers/pin_number_edit.php index d6a9455ca4..386b0c5dcc 100644 --- a/app/pin_numbers/pin_number_edit.php +++ b/app/pin_numbers/pin_number_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): @@ -168,6 +168,7 @@ if (count($_POST)>0 && empty($_POST["persistformvar"])) { echo "
\n"; echo "
\n"; + echo "
\n"; echo "\n"; echo "\n"; @@ -217,17 +218,18 @@ if (count($_POST)>0 && empty($_POST["persistformvar"])) { echo "\n"; echo "\n"; - echo "
"; - echo "

"; + echo "\n"; + echo "
\n"; + echo "

\n"; if ($action == "update") { echo "\n"; } echo "\n"; - echo ""; + echo "\n"; //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> diff --git a/app/pin_numbers/pin_numbers.php b/app/pin_numbers/pin_numbers.php index e7581cecf7..a2aaba0af9 100644 --- a/app/pin_numbers/pin_numbers.php +++ b/app/pin_numbers/pin_numbers.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-2020 + Portions created by the Initial Developer are Copyright (C) 2016-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -170,6 +170,7 @@ echo "\n"; echo "\n"; + echo "
\n"; echo "\n"; echo "\n"; if (permission_exists('pin_number_add') || permission_exists('pin_number_edit') || permission_exists('pin_number_delete')) { @@ -181,7 +182,7 @@ echo th_order_by('accountcode', $text['label-accountcode'], $order_by, $order); echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('pin_number_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('pin_number_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " \n"; } echo "\n"; @@ -222,7 +223,7 @@ } echo " \n"; echo " \n"; - if (permission_exists('pin_number_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('pin_number_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " \n"; @@ -234,6 +235,7 @@ unset($pin_numbers); echo "
 
".escape($row['description'])." "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo "
\n"; + echo "
\n"; echo "
\n"; echo "
".$paging_controls."
\n"; @@ -245,4 +247,3 @@ require_once "resources/footer.php"; ?> - diff --git a/app/pin_numbers/resources/classes/pin_numbers.php b/app/pin_numbers/resources/classes/pin_numbers.php index c0be87493e..817f21caab 100644 --- a/app/pin_numbers/resources/classes/pin_numbers.php +++ b/app/pin_numbers/resources/classes/pin_numbers.php @@ -25,7 +25,6 @@ */ //define the pin numbers class -if (!class_exists('pin_numbers')) { class pin_numbers { /** @@ -245,6 +244,3 @@ if (!class_exists('pin_numbers')) { } } -} - -?> \ No newline at end of file diff --git a/app/recordings/resources/classes/switch_recordings.php b/app/recordings/resources/classes/switch_recordings.php index dc3988ef67..f50fa1e80e 100644 --- a/app/recordings/resources/classes/switch_recordings.php +++ b/app/recordings/resources/classes/switch_recordings.php @@ -26,7 +26,6 @@ */ //define the switch_recordings class -if (!class_exists('switch_recordings')) { class switch_recordings { /** @@ -158,6 +157,3 @@ if (!class_exists('switch_recordings')) { } //method } //class -} - -?> diff --git a/app/recordings/waveform.php b/app/recordings/waveform.php index 57b8fbef96..07a15a5555 100644 --- a/app/recordings/waveform.php +++ b/app/recordings/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; @@ -94,8 +93,8 @@ Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba - Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom - Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis + Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom + Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis $height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null; $wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string } diff --git a/app/registrations/registrations.php b/app/registrations/registrations.php index 9c9fafef6e..18720eb38d 100644 --- a/app/registrations/registrations.php +++ b/app/registrations/registrations.php @@ -88,7 +88,6 @@ $registrations = $obj->get($profile ?? null); //order the array - require_once "resources/classes/array_order.php"; $order = new array_order(); $registrations = $order->sort($registrations, 'sip-auth-realm', 'user'); @@ -234,13 +233,13 @@ echo " ".escape($row['ping-time'])."\n"; echo " ".escape($row['sip_profile_name'])."\n"; echo " \n"; - if (!empty($_SESSION['registrations']['list_row_button_unregister']['boolean']) && $_SESSION['registrations']['list_row_button_unregister']['boolean'] == 'true') { + if (filter_var($_SESSION['registrations']['list_row_button_unregister']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo button::create(['type'=>'submit','title'=>$text['button-unregister'],'icon'=>'user-slash fa-fw','style'=>'margin-left: 2px; margin-right: 0;','onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('unregister'); list_form_submit('form_list')"]); } - if (!empty($_SESSION['registrations']['list_row_button_provision']['boolean']) && $_SESSION['registrations']['list_row_button_provision']['boolean'] == 'true') { + if (filter_var($_SESSION['registrations']['list_row_button_provision']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo button::create(['type'=>'submit','title'=>$text['button-provision'],'icon'=>'fax fa-fw','style'=>'margin-left: 2px; margin-right: 0;','onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('provision'); list_form_submit('form_list')"]); } - if (!empty($_SESSION['registrations']['list_row_button_reboot']['boolean']) && $_SESSION['registrations']['list_row_button_reboot']['boolean'] == 'true') { + if (filter_var($_SESSION['registrations']['list_row_button_reboot']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo button::create(['type'=>'submit','title'=>$text['button-reboot'],'icon'=>'power-off fa-fw','style'=>'margin-left: 2px; margin-right: 0;','onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('reboot'); list_form_submit('form_list')"]); } echo "\n"; diff --git a/app/registrations/resources/classes/registrations.php b/app/registrations/resources/classes/registrations.php index 9ae9d71c7b..8a66543289 100644 --- a/app/registrations/resources/classes/registrations.php +++ b/app/registrations/resources/classes/registrations.php @@ -24,8 +24,6 @@ Mark J Crane */ -//define the registrations class -if (!class_exists('registrations')) { class registrations { /** @@ -44,6 +42,12 @@ if (!class_exists('registrations')) { */ private $database; + /** + * Set in the constructor. Must be an event_socket object and cannot be null. + * @var event_socket Event Socket Connection Object + */ + private $event_socket; + /** * called when the object is created */ @@ -59,8 +63,21 @@ if (!class_exists('registrations')) { //trap passing a PDO object instead of the required database object if (!($this->database instanceof database)) { - //should never happen but will trap it here just-in-case - throw new \InvalidArgumentException("Database object passed in settings class constructor is not a valid database object"); + //should never happen but will trap it here just in case + throw new \InvalidArgumentException("Database object passed in the constructor is not a valid database object"); + } + + if (!empty($setting_array['event_socket'])) { + $this->event_socket = $setting_array['event_socket']; + } + else { + $this->event_socket = event_socket::create(); + } + + //trap passing an invalid connection object for communicating to the switch + if (!($this->event_socket instanceof event_socket)) { + //should never happen but will trap it here just in case + throw new \InvalidArgumentException('Event socket object passed in the constructor is not a valid event_socket object'); } //assign private variables @@ -89,7 +106,21 @@ if (!class_exists('registrations')) { $id = 0; //create the event socket connection - $esl = event_socket::create(); + $event_socket = $this->event_socket; + + //make sure the event socket is connected + if (!$event_socket->is_connected()) { + //connect to event socket + $event_socket->connect(); + + //check again and throw an error if it can't connect + if (!$event_socket->is_connected()) { + message::add($text['error-event-socket'], 'negative', 5000); + return null; + } + } + + //get the default settings $sql = "select sip_profile_name from v_sip_profiles "; @@ -100,12 +131,18 @@ if (!class_exists('registrations')) { } $sql .= "and sip_profile_enabled = 'true' "; $sip_profiles = $this->database->select($sql, $parameters ?? null, 'all'); - if (!empty($sip_profiles) && @sizeof($sip_profiles) != 0) { - foreach ($sip_profiles as $field) { + + if (!empty($sip_profiles)) { + + //use a while loop to ensure the event socket stays connected while communicating + $count = count($sip_profiles); + $i = 0; + while ($event_socket->is_connected() && $i < $count) { + $field = $sip_profiles[$i++]; //get sofia status profile information including registrations $cmd = "api sofia xmlstatus profile '".$field['sip_profile_name']."' reg"; - $xml_response = trim(event_socket::command($cmd)); + $xml_response = trim($event_socket->request($cmd)); //show an error message if ($xml_response == "Invalid Profile!") { @@ -117,7 +154,7 @@ if (!class_exists('registrations')) { $xml_response = "".escape($text['label-message']).""; } - //santize the XML + //sanitize the XML if (function_exists('iconv')) { $xml_response = iconv("utf-8", "utf-8//IGNORE", $xml_response); } $xml_response = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/u', '', $xml_response); $xml_response = str_replace("", "", $xml_response); @@ -301,10 +338,10 @@ if (!class_exists('registrations')) { unset($sql); //create the event socket connection - $esl = event_socket::create(); + $event_socket = $this->event_socket; //loop through registrations - if ($esl->is_connected()) { + if ($event_socket->is_connected()) { //check if registrations exist if (is_array($registrations)) { foreach ($registrations as $registration) { @@ -364,11 +401,10 @@ if (!class_exists('registrations')) { } //send the api command - if (!empty($command) && $esl->is_connected()) { - $response_api[$registration['user']]['command'] = event_socket::api($command); - $response_api[$registration['user']]['log'] = event_socket::api("log notice $command"); + if (!empty($command) && $event_socket->is_connected()) { + $response_api[$registration['user']]['command'] = $event_socket->request('api ' . $command); + $response_api[$registration['user']]['log'] = $event_socket->request("log notice $command"); } - } } @@ -394,6 +430,3 @@ if (!class_exists('registrations')) { } //method } //class -} - -?> diff --git a/app/ring_groups/resources/classes/ring_groups.php b/app/ring_groups/resources/classes/ring_groups.php index ceab17b711..5a9786e256 100644 --- a/app/ring_groups/resources/classes/ring_groups.php +++ b/app/ring_groups/resources/classes/ring_groups.php @@ -25,7 +25,6 @@ */ //define the ring groups class -if (!class_exists('ring_groups')) { class ring_groups { /** @@ -512,6 +511,3 @@ if (!class_exists('ring_groups')) { } } -} - -?> diff --git a/app/ring_groups/ring_groups.php b/app/ring_groups/ring_groups.php index f995d7cdf0..d46f228159 100644 --- a/app/ring_groups/ring_groups.php +++ b/app/ring_groups/ring_groups.php @@ -249,7 +249,7 @@ echo th_order_by('ring_group_forward_enabled', $text['label-forwarding'], $order_by, $order); echo th_order_by('ring_group_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('ring_group_description', $text['header-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('ring_group_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('ring_group_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -295,7 +295,7 @@ } echo " \n"; echo " ".escape($row['ring_group_description'])." \n"; - if (permission_exists('ring_group_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('ring_group_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/ring_groups/waveform.php b/app/ring_groups/waveform.php index 3408037311..8b760cd949 100644 --- a/app/ring_groups/waveform.php +++ b/app/ring_groups/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; @@ -96,8 +95,8 @@ Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba - Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom - Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis + Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom + Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis $height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null; $wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string } diff --git a/app/sip_profiles/resources/classes/sip_profiles.php b/app/sip_profiles/resources/classes/sip_profiles.php index 5d90bb5de8..2ab414a2c3 100644 --- a/app/sip_profiles/resources/classes/sip_profiles.php +++ b/app/sip_profiles/resources/classes/sip_profiles.php @@ -25,7 +25,6 @@ */ //define the sip profiles class -if (!class_exists('sip_profiles')) { class sip_profiles { /** @@ -434,6 +433,3 @@ if (!class_exists('sip_profiles')) { } } -} - -?> \ No newline at end of file diff --git a/app/sip_profiles/sip_profiles.php b/app/sip_profiles/sip_profiles.php index 956d0727ea..565f227eae 100644 --- a/app/sip_profiles/sip_profiles.php +++ b/app/sip_profiles/sip_profiles.php @@ -76,7 +76,7 @@ } //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get order and order by if (isset($_GET["order_by"])) { @@ -180,7 +180,7 @@ echo th_order_by('sip_profile_hostname', $text['label-sip_profile_hostname'], $order_by, $order); echo th_order_by('sip_profile_enabled', $text['label-sip_profile_enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('sip_profile_description', $text['label-sip_profile_description'], $order_by, $order, null, "class='hide-sm-dn pct-70'"); - if (permission_exists('sip_profile_edit') && $list_row_edit_button == 'true') { + if (permission_exists('sip_profile_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -221,7 +221,7 @@ } echo " \n"; echo " ".escape($row['sip_profile_description'])." \n"; - if (permission_exists('sip_profile_edit') && $list_row_edit_button == 'true') { + if (permission_exists('sip_profile_edit') && $list_row_edit_button) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/sofia_global_settings/app_defaults.php b/app/sofia_global_settings/app_defaults.php index 00b44a05b8..0d3e03c55a 100644 --- a/app/sofia_global_settings/app_defaults.php +++ b/app/sofia_global_settings/app_defaults.php @@ -4,53 +4,53 @@ if ($domains_processed == 1) { //get all of the sofia global default settings $sql = "select * from v_sofia_global_settings \n"; - $sofia_global_settings = $database->select($sql, null, 'all'); + $database_settings = $database->select($sql, null, 'all'); //build array $x = 0; - $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = '9a0e83b3-e71c-4a9a-9f1c-680d32f756f8'; - $settings['sofia_global_settings'][$x]['global_setting_name'] = 'log-level'; - $settings['sofia_global_settings'][$x]['global_setting_value'] = '0'; - $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'true'; - $settings['sofia_global_settings'][$x]['global_setting_description'] = ''; + $global_settings[$x]['sofia_global_setting_uuid'] = '9a0e83b3-e71c-4a9a-9f1c-680d32f756f8'; + $global_settings[$x]['global_setting_name'] = 'log-level'; + $global_settings[$x]['global_setting_value'] = '0'; + $global_settings[$x]['global_setting_enabled'] = 'true'; + $global_settings[$x]['global_setting_description'] = ''; $x++; - $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = 'c2aa551a-b6d2-49a6-b633-21b5b1ddd5df'; - $settings['sofia_global_settings'][$x]['global_setting_name'] = 'auto-restart'; - $settings['sofia_global_settings'][$x]['global_setting_value'] = 'true'; - $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'true'; - $settings['sofia_global_settings'][$x]['global_setting_description'] = ''; + $global_settings[$x]['sofia_global_setting_uuid'] = 'c2aa551a-b6d2-49a6-b633-21b5b1ddd5df'; + $global_settings[$x]['global_setting_name'] = 'auto-restart'; + $global_settings[$x]['global_setting_value'] = 'true'; + $global_settings[$x]['global_setting_enabled'] = 'true'; + $global_settings[$x]['global_setting_description'] = ''; $x++; - $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = 'a9901c0c-efd8-4e66-9648-239566af576e'; - $settings['sofia_global_settings'][$x]['global_setting_name'] = 'debug-presence'; - $settings['sofia_global_settings'][$x]['global_setting_value'] = '0'; - $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'true'; - $settings['sofia_global_settings'][$x]['global_setting_description'] = ''; + $global_settings[$x]['sofia_global_setting_uuid'] = 'a9901c0c-efd8-4e66-9648-239566af576e'; + $global_settings[$x]['global_setting_name'] = 'debug-presence'; + $global_settings[$x]['global_setting_value'] = '0'; + $global_settings[$x]['global_setting_enabled'] = 'true'; + $global_settings[$x]['global_setting_description'] = ''; $x++; - $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = '31054912-3b07-422d-a109-b995fd8d67f7'; - $settings['sofia_global_settings'][$x]['global_setting_name'] = 'capture-server'; - $settings['sofia_global_settings'][$x]['global_setting_value'] = 'udp:127.0.0.1:9060'; - $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'false'; - $settings['sofia_global_settings'][$x]['global_setting_description'] = ''; + $global_settings[$x]['sofia_global_setting_uuid'] = '31054912-3b07-422d-a109-b995fd8d67f7'; + $global_settings[$x]['global_setting_name'] = 'capture-server'; + $global_settings[$x]['global_setting_value'] = 'udp:127.0.0.1:9060'; + $global_settings[$x]['global_setting_enabled'] = 'false'; + $global_settings[$x]['global_setting_description'] = ''; $x++; - $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = 'b27af7db-4ba5-452b-a5ed-a922c8f201aa'; - $settings['sofia_global_settings'][$x]['global_setting_name'] = 'inbound-reg-in-new-thread'; - $settings['sofia_global_settings'][$x]['global_setting_value'] = 'true'; - $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'true'; - $settings['sofia_global_settings'][$x]['global_setting_description'] = ''; + $global_settings[$x]['sofia_global_setting_uuid'] = 'b27af7db-4ba5-452b-a5ed-a922c8f201aa'; + $global_settings[$x]['global_setting_name'] = 'inbound-reg-in-new-thread'; + $global_settings[$x]['global_setting_value'] = 'true'; + $global_settings[$x]['global_setting_enabled'] = 'true'; + $global_settings[$x]['global_setting_description'] = ''; $x++; - $settings['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = 'cd33b89f-55ef-4b47-833a-538dba70e27e'; - $settings['sofia_global_settings'][$x]['global_setting_name'] = 'max-reg-threads'; - $settings['sofia_global_settings'][$x]['global_setting_value'] = '8'; - $settings['sofia_global_settings'][$x]['global_setting_enabled'] = 'true'; - $settings['sofia_global_settings'][$x]['global_setting_description'] = ''; + $global_settings[$x]['sofia_global_setting_uuid'] = 'cd33b89f-55ef-4b47-833a-538dba70e27e'; + $global_settings[$x]['global_setting_name'] = 'max-reg-threads'; + $global_settings[$x]['global_setting_value'] = '8'; + $global_settings[$x]['global_setting_enabled'] = 'true'; + $global_settings[$x]['global_setting_description'] = ''; //build an array of missing global settings $x = 0; - foreach($settings['sofia_global_settings'] as $row) { + foreach($global_settings as $row) { $y = 0; $setting_found = false; - if (is_array($sofia_global_settings) && @sizeof($sofia_global_settings) != 0) { - foreach($sofia_global_settings as $field) { + if (is_array($database_settings) && @sizeof($database_settings) != 0) { + foreach($database_settings as $field) { if ($row['sofia_global_setting_uuid'] == $field['sofia_global_setting_uuid']) { $setting_found = true; break; diff --git a/app/sofia_global_settings/resources/classes/sofia_global_settings.php b/app/sofia_global_settings/resources/classes/sofia_global_settings.php index 289efda183..f9a1c838b3 100644 --- a/app/sofia_global_settings/resources/classes/sofia_global_settings.php +++ b/app/sofia_global_settings/resources/classes/sofia_global_settings.php @@ -26,12 +26,7 @@ /** * sofia_global_settings class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('sofia_global_settings')) { class sofia_global_settings { /** @@ -247,6 +242,3 @@ if (!class_exists('sofia_global_settings')) { } } -} - -?> \ No newline at end of file diff --git a/app/sofia_global_settings/sofia_global_settings.php b/app/sofia_global_settings/sofia_global_settings.php index 12a40fb1ec..537b15be04 100644 --- a/app/sofia_global_settings/sofia_global_settings.php +++ b/app/sofia_global_settings/sofia_global_settings.php @@ -44,7 +44,7 @@ $search = ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get the http post data if (!empty($_POST['sofia_global_settings'])) { @@ -201,7 +201,7 @@ echo th_order_by('global_setting_value', $text['label-global_setting_value'], $order_by, $order); echo th_order_by('global_setting_enabled', $text['label-global_setting_enabled'], $order_by, $order, null, "class='center'"); echo " ".$text['label-global_setting_description']."\n"; - if (permission_exists('sofia_global_setting_edit') && $list_row_edit_button == 'true') { + if (permission_exists('sofia_global_setting_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -243,7 +243,7 @@ } echo " \n"; echo " ".escape($row['global_setting_description'])."\n"; - if (permission_exists('sofia_global_setting_edit') && $list_row_edit_button == 'true') { + if (permission_exists('sofia_global_setting_edit') && $list_row_edit_button) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/streams/resources/classes/streams.php b/app/streams/resources/classes/streams.php index 05340cdfee..2256892d8f 100644 --- a/app/streams/resources/classes/streams.php +++ b/app/streams/resources/classes/streams.php @@ -25,7 +25,6 @@ */ //define the streams class -if (!class_exists('streams')) { class streams { /** @@ -244,6 +243,3 @@ if (!class_exists('streams')) { } } -} - -?> \ No newline at end of file diff --git a/app/streams/streams.php b/app/streams/streams.php index c065cad90b..af41905082 100644 --- a/app/streams/streams.php +++ b/app/streams/streams.php @@ -240,7 +240,7 @@ echo " ".$text['label-play']."\n"; echo th_order_by('stream_enabled', $text['label-stream_enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('stream_description', $text['label-stream_description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('stream_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('stream_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -297,7 +297,7 @@ } echo " \n"; echo " ".escape($row['stream_description'])." \n"; - if (permission_exists('stream_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('stream_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/switch/resources/classes/presence.php b/app/switch/resources/classes/presence.php index b455c24a6d..c645f8eac4 100644 --- a/app/switch/resources/classes/presence.php +++ b/app/switch/resources/classes/presence.php @@ -23,12 +23,7 @@ /** * presence class - * - * @method boolean active - * @method array show */ - -if (!class_exists('presence')) { class presence { /** @@ -84,7 +79,6 @@ if (!class_exists('presence')) { return $array; } } -} //examples /* @@ -97,11 +91,9 @@ if (!class_exists('presence')) { echo "active: true\n"; } else { - echo "active: false\n"; + echo "active: false\n"; } //show active the presence $presence = new presence; $array = $presence->show(); */ - -?> diff --git a/app/switch/resources/classes/ringbacks.php b/app/switch/resources/classes/ringbacks.php index db05aeb98a..d206eac70b 100644 --- a/app/switch/resources/classes/ringbacks.php +++ b/app/switch/resources/classes/ringbacks.php @@ -25,7 +25,6 @@ Matthew Vale */ -if (!class_exists('ringbacks')) { class ringbacks { //define variables @@ -85,18 +84,15 @@ if (!class_exists('ringbacks')) { */ //get the tones - require_once "resources/classes/tones.php"; $tones = new tones; $this->tones_list = $tones->tones_list(); //get music on hold and recordings if (is_dir($_SERVER["PROJECT_ROOT"].'/app/music_on_hold')) { - require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $music = new switch_music_on_hold; $this->music_list = $music->get(); } if (is_dir($_SERVER["PROJECT_ROOT"].'/app/recordings')) { - require_once "app/recordings/resources/classes/switch_recordings.php"; $recordings = new switch_recordings; $this->recordings_list = $recordings->list_recordings(); } @@ -232,6 +228,3 @@ if (!class_exists('ringbacks')) { return $select; } } -} - -?> diff --git a/app/switch/resources/classes/switch_files.php b/app/switch/resources/classes/switch_files.php index 80b1b24436..c98091a624 100644 --- a/app/switch/resources/classes/switch_files.php +++ b/app/switch/resources/classes/switch_files.php @@ -26,12 +26,7 @@ /** * switch class provides methods for copying switch_files - * - * @method string correct_path - * @method string copy_scripts - * @method string copy_languages */ -if (!class_exists('switch_files')) { class switch_files { /** @@ -158,7 +153,6 @@ if (!class_exists('switch_files')) { } } -} /* //example use @@ -168,5 +162,3 @@ if (!class_exists('switch_files')) { $obj->copy_scripts(); $obj->copy_languages(); */ - -?> diff --git a/app/switch/resources/conf/autoload_configs/abstraction.conf.xml b/app/switch/resources/conf/autoload_configs/abstraction.conf.xml index d4b1dfd274..b527ac233d 100644 --- a/app/switch/resources/conf/autoload_configs/abstraction.conf.xml +++ b/app/switch/resources/conf/autoload_configs/abstraction.conf.xml @@ -1,5 +1,5 @@ - + diff --git a/app/switch/resources/scripts/app/emergency/index.lua b/app/switch/resources/scripts/app/emergency/index.lua index f4bffd0936..53c945a435 100644 --- a/app/switch/resources/scripts/app/emergency/index.lua +++ b/app/switch/resources/scripts/app/emergency/index.lua @@ -56,6 +56,9 @@ delete = argv[1]; --prepare the api object api = freeswitch.API(); +--prepare the email to address +to = {} + --get sessions info if (session and session:ready()) then domain_uuid = session:getVariable("domain_uuid"); @@ -71,21 +74,6 @@ else headers = {} end -function escape_csv(s) - if string.find(s, '[,"]') then - s = '"' .. string.gsub(s, '"', '""') .. '"' - end - return s -end - -function to_csv(tt) - local s = "" - for _,p in ipairs(tt) do - s = s .. "," .. escape_csv(p) - end - return string.sub(s, 2) -end - --connect to the database local dbh = Database.new('system'); @@ -94,7 +82,7 @@ local sql = "SELECT * FROM v_email_templates "; sql = sql .. "WHERE template_category = :category "; sql = sql .. "AND template_subcategory = :subcategory "; sql = sql .. "AND template_enabled = :status "; - local params = {category = 'plugins', subcategory = 'emergency', status = 'true'} + local params = {category = 'plugin', subcategory = 'emergency', status = 'true'} dbh:query(sql, params, function(row) subject = row.template_subject; body = row.template_body; @@ -130,63 +118,52 @@ if (session and session:ready()) then sip_from_user = session:getVariable("sip_from_user"); emergency_caller_id_name = session:getVariable("emergency_caller_id_name"); emergency_caller_id_number = session:getVariable("emergency_caller_id_number"); - call_duration = session:getVariable("call_duration"); + outbound_caller_id_name = session:getVariable("outbound_caller_id_name"); + outbound_caller_id_number = session:getVariable("outbound_caller_id_number"); destination_number = session:getVariable("destination_number"); end ---domain level check -result = {} -local sql = "SELECT count(domain_setting_value) "; -sql = sql .. "AS total "; -sql = sql .. "FROM v_domain_settings "; -sql = sql .. "WHERE domain_uuid = :domain_uuid "; -sql = sql .. "AND domain_setting_category = :category "; -sql = sql .. "AND domain_setting_subcategory = :email_address "; -sql = sql .. "AND domain_setting_enabled = :status "; - -local params = {domain_uuid = domain_uuid, category = 'emergency', email_address = 'email_address', status = 't'} +--set the defaults +if (not emergency_caller_id_name or emergency_caller_id_name == '') then + emergency_caller_id_name = outbound_caller_id_name +end +if (not emergency_caller_id_number or emergency_caller_id_number == '') then + emergency_caller_id_number = outbound_caller_id_number +end +--no emergency emails found under domain, using default +local sql = "SELECT default_setting_value "; + sql = sql .. "FROM v_default_settings "; + sql = sql .. "WHERE default_setting_category = :category "; + sql = sql .. "AND default_setting_subcategory = :email_address "; + sql = sql .. "AND default_setting_enabled = :status "; + sql = sql .. "LIMIT 5 "; +local params = {category = 'emergency', email_address = 'email_address', status = 't'} dbh:query(sql, params, function(result) - total = result.total; - --no emergency emails found under domain, using default - if (total == 0 or total == nil) then - to = {} - local sql = "SELECT default_setting_value "; - sql = sql .. "FROM v_default_settings "; - sql = sql .. "WHERE default_setting_category = :category "; - sql = sql .. "AND default_setting_subcategory = :email_address "; - sql = sql .. "AND default_setting_enabled = :status "; - sql = sql .. "LIMIT 5 "; - local params = {category = 'emergency', email_address = 'email_address', status = 't'} - dbh:query(sql, params, function(result) - for key,row in pairs(result) do - table.insert(to, row); - freeswitch.consoleLog("info", "[emergency] Inserted into table from default settings " .. row .. "\n"); - end - --add some details - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[emergency] SQL: " .. sql .. " result " .. result .. "\n"); - end - end); - --domain level emails max 5 - else if (tonumber(total) <= 5) then - to = {} - local sql = "SELECT domain_setting_value "; - sql = sql .. "FROM v_domain_settings "; - sql = sql .. "WHERE domain_uuid = :domain_uuid "; - sql = sql .. "AND domain_setting_category = :category "; - sql = sql .. "AND domain_setting_subcategory = :email_address "; - sql = sql .. "AND domain_setting_enabled = :status "; - local params = {domain_uuid = domain_uuid, category = 'emergency', email_address = 'email_address', status = 't'} - dbh:query(sql, params, function(result) - for key,row in pairs(result) do - table.insert(to, row); - freeswitch.consoleLog("info", "[template] Inserted into table " .. row .. "\n"); - end - end); - end + for key,row in pairs(result) do + table.insert(to, row); + freeswitch.consoleLog("info", "[emergency] Inserted into table from default settings " .. row .. "\n"); end + --add some details + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[emergency] SQL: " .. sql .. " result " .. result .. "\n"); + end +end); +--domain level emails max 5 +local sql = "SELECT domain_setting_value "; + sql = sql .. "FROM v_domain_settings "; + sql = sql .. "WHERE domain_uuid = :domain_uuid "; + sql = sql .. "AND domain_setting_category = :category "; + sql = sql .. "AND domain_setting_subcategory = :email_address "; + sql = sql .. "AND domain_setting_enabled = :status "; + sql = sql .. "LIMIT 5 "; +local params = {domain_uuid = domain_uuid, category = 'emergency', email_address = 'email_address', status = 't'} +dbh:query(sql, params, function(result) + for key,row in pairs(result) do + table.insert(to, row); + freeswitch.consoleLog("info", "[template] Inserted into table " .. row .. "\n"); + end end); --set event @@ -209,6 +186,9 @@ end local t = dbh:first_row(sql); call_date = t.call_date; +-- replace the hardcoded template subject with the event +subject = event; + --send the email if (#to > 0) then --prepare the body @@ -218,7 +198,6 @@ if (#to > 0) then body = body:gsub("${emergency_caller_id_name}", emergency_caller_id_name); body = body:gsub("${emergency_caller_id_number}", emergency_caller_id_number); body = body:gsub("${sip_from_user}", sip_from_user); - body = body:gsub("${caller_id_number}", caller_id_number); body = body:gsub("${message_date}", call_date); body = body:gsub("${event}", event); body = trim(body); diff --git a/app/system/resources/dashboard/system_counts.php b/app/system/resources/dashboard/system_counts.php index 323e71dedb..c143d18433 100644 --- a/app/system/resources/dashboard/system_counts.php +++ b/app/system/resources/dashboard/system_counts.php @@ -260,8 +260,8 @@ //get the domain active and inactive counts $sql = "select "; - $sql .= "(select count(*) from v_domains where domain_enabled = 'true') as active, "; - $sql .= "(select count(*) 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/system/system.php b/app/system/system.php index 38b14c0e69..ce51b6b116 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -49,9 +49,9 @@ if (permission_exists("system_view_support")) { $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'; - $setting_invisibles = !empty($_SESSION["editor"]["invisibles"]["boolean"]) ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false'; - $setting_indenting = !empty($_SESSION["editor"]["indent_guides"]["boolean"]) ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false'; - $setting_numbering = !empty($_SESSION["editor"]["line_numbers"]["boolean"]) ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true'; + $setting_invisibles = isset($_SESSION['editor']['invisibles']['text']) ? $_SESSION['editor']['invisibles']["text"] : 'false'; + $setting_indenting = isset($_SESSION['editor']['indent_guides']['text']) ? $_SESSION['editor']['indent_guides']["text"]: 'false'; + $setting_numbering = isset($_SESSION['editor']['line_numbers']['text']) ? $_SESSION['editor']['line_numbers']["text"] : 'true'; } //additional includes diff --git a/app/time_conditions/resources/classes/time_conditions.php b/app/time_conditions/resources/classes/time_conditions.php index 98a5e757df..c4be826b78 100644 --- a/app/time_conditions/resources/classes/time_conditions.php +++ b/app/time_conditions/resources/classes/time_conditions.php @@ -25,7 +25,6 @@ */ //define the time conditions class - if (!class_exists('time_conditions')) { class time_conditions { /** @@ -346,6 +345,3 @@ } //class - } - -?> diff --git a/app/time_conditions/time_conditions.php b/app/time_conditions/time_conditions.php index 6f5eede525..23eb0b57ee 100644 --- a/app/time_conditions/time_conditions.php +++ b/app/time_conditions/time_conditions.php @@ -210,7 +210,7 @@ echo th_order_by('dialplan_order', $text['label-order'], $order_by, $order, null, "class='center'", ($search != '' ? "search=".$search : null)); echo th_order_by('dialplan_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'", ($search != '' ? "search=".$search : null)); echo th_order_by('dialplan_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'", ($search != '' ? "search=".$search : null)); - if (permission_exists('time_condition_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('time_condition_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -264,7 +264,7 @@ } echo " \n"; echo " ".$row['dialplan_description']." \n"; - if (permission_exists('time_condition_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('time_condition_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/vars/resources/classes/vars.php b/app/vars/resources/classes/vars.php index 3f137327d5..7018b3da36 100644 --- a/app/vars/resources/classes/vars.php +++ b/app/vars/resources/classes/vars.php @@ -25,7 +25,6 @@ */ //define the vars class -if (!class_exists('vars')) { class vars { /** @@ -258,6 +257,3 @@ if (!class_exists('vars')) { } } -} - -?> \ No newline at end of file diff --git a/app/vars/vars.php b/app/vars/vars.php index 3e17ca5a23..cc97607fa8 100644 --- a/app/vars/vars.php +++ b/app/vars/vars.php @@ -85,7 +85,7 @@ $order = $_GET["order"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //get the count $sql = "select count(var_uuid) from v_vars "; @@ -207,7 +207,7 @@ echo th_order_by('var_hostname', $text['label-hostname'], $order_by, $order, null, "class='hide-sm-dn'"); echo th_order_by('var_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo "".$text['label-description']."\n"; - if (permission_exists('var_edit') && $list_row_edit_button == 'true') { + if (permission_exists('var_edit') && $list_row_edit_button) { echo " \n"; } echo "\n"; @@ -263,7 +263,7 @@ } echo " \n"; echo " ".escape($row['var_description'] ?? '')."\n"; - if (permission_exists('var_edit') && $list_row_edit_button == 'true') { + if (permission_exists('var_edit') && $list_row_edit_button) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/voicemail_greetings/resources/classes/voicemail_greetings.php b/app/voicemail_greetings/resources/classes/voicemail_greetings.php index b8ae36fb28..74b50cd0d2 100644 --- a/app/voicemail_greetings/resources/classes/voicemail_greetings.php +++ b/app/voicemail_greetings/resources/classes/voicemail_greetings.php @@ -25,7 +25,6 @@ */ //define the voicemail greetings class -if (!class_exists('voicemail_greetings')) { class voicemail_greetings { /** @@ -166,6 +165,3 @@ if (!class_exists('voicemail_greetings')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/app/voicemail_greetings/voicemail_greetings.php b/app/voicemail_greetings/voicemail_greetings.php index 49eec2c8bb..fef31701f3 100644 --- a/app/voicemail_greetings/voicemail_greetings.php +++ b/app/voicemail_greetings/voicemail_greetings.php @@ -424,7 +424,7 @@ } echo th_order_by('greeting_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn pct-25'", "id=".urlencode($voicemail_id)); $col_count++; - if (permission_exists('voicemail_greeting_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('voicemail_greeting_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo "  \n"; } echo "\n"; @@ -497,7 +497,7 @@ echo " ".$file_date."\n"; } echo " ".escape($row['greeting_description'])." \n"; - if (permission_exists('voicemail_greeting_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('voicemail_greeting_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { echo " "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/voicemail_greetings/waveform.php b/app/voicemail_greetings/waveform.php index f24c62be62..78325752ef 100644 --- a/app/voicemail_greetings/waveform.php +++ b/app/voicemail_greetings/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; @@ -103,8 +102,8 @@ Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba - Waveform::$singlePhase = empty($_SESSION['theme']['audio_player_waveform_single_phase']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] !== 'true' ? false : true; // positive phase only - left (a-leg) top, right (b-leg) bottom - Waveform::$singleAxis = empty($_SESSION['theme']['audio_player_waveform_single_axis']['boolean']) || $_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] !== 'false' ? true : false; // combine channels into single axis + Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom + Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis $height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null; $wf = $waveform->getWaveform($greeting_dir.'/'.$temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string } diff --git a/app/voicemails/app_languages.php b/app/voicemails/app_languages.php index 6c0ec4839a..0b1f9520e6 100644 --- a/app/voicemails/app_languages.php +++ b/app/voicemails/app_languages.php @@ -1755,32 +1755,32 @@ $text['description-voicemail_alternate_greet_id']['zh-cn'] = "默认问候语中 $text['description-voicemail_alternate_greet_id']['ja-jp'] = "デフォルトのグリーティングで使用される代替グリーティング ID。"; $text['description-voicemail_alternate_greet_id']['ko-kr'] = "기본 인사말에 사용되는 대체 인사말 ID입니다."; -$text['description-voicemail_mail_to']['en-us'] = "Enter the email address to send voicemail to. Multiple addresses may be separated by commas."; -$text['description-voicemail_mail_to']['en-gb'] = "Enter the email address to send voicemail to. Multiple addresses may be separated by commas."; -$text['description-voicemail_mail_to']['ar-eg'] = "أدخل عنوان البريد الإلكتروني لإرسال بريد صوتي إليه. يمكن فصل العناوين المتعددة بفاصلات."; -$text['description-voicemail_mail_to']['de-at'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['de-ch'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['de-de'] = "Geben Sie die Email Adresse an, an die Ihre Mailbox Nachricht gesendet werden soll (optional)."; -$text['description-voicemail_mail_to']['el-gr'] = "Εισαγάγετε τη διεύθυνση email στην οποία θα στείλετε αυτόματο τηλεφωνητή. Πολλές διευθύνσεις μπορούν να διαχωριστούν με κόμμα."; -$text['description-voicemail_mail_to']['es-cl'] = "Ingrese las direcciones de correo a quien desee enviar el correo de voz."; -$text['description-voicemail_mail_to']['es-mx'] = "Ingrese las direcciones de correo a quien desee enviar el correo de voz."; -$text['description-voicemail_mail_to']['fr-ca'] = "Saisissez l'adresse e-mail à laquelle envoyer le message vocal. Plusieurs adresses peuvent être séparées par des virgules."; -$text['description-voicemail_mail_to']['fr-fr'] = "Saisissez l'adresse e-mail à laquelle envoyer le message vocal. Plusieurs adresses peuvent être séparées par des virgules."; -$text['description-voicemail_mail_to']['he-il'] = "הזן את כתובת הדואר האלקטרוני שאליה יש לשלוח דואר קולי. כתובות מרובות עשויות להיות מופרדות בפסיקים."; -$text['description-voicemail_mail_to']['it-it'] = "Inserire l'indirizzo email a cui spedire i messaggi vocali."; -$text['description-voicemail_mail_to']['ka-ge'] = "შეიყვანეთ ელფოსტის მისამართი, სადაც ხმოვანი ფოსტა გაიგზავნება. ერთზე მეტი მისამართი მძიმით უნდა გამოჰყოთ."; -$text['description-voicemail_mail_to']['nl-nl'] = "Voer het E-mail adres om de boodschap naar te sturen."; -$text['description-voicemail_mail_to']['pl-pl'] = "Dodaj adres email na który będą wysyłane pliki poczty głosowej"; -$text['description-voicemail_mail_to']['pt-br'] = "Insira o endereço de email para enviar o correio de voz (opcional)"; -$text['description-voicemail_mail_to']['pt-pt'] = "Introduza o endereço de email para enviar o correio de voz."; -$text['description-voicemail_mail_to']['ro-ro'] = "Introduceți adresa de e-mail la care trimiteți mesajul vocal. Adresele multiple pot fi separate prin virgule."; -$text['description-voicemail_mail_to']['ru-ru'] = "Введите адрес электронной почты для отправки голосовой почты."; -$text['description-voicemail_mail_to']['sv-se'] = "Ange E-post adressen dit meddelande skall skickas."; -$text['description-voicemail_mail_to']['uk-ua'] = "Введіть адресу E-Mail на яку надіслати голосове повідомлення"; -$text['description-voicemail_mail_to']['tr-tr'] = "Sesli mesajın gönderileceği e-posta adresini girin. Birden fazla adres virgülle ayrılabilir."; -$text['description-voicemail_mail_to']['zh-cn'] = "输入要向其发送语音邮件的电子邮件地址。 多个地址可以用逗号分隔。"; -$text['description-voicemail_mail_to']['ja-jp'] = "ボイスメールの送信先の電子メール アドレスを入力します。 複数のアドレスはカンマで区切ることができます。"; -$text['description-voicemail_mail_to']['ko-kr'] = "음성 메일을 보낼 이메일 주소를 입력합니다. 여러 주소는 쉼표로 구분할 수 있습니다."; +$text['description-voicemail_mail_to']['en-us'] = "Enter the email address to send voicemail to (optional). Multiple addresses may be separated by commas."; +$text['description-voicemail_mail_to']['en-gb'] = "Enter the email address to send voicemail to (optional). Multiple addresses may be separated by commas."; +$text['description-voicemail_mail_to']['ar-eg'] = "أدخل عنوان البريد الإلكتروني لإرسال البريد الصوتي إليه (اختياري). يمكن فصل العناوين المتعددة بفواصل."; +$text['description-voicemail_mail_to']['de-at'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['de-ch'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['de-de'] = "Geben Sie die E-Mail-Adresse ein, an die die Voicemail gesendet werden soll (optional). Mehrere Adressen können durch Kommas getrennt werden."; +$text['description-voicemail_mail_to']['el-gr'] = "Εισαγάγετε τη διεύθυνση email για αποστολή του φωνητικού μηνύματος (προαιρετικό). Πολλαπλές διευθύνσεις μπορούν να διαχωριστούν με κόμματα."; +$text['description-voicemail_mail_to']['es-cl'] = "Ingrese la dirección de correo electrónico para enviar el correo de voz (opcional). Se pueden separar múltiples direcciones con comas."; +$text['description-voicemail_mail_to']['es-mx'] = "Ingrese la dirección de correo electrónico para enviar el correo de voz (opcional). Se pueden separar múltiples direcciones con comas."; +$text['description-voicemail_mail_to']['fr-ca'] = "Entrez l'adresse e-mail à laquelle envoyer la messagerie vocale (facultatif). Plusieurs adresses peuvent être séparées par des virgules."; +$text['description-voicemail_mail_to']['fr-fr'] = "Entrez l'adresse e-mail à laquelle envoyer la messagerie vocale (facultatif). Plusieurs adresses peuvent être séparées par des virgules."; +$text['description-voicemail_mail_to']['he-il'] = "הזן את כתובת האימייל לשליחת הדואר הקולי (אופציונלי). ניתן להפריד בין כתובות מרובות באמצעות פסיקים."; +$text['description-voicemail_mail_to']['it-it'] = "Inserisci l'indirizzo email a cui inviare la segreteria telefonica (opzionale). Più indirizzi possono essere separati da virgole."; +$text['description-voicemail_mail_to']['ka-ge'] = "შეიყვანეთ ელ.ფოსტის მისამართი, რომელზეც გაიგზავნება ხმოვანი ფოსტა (არასავალდებულო). შესაძლებელია მრავალი მისამართის მძიმით გამოყოფა."; +$text['description-voicemail_mail_to']['nl-nl'] = "Voer het e-mailadres in om de voicemail naartoe te sturen (optioneel). Meerdere adressen kunnen worden gescheiden door komma's."; +$text['description-voicemail_mail_to']['pl-pl'] = "Wprowadź adres e-mail, na który ma zostać wysłana poczta głosowa (opcjonalnie). Wiele adresów można oddzielić przecinkami."; +$text['description-voicemail_mail_to']['pt-br'] = "Digite o endereço de e-mail para enviar o correio de voz (opcional). Vários endereços podem ser separados por vírgulas."; +$text['description-voicemail_mail_to']['pt-pt'] = "Digite o endereço de e-mail para enviar o correio de voz (opcional). Vários endereços podem ser separados por vírgulas."; +$text['description-voicemail_mail_to']['ro-ro'] = "Introduceți adresa de e-mail la care se va trimite mesageria vocală (opțional). Mai multe adrese pot fi separate prin virgule."; +$text['description-voicemail_mail_to']['ru-ru'] = "Введите адрес электронной почты для отправки голосовой почты (необязательно). Несколько адресов можно разделять запятыми."; +$text['description-voicemail_mail_to']['sv-se'] = "Ange e-postadressen som röstbrevet ska skickas till (valfritt). Flera adresser kan separeras med kommatecken."; +$text['description-voicemail_mail_to']['uk-ua'] = "Введіть адресу електронної пошти для надсилання голосової пошти (необов’язково). Декілька адрес можна розділити комами."; +$text['description-voicemail_mail_to']['tr-tr'] = "Sesli mesajın gönderileceği e-posta adresini girin (isteğe bağlı). Birden fazla adres virgülle ayrılabilir."; +$text['description-voicemail_mail_to']['zh-cn'] = "输入要发送语音邮件的电子邮件地址(可选)。多个地址可用逗号分隔。"; +$text['description-voicemail_mail_to']['ja-jp'] = "ボイスメールを送信するメールアドレスを入力してください(オプション)。複数のアドレスはコンマで区切ることができます。"; +$text['description-voicemail_mail_to']['ko-kr'] = "보이스메일을 보낼 이메일 주소를 입력하세요(선택 사항). 여러 개의 주소는 쉼표로 구분할 수 있습니다."; $text['description-voicemail_local_after_email']['en-us'] = "Choose whether to keep the voicemail in the system after sending the email notification."; $text['description-voicemail_local_after_email']['en-gb'] = "Choose whether to keep the voicemail in the system after sending the email notification."; diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index 771d07ed97..cfeca41e78 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -1581,7 +1581,6 @@ } //example voicemail messages - //require_once "app/voicemails/resources/classes/voicemail.php"; //$voicemail = new voicemail; //$voicemail->voicemail_uuid = $voicemail_uuid; //$voicemail->order_by = $order_by; diff --git a/app/voicemails/resources/dashboard/voicemails.php b/app/voicemails/resources/dashboard/voicemails.php index a8e88448c4..6f062a54ca 100644 --- a/app/voicemails/resources/dashboard/voicemails.php +++ b/app/voicemails/resources/dashboard/voicemails.php @@ -23,9 +23,6 @@ //voicemail echo "
\n"; -//required class - require_once "app/voicemails/resources/classes/voicemail.php"; - //get the voicemail $vm = new voicemail; $vm->domain_uuid = $_SESSION['domain_uuid']; diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php index 61637bd4c2..c8e3d49d1f 100644 --- a/app/voicemails/voicemail_edit.php +++ b/app/voicemails/voicemail_edit.php @@ -152,8 +152,8 @@ if ($action == "add" && permission_exists('voicemail_add')) { $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') && isset($_SESSION['voicemail']['transcription_enabled_default']['boolean'])) { - $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean'] ?? 'false'; + if (!permission_exists('voicemail_transcription_enabled')) { + $voicemail_transcription_enabled = filter_var($_SESSION['voicemail']['transcription_enabled_default']['boolean'] ?? false, FILTER_VALIDATE_BOOL); } } @@ -353,7 +353,7 @@ } else { $voicemail_file = $_SESSION['voicemail']['voicemail_file']['text']; - $voicemail_local_after_email = $_SESSION['voicemail']['keep_local']['boolean']; + $voicemail_local_after_email = filter_var($_SESSION['voicemail']['keep_local']['boolean'] ?? false, FILTER_VALIDATE_BOOL); } //remove the spaces @@ -364,7 +364,7 @@ //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 = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; } + if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = filter_var($_SESSION['voicemail']['transcription_enabled_default']['boolean'] ?? false, FILTER_VALIDATE_BOOL); } 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'; } @@ -469,8 +469,8 @@ require_once "resources/header.php"; //password complexity - $password_complexity = $_SESSION['voicemail']['password_complexity']['boolean'] ?? ''; - if ($password_complexity == "true") { + $password_complexity = filter_var($_SESSION['voicemail']['password_complexity']['boolean'] ?? false, FILTER_VALIDATE_BOOL); + if ($password_complexity) { echo "\n"; -?> +?> \ No newline at end of file diff --git a/core/menu/menu_restore_default.php b/core/menu/menu_restore_default.php index ef46c1e998..df0c5f3c1a 100644 --- a/core/menu/menu_restore_default.php +++ b/core/menu/menu_restore_default.php @@ -51,7 +51,6 @@ } //menu restore default - //require_once "resources/classes/menu.php"; $menu = new menu; $menu->menu_uuid = $menu_uuid; $menu->menu_language = $menu_language; diff --git a/core/software/resources/classes/software.php b/core/software/resources/classes/software.php index 7fe0436ccd..16f8bac3d0 100644 --- a/core/software/resources/classes/software.php +++ b/core/software/resources/classes/software.php @@ -2,17 +2,14 @@ /** * software class - * - * @method string version */ -if (!class_exists('software')) { class software { /** * version */ public static function version() { - return '5.4.1'; + return '5.4.2'; } /** @@ -25,6 +22,3 @@ if (!class_exists('software')) { } } -} - -?> diff --git a/core/upgrade/index.php b/core/upgrade/index.php index eb56ed9fce..5d7f1499eb 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -133,7 +133,6 @@ //load an array of the database schema and compare it with the active database if (!empty($action["upgrade_schema"]) && permission_exists("upgrade_schema")) { - require_once "resources/classes/schema.php"; $obj = new schema(); if (isset($action["data_types"]) && $action["data_types"] == 'true') { $obj->data_types = true; diff --git a/core/upgrade/upgrade.php b/core/upgrade/upgrade.php index 376c3b0a22..0d999aea99 100644 --- a/core/upgrade/upgrade.php +++ b/core/upgrade/upgrade.php @@ -181,6 +181,7 @@ $auto_loader = new auto_loader(); $auto_loader->reload_classes(); $auto_loader->update_cache(); + $auto_loader->clear_cache(); //get the version of the software if ($upgrade_type == 'version') { @@ -189,8 +190,6 @@ //run all app_defaults.php files if ($upgrade_type == 'domains') { - require_once "resources/classes/config.php"; - require_once "resources/classes/domains.php"; $domain = new domains; $domain->display_type = $display_type; $domain->upgrade(); @@ -199,7 +198,6 @@ //upgrade schema and/or data_types if ($upgrade_type == 'schema') { //get the database schema put it into an array then compare and update the database as needed. - require_once "resources/classes/schema.php"; $obj = new schema; if (isset($argv[2]) && $argv[2] == 'data_types') { $obj->data_types = true; diff --git a/core/upgrade/upgrade_domains.php b/core/upgrade/upgrade_domains.php index 99931b27a1..e2d1692b0a 100644 --- a/core/upgrade/upgrade_domains.php +++ b/core/upgrade/upgrade_domains.php @@ -46,8 +46,6 @@ } //run all app_defaults.php files - require_once "resources/classes/config.php"; - require_once "resources/classes/domains.php"; $domain = new domains; $domain->display_type = $display_type; $domain->upgrade(); diff --git a/core/upgrade/upgrade_menu.php b/core/upgrade/upgrade_menu.php index e2497f80f9..f44373c479 100644 --- a/core/upgrade/upgrade_menu.php +++ b/core/upgrade/upgrade_menu.php @@ -273,8 +273,6 @@ function do_upgrade_code_submodules() { * Execute all app_defaults.php files */ function do_upgrade_domains() { - require_once dirname(__DIR__, 2) . "/resources/classes/config.php"; - require_once dirname(__DIR__, 2) . "/resources/classes/domains.php"; $domain = new domains; $domain->display_type = 'text'; $domain->upgrade(); @@ -285,7 +283,6 @@ function do_upgrade_domains() { */ function do_upgrade_schema(bool $data_types = false) { //get the database schema put it into an array then compare and update the database as needed. - require_once dirname(__DIR__, 2) . "/resources/classes/schema.php"; $obj = new schema; $obj->data_types = $data_types; echo $obj->schema('text'); diff --git a/core/upgrade/upgrade_schema.php b/core/upgrade/upgrade_schema.php index aa60ffef8a..807631d935 100644 --- a/core/upgrade/upgrade_schema.php +++ b/core/upgrade/upgrade_schema.php @@ -59,7 +59,6 @@ $text = $language->get(); //get the database schema put it into an array then compare and update the database as needed. - require_once "resources/classes/schema.php"; $obj = new schema; if (isset($argv[1]) && $argv[1] == 'data_types') { $obj->data_types = true; diff --git a/core/user_logs/resources/classes/user_logs.php b/core/user_logs/resources/classes/user_logs.php index 041603f66f..659e3976f2 100644 --- a/core/user_logs/resources/classes/user_logs.php +++ b/core/user_logs/resources/classes/user_logs.php @@ -26,12 +26,7 @@ /** * user_logs class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('user_logs')) { class user_logs { /** @@ -151,6 +146,3 @@ if (!class_exists('user_logs')) { } } -} - -?> diff --git a/core/user_settings/resources/classes/user_settings.php b/core/user_settings/resources/classes/user_settings.php index dea8b87ab3..8819ae58b0 100644 --- a/core/user_settings/resources/classes/user_settings.php +++ b/core/user_settings/resources/classes/user_settings.php @@ -25,7 +25,6 @@ */ //define the user settings class -if (!class_exists('user_settings')) { class user_settings { /** @@ -181,6 +180,3 @@ if (!class_exists('user_settings')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/core/user_settings/user_setting_set.php b/core/user_settings/user_setting_set.php index 90dc47ed26..ef9dc20c86 100644 --- a/core/user_settings/user_setting_set.php +++ b/core/user_settings/user_setting_set.php @@ -107,7 +107,6 @@ Mark J Crane //revoke temporary permissions $p->delete('user_setting_delete', 'temp'); //reset session variables to default - require "resources/classes/domains.php"; $domain = new domains(); $domain->set(); } diff --git a/core/user_settings/user_settings.php b/core/user_settings/user_settings.php index 2da99490a6..a77d0b249a 100644 --- a/core/user_settings/user_settings.php +++ b/core/user_settings/user_settings.php @@ -119,7 +119,7 @@ $order = $_GET["order"] ?? ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true' : 'false'; $button_icon_back = !empty($_SESSION['theme']['button_icon_back']) ? $_SESSION['theme']['button_icon_back'] : ''; $button_icon_add = !empty($_SESSION['theme']['button_icon_add']) ? $_SESSION['theme']['button_icon_add'] : ''; $button_icon_copy = !empty($_SESSION['theme']['button_icon_copy']) ? $_SESSION['theme']['button_icon_copy'] : ''; @@ -259,7 +259,7 @@ echo "".$text['label-value'].""; echo "".$text['label-enabled'].""; echo "".$text['label-description'].""; - if (permission_exists('user_setting_edit') && $list_row_edit_button == 'true') { + if (permission_exists('user_setting_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -383,7 +383,7 @@ } echo " \n"; echo " ".escape($row['user_setting_description'])." \n"; - if (permission_exists('user_setting_edit') && $list_row_edit_button == 'true') { + if (permission_exists('user_setting_edit') && $list_row_edit_button) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$button_icon_edit,'link'=>$list_row_url]); echo " \n"; diff --git a/core/users/resources/classes/users.php b/core/users/resources/classes/users.php index 734ce273d9..f7424b734e 100644 --- a/core/users/resources/classes/users.php +++ b/core/users/resources/classes/users.php @@ -26,12 +26,7 @@ /** * users class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('users')) { class users { /** @@ -315,6 +310,3 @@ if (!class_exists('users')) { } } } -} - -?> diff --git a/core/users/user_edit.php b/core/users/user_edit.php index 71813680bc..6d1ecfc835 100644 --- a/core/users/user_edit.php +++ b/core/users/user_edit.php @@ -105,10 +105,10 @@ //retrieve password requirements if (permission_exists('user_password')) { $required['length'] = $_SESSION['users']['password_length']['numeric']; - $required['number'] = ($_SESSION['users']['password_number']['boolean'] == 'true') ? true : false; - $required['lowercase'] = ($_SESSION['users']['password_lowercase']['boolean'] == 'true') ? true : false; - $required['uppercase'] = ($_SESSION['users']['password_uppercase']['boolean'] == 'true') ? true : false; - $required['special'] = ($_SESSION['users']['password_special']['boolean'] == 'true') ? true : false; + $required['number'] = filter_var($_SESSION['users']['password_number']['boolean'] ?? false, FILTER_VALIDATE_BOOL); + $required['lowercase'] = filter_var($_SESSION['users']['password_lowercase']['boolean'] ?? false, FILTER_VALIDATE_BOOL); + $required['uppercase'] = filter_var($_SESSION['users']['password_uppercase']['boolean'] ?? false, FILTER_VALIDATE_BOOL); + $required['special'] = filter_var($_SESSION['users']['password_special']['boolean'] ?? false, FILTER_VALIDATE_BOOL); } //prepare the data diff --git a/core/users/users.php b/core/users/users.php index fa6e34b052..05d5056762 100644 --- a/core/users/users.php +++ b/core/users/users.php @@ -89,7 +89,7 @@ $show = !empty($_GET["show"]) ? $_GET["show"] : ''; //set from session variables - $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + $list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL); //add the search string if (!empty($search)) { @@ -251,7 +251,7 @@ //echo th_order_by('add_date', $text['label-add_date'], $order_by, $order); echo th_order_by('contact_note', $text['label-contact_note'], $order_by, $order, null, "class='center'", $param); echo th_order_by('user_enabled', $text['label-user_enabled'], $order_by, $order, null, "class='center'", $param); - if (permission_exists('user_edit') && $list_row_edit_button == 'true') { + if (permission_exists('user_edit') && $list_row_edit_button) { echo "  \n"; } echo "\n"; @@ -300,7 +300,7 @@ echo $text['label-'.$row['user_enabled']]; } echo " \n"; - if (permission_exists('user_edit') && $list_row_edit_button == 'true') { + if (permission_exists('user_edit') && $list_row_edit_button) { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/logout.php b/logout.php index 108163ef28..71ccc407e1 100644 --- a/logout.php +++ b/logout.php @@ -41,7 +41,7 @@ //check for login return preference if (!empty($_SESSION["user_uuid"])) { - if (isset($_SESSION['login']['destination_last']) && ($_SESSION['login']['destination_last']['boolean'] == 'true')) { + if (isset($_SESSION['login']['destination_last']) && filter_var($_SESSION['login']['destination_last']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { if ($_SERVER['HTTP_REFERER'] != '') { //convert to relative path $referrer = substr($_SERVER['HTTP_REFERER'], strpos($_SERVER['HTTP_REFERER'], $_SERVER["HTTP_HOST"]) + strlen($_SERVER["HTTP_HOST"])); diff --git a/resources/classes/auto_loader.php b/resources/classes/auto_loader.php index 63042eb2d7..7befa402e8 100644 --- a/resources/classes/auto_loader.php +++ b/resources/classes/auto_loader.php @@ -1,29 +1,37 @@ - Portions created by the Initial Developer are Copyright (C) 2008-2024 - the Initial Developer. All Rights Reserved. + The Initial Developer of the Original Code is + Mark J Crane + Portions created by the Initial Developer are Copyright (C) 2008-2024 + the Initial Developer. All Rights Reserved. - Contributor(s): - Mark J Crane -*/ + Contributor(s): + Mark J Crane + */ +/** + * Auto Loader class + * Searches for project files when a class is required. Debugging mode can be set using: + * - export DEBUG=1 + * OR + * - debug=true is appended to the url + */ class auto_loader { const FILE = 'autoloader_cache.php'; @@ -37,11 +45,20 @@ class auto_loader { */ private $apcu_enabled; + /** + * Cache path and file name + * @var string + */ + private static $cache_file = null; + public function __construct($project_path = '') { //set if we can use RAM cache $this->apcu_enabled = function_exists('apcu_enabled') && apcu_enabled(); + //set cache location + self::$cache_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . self::FILE; + //classes must be loaded before this object is registered if (!$this->load_cache()) { //cache miss so load them @@ -55,18 +72,20 @@ class auto_loader { public function update_cache(string $file = ''): bool { //guard against writing an empty file - if (!empty($this->classes)) { + if (empty($this->classes)) { return false; } //update RAM cache when available if ($this->apcu_enabled) { - apcu_store(self::CACHE_KEY, $this->classes); + $success = apcu_store(self::CACHE_KEY, $this->classes); + //do not save to drive when we are using apcu + if ($success) return true; } //ensure we have somewhere to put the file if (empty($file)) { - $file = sys_get_temp_dir() . '/' . self::FILE; + $file = self::$cache_file; } //export the classes array using PHP engine @@ -77,13 +96,10 @@ class auto_loader { if ($result !== false) { return true; } + + //file failed to save - send error to syslog when debugging $error_array = error_get_last(); - //send to syslog when debugging - if (!empty($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') { - openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); - syslog(LOG_WARNING, "[php][auto_loader] " . $error_array['message']); - closelog(); - } + self::log(LOG_WARNING, $error_array['message'] ?? ''); return false; } @@ -99,21 +115,21 @@ class auto_loader { //use a standard file if (empty($file)) { - $file = sys_get_temp_dir() . '/'. self::FILE; + $file = self::$cache_file; } + //use PHP engine to parse it if (file_exists($file)) { $this->classes = include $file; } - //assign to an array - if (!empty($this->classes)) { - //cache edge case of first time using apcu cache - if ($this->apcu_enabled) { - apcu_store(self::CACHE_KEY, $this->classes); - } - return true; + + //catch edge case of first time using apcu cache + if ($this->apcu_enabled) { + apcu_store(self::CACHE_KEY, $this->classes); } - return false; + + //return true when we have classes and false if the array is still empty + return !empty($this->classes); } public function reload_classes($project_path = '') { @@ -122,26 +138,87 @@ class auto_loader { $project_path = dirname(__DIR__, 2); } - //build the array of all classes - $search_path = []; - $search_path = array_merge($search_path, glob($project_path . '/resources/classes/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/resources/interfaces/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/resources/traits/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/*/*/resources/classes/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/*/*/resources/interfaces/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/*/*/resources/traits/*.php')); + //build the array of all locations for classes in specific order + $search_path = [ + $project_path . '/resources/interfaces/*.php', + $project_path . '/resources/traits/*.php', + $project_path . '/resources/classes/*.php', + $project_path . '/*/*/resources/interfaces/*.php', + $project_path . '/*/*/resources/traits/*.php', + $project_path . '/*/*/resources/classes/*.php', + $project_path . '/core/authentication/resources/classes/plugins/*.php', + ]; + + //get all php files for each path + $files = []; + foreach ($search_path as $path) { + $files = array_merge($files, glob($path)); + } //reset the current array $this->classes = []; - //store the class name (key) and the path (value) - foreach ($search_path as $path) { - $this->classes[basename($path, '.php')] = $path; - } + //store PHP language declared classes, interfaces, and traits + $current_classes = get_declared_classes(); + $current_interfaces = get_declared_interfaces(); + $current_traits = get_declared_traits(); + //store the class name (key) and the path (value) + foreach ($files as $file) { + + //include the new class + try { + include_once $file; + } catch (Exception $e) { + //report the error + self::log(LOG_ERR, "Exception while trying to include file '$file': " . $e->getMessage()); + continue; + } + + //get the new classes + $new_classes = get_declared_classes(); + $new_interfaces = get_declared_interfaces(); + $new_traits = get_declared_traits(); + + //check for a new class + $classes = array_diff($new_classes, $current_classes); + if (!empty($classes)) { + foreach ($classes as $class) { + $this->classes[$class] = $file; + } + //overwrite previous array with new values + $current_classes = $new_classes; + } + + //check for a new interface + $interfaces = array_diff($new_interfaces, $current_interfaces); + if (!empty($interfaces)) { + foreach ($interfaces as $interface) { + $this->classes[$interface] = $file; + } + //overwrite previous array with new values + $current_interfaces = $new_interfaces; + } + + //check for a new trait + $traits = array_diff($new_traits, $current_traits); + if (!empty($traits)) { + foreach ($traits as $trait) { + $this->classes[$trait] = $file; + } + //overwrite previous array with new values + $current_traits = $new_traits; + } + } } - private function loader($class_name) : bool { + /** + * The loader is set to private because only the PHP engine should be calling this method + * @param string $class_name The class name that needs to be loaded + * @return bool True if the class is loaded or false when the class is not found + * @access private + */ + private function loader($class_name): bool { //sanitize the class name $class_name = preg_replace('[^a-zA-Z0-9_]', '', $class_name); @@ -161,32 +238,29 @@ class auto_loader { } //cache miss - if (!empty($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') { - openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); - syslog(LOG_WARNING, "[php][auto_loader] class not found in cache: ".$class_name); - closelog(); - } + self::log(LOG_WARNING, "class '$class_name' not found in cache"); //set project path using magic dir constant $project_path = dirname(__DIR__, 2); //build the search path array - $search_path[] = glob($project_path . "/resources/classes/".$class_name.".php"); - $search_path[] = glob($project_path . "/resources/interfaces/".$class_name.".php"); - $search_path[] = glob($project_path . "/resources/traits/".$class_name.".php"); - $search_path[] = glob($project_path . "/*/*/resources/classes/".$class_name.".php"); - $search_path[] = glob($project_path . "/*/*/resources/interfaces/".$class_name.".php"); - $search_path[] = glob($project_path . "/*/*/resources/traits/".$class_name.".php"); + $search_path[] = glob($project_path . "/resources/interfaces/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/resources/traits/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/resources/classes/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/*/*/resources/interfaces/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/*/*/resources/traits/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/*/*/resources/classes/" . $class_name . ".php"); - //find the path - $path = self::autoload_search($search_path); - if (!empty($path)) { + //collapse all entries to only the matched entry + $matches = array_filter($search_path); + if (!empty($matches)) { + $path = array_pop($matches)[0]; - //include the class or interface - include $path; + //include the class, interface, or trait + include_once $path; - //make sure to reload the cache after we found a new class - $this->reload_classes(); + //inject the class in to the array + $this->classes[$class_name] = $path; //update the cache with new classes $this->update_cache(); @@ -196,35 +270,54 @@ class auto_loader { } //send to syslog when debugging - if (!empty($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') { - openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); - syslog(LOG_WARNING, "[php][auto_loader] class not found name: ".$class_name); - closelog(); - } + self::log(LOG_ERR, "class '$class_name' not found name"); //return boolean return false; } - public static function autoload_search($array) : string { - foreach($array as $path) { - if (is_array($path) && count($path) != 0) { - foreach($path as $sub_path) { - if (!empty($sub_path) && file_exists($sub_path)) { - return $sub_path; - } - } - } - elseif (!empty($path) && file_exists($path)) { - return $path; - } + /** + * Returns a list of classes loaded by the auto_loader. If no classes have been loaded an empty array is returned. + * @return array List of classes loaded by the auto_loader or empty array + */ + public function get_class_list(): array { + if (!empty($this->classes)) { + return $this->classes; } - return ''; + return []; } - public static function clear_cache() { + public static function clear_cache(string $file = '') { + + //check for apcu cache if (function_exists('apcu_enabled') && apcu_enabled()) { apcu_delete(self::CACHE_KEY); } + + //set default file + if (empty(self::$cache_file)) { + self::$cache_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . self::FILE; + } + + //set file to clear + if (empty($file)) { + $file = self::$cache_file; + } + + //remove the file when it exists + if (file_exists($file)) { + @unlink($file); + $error_array = error_get_last(); + //send to syslog when debugging with either environment variable or debug in the url + self::log(LOG_WARNING, $error_array['message'] ?? ''); + } + } + + private static function log(int $level, string $message): void { + if (filter_var($_REQUEST['debug'] ?? false, FILTER_VALIDATE_BOOL) || filter_var(getenv('DEBUG') ?? false, FILTER_VALIDATE_BOOL)) { + openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); + syslog($level, "[auto_loader] " . $message); + closelog(); + } } } diff --git a/resources/classes/button.php b/resources/classes/button.php index c82b34551b..d7786d7418 100644 --- a/resources/classes/button.php +++ b/resources/classes/button.php @@ -25,7 +25,6 @@ Mark J Crane */ -if (!class_exists('button')) { class button { public static $collapse = 'hide-md-dn'; @@ -127,7 +126,6 @@ if (!class_exists('button')) { $button = $anchor.$button.""; } return $button; - unset($button); } private static function quote($value) { @@ -135,7 +133,6 @@ if (!class_exists('button')) { } } -} /* @@ -236,5 +233,3 @@ if (!class_exists('button')) { */ - -?> \ No newline at end of file diff --git a/resources/classes/database.php b/resources/classes/database.php index f745b8a489..692dcb56cd 100644 --- a/resources/classes/database.php +++ b/resources/classes/database.php @@ -3326,7 +3326,6 @@ /* //example usage //find - require_once "resources/classes/database.php"; $database = new database; $database->domain_uuid = $_SESSION["domain_uuid"]; $database->type = $db_type; @@ -3343,7 +3342,6 @@ $database->find(); print_r($database->result); //insert - require_once "resources/classes/database.php"; $database = new database; $database->domain_uuid = $_SESSION["domain_uuid"]; $database->table = "v_ivr_menus"; diff --git a/resources/classes/domains.php b/resources/classes/domains.php index 2875616cdd..edb1932425 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -28,11 +28,7 @@ /** * domains class * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('domains')) { class domains { /** @@ -786,6 +782,3 @@ if (!class_exists('domains')) { } } -} - -?> diff --git a/resources/classes/email.php b/resources/classes/email.php index 81cf026dd3..9b046505d6 100644 --- a/resources/classes/email.php +++ b/resources/classes/email.php @@ -27,9 +27,7 @@ /** * email class * - * @method boolean send */ -if (!class_exists('email')) { class email { /** @@ -445,7 +443,7 @@ if (!class_exists('email')) { $smtp['password'] = $this->settings->get('email','smtp_password'); $smtp['from'] = $this->settings->get('voicemail','smtp_from') ?? $this->settings->get('email','smtp_from'); $smtp['from_name'] = $this->settings->get('voicemail','smtp_from_name') ?? $this->settings->get('email','smtp_from_name'); - $smtp['validate_certificate'] = $this->settings->get('email','smtp_validate_certificate'); + $smtp['validate_certificate'] = $this->settings->get('email','smtp_validate_certificate', true); $smtp['crypto_method'] = $this->settings->get('email','smtp_crypto_method') ?? null; //override the domain-specific smtp server settings, if any @@ -506,7 +504,7 @@ if (!class_exists('email')) { $mail->SMTPSecure = $smtp['secure']; } - if ($smtp_secure && isset($smtp['validate_certificate']) && $smtp['validate_certificate'] == "false") { + if ($smtp_secure && isset($smtp['validate_certificate']) && !$smtp['validate_certificate']) { //bypass certificate check e.g. for self-signed certificates $smtp_options['ssl']['verify_peer'] = false; $smtp_options['ssl']['verify_peer_name'] = false; @@ -625,7 +623,7 @@ if (!class_exists('email')) { } } -} + /* $email = new email; @@ -638,5 +636,3 @@ $email->attachments = $email_attachments; $response = $mail->error; $sent = $email->send(); */ - -?> diff --git a/resources/classes/groups.php b/resources/classes/groups.php index 2bf85c4e63..138671f38b 100644 --- a/resources/classes/groups.php +++ b/resources/classes/groups.php @@ -27,11 +27,7 @@ /** * groups class provides methods for add, delete groups, and add default groups * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('groups')) { class groups { /** @@ -534,6 +530,3 @@ if (!class_exists('groups')) { $_SESSION["user"]["group_level"] = $this->group_level; } } -} - -?> \ No newline at end of file diff --git a/resources/classes/menu.php b/resources/classes/menu.php index 86c8b8983c..04489265a9 100644 --- a/resources/classes/menu.php +++ b/resources/classes/menu.php @@ -27,7 +27,6 @@ /** * menu class */ -if (!class_exists('menu')) { class menu { /** @@ -427,6 +426,7 @@ if (!class_exists('menu')) { $menu_item_parent_uuid = $uuid_array[$menu['parent_uuid']] ?? null; $menu_item_category = $menu['category']; $menu_item_icon = $menu['icon'] ?? null; + $menu_item_icon_color = $menu['icon_color'] ?? null; $menu_item_path = $menu['path']; $menu_item_order = $menu['order'] ?? null; $menu_item_description = $menu['desc'] ?? null; @@ -471,6 +471,7 @@ if (!class_exists('menu')) { $array['menu_items'][$x]['menu_item_link'] = $menu_item_path; $array['menu_items'][$x]['menu_item_category'] = $menu_item_category; $array['menu_items'][$x]['menu_item_icon'] = $menu_item_icon; + $array['menu_items'][$x]['menu_item_icon_color'] = $menu_item_icon_color; if (!empty($menu_item_order)) { $array['menu_items'][$x]['menu_item_order'] = $menu_item_order; } @@ -745,7 +746,7 @@ if (!class_exists('menu')) { //get the menu from the database $sql = "select i.menu_item_link, l.menu_item_title as menu_language_title, "; $sql .= "i.menu_item_title, i.menu_item_protected, i.menu_item_category, "; - $sql .= "i.menu_item_icon, i.menu_item_uuid, i.menu_item_parent_uuid "; + $sql .= "i.menu_item_icon, i.menu_item_icon_color, i.menu_item_uuid, i.menu_item_parent_uuid "; $sql .= "from v_menu_items as i, v_menu_languages as l "; $sql .= "where i.menu_item_uuid = l.menu_item_uuid "; $sql .= "and l.menu_language = :menu_language "; @@ -814,7 +815,7 @@ if (!class_exists('menu')) { } //get the child menu from the database - $sql = "select i.menu_item_link, l.menu_item_title as menu_language_title, i.menu_item_title, i.menu_item_protected, i.menu_item_category, i.menu_item_icon, i.menu_item_uuid, i.menu_item_parent_uuid "; + $sql = "select i.menu_item_link, l.menu_item_title as menu_language_title, i.menu_item_title, i.menu_item_protected, i.menu_item_category, i.menu_item_icon, i.menu_item_icon_color, i.menu_item_uuid, i.menu_item_parent_uuid "; $sql .= "from v_menu_items as i, v_menu_languages as l "; $sql .= "where i.menu_item_uuid = l.menu_item_uuid "; $sql .= "and l.menu_language = :menu_language "; @@ -854,6 +855,7 @@ if (!class_exists('menu')) { $menu_item_link = $row['menu_item_link']; $menu_item_category = $row['menu_item_category']; $menu_item_icon = $row['menu_item_icon']; + $menu_item_icon_color = $row['menu_item_icon_color']; $menu_item_uuid = $row['menu_item_uuid']; $menu_item_parent_uuid = $row['menu_item_parent_uuid']; @@ -1010,7 +1012,7 @@ if (!class_exists('menu')) { $mod_a_3 = ($menu_parent['menu_item_category'] == 'external') ? "target='_blank' " : null; if ($this->settings->get('theme', 'menu_main_icons', true) === true) { if (!empty($menu_parent['menu_item_icon']) && substr($menu_parent['menu_item_icon'], 0, 3) == 'fa-') { // font awesome icon - $menu_main_icon = ""; + $menu_main_icon = ""; } else { $menu_main_icon = null; @@ -1043,7 +1045,7 @@ if (!class_exists('menu')) { $menu_sub_icon = null; if ($this->settings->get('theme', 'menu_sub_icons', true) !== false) { if (!empty($menu_sub['menu_item_icon']) && substr($menu_sub['menu_item_icon'], 0, 3) == 'fa-') { // font awesome icon - $menu_sub_icon = ""; + $menu_sub_icon = ""; } else { $menu_sub_icon = null; @@ -1211,7 +1213,7 @@ if (!class_exists('menu')) { $html .= " \n"; } if (!empty($menu_item_main['menu_item_icon']) && substr($menu_item_main['menu_item_icon'], 0, 3) == 'fa-') { // font awesome icon - $html .= ""; + $html .= ""; } $html .= "".$menu_item_main['menu_language_title'].""; $html .= "\n"; @@ -1222,7 +1224,7 @@ if (!class_exists('menu')) { $menu_sub_icon = null; if ($this->settings->get('theme', 'menu_sub_icons', true) !== false) { if (!empty($menu_item_sub['menu_item_icon']) && substr($menu_item_sub['menu_item_icon'], 0, 3) == 'fa-') { // font awesome icon - $menu_sub_icon = ""; + $menu_sub_icon = ""; } else { $menu_sub_icon = null; @@ -1336,4 +1338,3 @@ if (!class_exists('menu')) { } } -} diff --git a/resources/classes/message.php b/resources/classes/message.php index 936f4edd46..61e017753b 100644 --- a/resources/classes/message.php +++ b/resources/classes/message.php @@ -25,7 +25,6 @@ Matthew Vale */ -if (!class_exists('message')) { class message { static function add($message, $mood = null, $delay = null) { @@ -71,6 +70,3 @@ if (!class_exists('message')) { return $html; } } -} - -?> diff --git a/resources/classes/modal.php b/resources/classes/modal.php index e5d61a9f68..0629c4fa69 100644 --- a/resources/classes/modal.php +++ b/resources/classes/modal.php @@ -25,7 +25,6 @@ Mark J Crane */ -if (!class_exists('modal')) { class modal { static function create($array) { @@ -65,11 +64,7 @@ if (!class_exists('modal')) { $modal .= "
"; return $modal; - unset($modal); } } -} - -?> \ No newline at end of file diff --git a/resources/classes/schema.php b/resources/classes/schema.php index 3ec6c2c57f..1bd01703ff 100644 --- a/resources/classes/schema.php +++ b/resources/classes/schema.php @@ -26,8 +26,6 @@ */ //define the schema class -if (!class_exists('schema')) { - class schema { //define variables @@ -473,7 +471,6 @@ if (!class_exists('schema')) { } //get the db variables - //require_once "resources/classes/config.php"; //$config = new config; //$config_exists = $config->exists(); //$config_path = $config->find(); @@ -908,13 +905,10 @@ if (!class_exists('schema')) { } //end function } -} //example use -//require_once "resources/classes/schema.php"; //$obj = new schema; //$obj->db_type = $db_type; //$obj->schema(); //$result_array = $schema->obj['sql']; //print_r($result_array); -?> diff --git a/resources/classes/settings.php b/resources/classes/settings.php index 3a9a21c452..f0105c68a9 100644 --- a/resources/classes/settings.php +++ b/resources/classes/settings.php @@ -160,14 +160,36 @@ class settings { } } + /** + * Returns the domain_uuid in this object used to load the settings + * @return string UUID of the domain used to load the object or an empty string + */ + public function get_domain_uuid(): string { + if (!empty($this->domain_uuid)) { + return $this->domain_uuid; + } + return ""; + } + + /** + * Returns the user_uuid in this object used to load the settings + * @return string UUID of the user used to load the object or an empty string + */ + public function get_user_uuid(): string { + if (!empty($this->user_uuid)) { + return $this->user_uuid; + } + return ""; + } + /** * set the default, domain, user, device or device profile settings * @param string $table_prefix prefix for the table. * @param string $uuid uuid of the setting if available. If set to an empty string then a new uuid will be created. * @param string $category Category of the setting. * @param string $subcategory Subcategory of the setting. - * @param string $type Type of the setting (array, numeric, text, etc) * @param string $value (optional) Value to set. Default is empty string. + * @param string $type Type of the setting (array, numeric, text, etc) * @param bool $enabled (optional) True or False. Default is True. * @param string $description (optional) Description. Default is empty string. */ @@ -248,17 +270,7 @@ class settings { $subcategory = $row['default_setting_subcategory']; if (isset($row['default_setting_value']) && $row['default_setting_value'] !== '') { if ($name == "boolean") { - if (gettype($row['default_setting_value']) === 'string') { - if ($row['default_setting_value'] === 'true') { - $this->settings[$category][$subcategory] = true; - } - else { - $this->settings[$category][$subcategory] = false; - } - } - elseif (gettype($row['default_setting_value']) === 'boolean') { - $this->settings[$category][$subcategory] = $row['default_setting_value']; - } + $this->settings[$category][$subcategory] = filter_var($row['default_setting_value'], FILTER_VALIDATE_BOOLEAN); } elseif ($name == "array") { if (!isset($this->settings[$category][$subcategory]) || !is_array($this->settings[$category][$subcategory])) { @@ -318,17 +330,7 @@ class settings { $subcategory = $row['domain_setting_subcategory']; if (isset($row['domain_setting_value']) && $row['domain_setting_value'] !== '') { if ($name == "boolean") { - if (gettype($row['domain_setting_value']) === 'string') { - if ($row['domain_setting_value'] === 'true') { - $this->settings[$category][$subcategory] = true; - } - else { - $this->settings[$category][$subcategory] = false; - } - } - elseif (gettype($row['domain_setting_value']) === 'boolean') { - $this->settings[$category][$subcategory] = $row['domain_setting_value']; - } + $this->settings[$category][$subcategory] = filter_var($row['domain_setting_value'], FILTER_VALIDATE_BOOLEAN); } if ($name == "array") { if (!isset($this->settings[$category][$subcategory]) || !is_array($this->settings[$category][$subcategory])) { @@ -377,17 +379,7 @@ class settings { $subcategory = $row['user_setting_subcategory']; if (isset($row['user_setting_value']) && $row['user_setting_value'] !== '') { if ($name == "boolean") { - if (gettype($row['user_setting_value']) === 'string') { - if ($row['user_setting_value'] === 'true') { - $this->settings[$category][$subcategory] = true; - } - else { - $this->settings[$category][$subcategory] = false; - } - } - elseif (gettype($row['user_setting_value']) === 'boolean') { - $this->settings[$category][$subcategory] = $row['user_setting_value']; - } + $this->settings[$category][$subcategory] = filter_var($row['user_setting_value'], FILTER_VALIDATE_BOOLEAN); } elseif ($name == "array") { $this->settings[$category][$subcategory][] = $row['user_setting_value']; diff --git a/resources/classes/switch_settings.php b/resources/classes/switch_settings.php index 3457dba41e..e1822954cc 100644 --- a/resources/classes/switch_settings.php +++ b/resources/classes/switch_settings.php @@ -5,7 +5,6 @@ * * @method settings will add missing switch directories to default settings */ -if (!class_exists('switch_settings')) { class switch_settings { public $event_socket_ip_address; @@ -276,6 +275,3 @@ if (!class_exists('switch_settings')) { unset($array); } } -} - -?> diff --git a/resources/classes/template.php b/resources/classes/template.php index 0c932163e3..3b3d2c57f4 100644 --- a/resources/classes/template.php +++ b/resources/classes/template.php @@ -25,7 +25,6 @@ */ //define the template class - if (!class_exists('template')) { class template { public $engine; @@ -90,6 +89,3 @@ } } } - } - -?> \ No newline at end of file diff --git a/resources/classes/tones.php b/resources/classes/tones.php index 397348e660..90a8f9a08d 100644 --- a/resources/classes/tones.php +++ b/resources/classes/tones.php @@ -25,7 +25,6 @@ Matthew Vale */ -if (!class_exists('tones')) { class tones { //define variables @@ -33,7 +32,7 @@ if (!class_exists('tones')) { private $music_list; private $recordings_list; private $default_tone_label; - + //class constructor public function __construct() { //add multi-lingual support @@ -61,11 +60,8 @@ if (!class_exists('tones')) { $this->tones = $tone_list ?? ''; unset($sql, $tones, $tone, $tone_list); } - + public function tones_list() { return $this->tones; } } -} - -?> diff --git a/resources/classes/xml.php b/resources/classes/xml.php index 582595f15a..ac7d883297 100644 --- a/resources/classes/xml.php +++ b/resources/classes/xml.php @@ -1,6 +1,5 @@ diff --git a/resources/fontawesome/fa_icons.php b/resources/fontawesome/fa_icons.php index 9b2e128fed..558cea25d0 100644 --- a/resources/fontawesome/fa_icons.php +++ b/resources/fontawesome/fa_icons.php @@ -113,6 +113,6 @@ if ( !empty($font_awesome_icons) && is_array($font_awesome_icons) ) { foreach ($font_awesome_icons as $icon) { - echo "\n"; + echo "\n"; } } \ No newline at end of file diff --git a/resources/footer.php b/resources/footer.php index 8a03f7edcd..f263b5d5b5 100644 --- a/resources/footer.php +++ b/resources/footer.php @@ -45,7 +45,7 @@ ob_end_clean(); //clean the buffer //clear the template - //if (isset($_SESSION['theme']['cache']['boolean']) && $_SESSION['theme']['cache']['boolean'] == "false") { + //if (!filter_var($_SESSION['theme']['cache']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) { // $_SESSION["template_content"] = ''; //} @@ -285,7 +285,7 @@ if ( $authenticated && file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH.'/app/session_timer/session_timer.php') && - $_SESSION['security']['session_timer_enabled']['boolean'] == 'true' + filter_var($_SESSION['security']['session_timer_enabled']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ) { include_once PROJECT_PATH.'app/session_timer/session_timer.php'; $view->assign('session_timer', $session_timer); diff --git a/resources/functions.php b/resources/functions.php index cc791db9df..43b4219938 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -2118,7 +2118,7 @@ //define email button (src: https://buttons.cm) if (!function_exists('email_button')) { - function email_button($text = 'Click Here!', $link = URL, $bg_color = '#dddddd', $fg_color = '#000000', $radius = '') { + function email_button($text = 'Click Here!', $link = 'URL', $bg_color = '#dddddd', $fg_color = '#000000', $radius = '') { // default button radius $radius = !empty($radius) ? $radius : '3px'; diff --git a/resources/php.php b/resources/php.php index 705fbd29f8..ce524a9214 100644 --- a/resources/php.php +++ b/resources/php.php @@ -32,7 +32,7 @@ } } //regenerate sessions to avoid session id attacks such as session fixation - if (array_key_exists('security',$_SESSION) && $_SESSION['security']['session_rotate']['boolean'] == "true") { + if (array_key_exists('security',$_SESSION) && filter_var($_SESSION['security']['session_rotate']['boolean'] ?? true, FILTER_VALIDATE_BOOL)) { $_SESSION['session']['last_activity'] = time(); if (!isset($_SESSION['session']['created'])) { $_SESSION['session']['created'] = time(); diff --git a/resources/require.php b/resources/require.php index 23495d6c71..994b0a2c30 100644 --- a/resources/require.php +++ b/resources/require.php @@ -24,66 +24,35 @@ Mark J Crane */ -//find the config.conf file - if (file_exists('/usr/local/etc/fusionpbx/config.conf')) { - $config_file = '/usr/local/etc/fusionpbx/config.conf'; - } - elseif (file_exists('/etc/fusionpbx/config.conf')) { - $config_file = '/etc/fusionpbx/config.conf'; - } - elseif (file_exists(getenv('SystemDrive') . DIRECTORY_SEPARATOR . 'ProgramData' . DIRECTORY_SEPARATOR . 'fusionpbx' . DIRECTORY_SEPARATOR . 'config.conf')) { - $config_file = getenv('SystemDrive') . DIRECTORY_SEPARATOR . 'ProgramData' . DIRECTORY_SEPARATOR . 'fusionpbx' . DIRECTORY_SEPARATOR . 'config.conf'; - } - elseif (file_exists(__DIR__ . '/config.php')) { - //set a custom config_file variable after the config.php has been validated - $file_content = trim(file_get_contents(__DIR__ . '/config.php')); - $pattern = '/^<\?php\s+\$config_file\s+=\s+[\'"](.+?)[\'"];\s+\?>$/'; - if (preg_match($pattern, $file_content, $matches) && file_exists($matches[1])) { - $config_file = $matches[1]; - } +//class auto loader + if (!class_exists('auto_loader')) { + require_once __DIR__ . "/classes/auto_loader.php"; + $autoload = new auto_loader(); } +//load config file + global $config; + $config = config::load(); + //config.conf file not found re-direct the request to the install - if (empty($config_file)) { + if ($config->is_empty()) { header("Location: /core/install/install.php"); exit; } -//parse the config.conf file - $conf = parse_ini_file($config_file); - -//set the include path - set_include_path($conf['document.root']); - -//set document root - $_SERVER["DOCUMENT_ROOT"] = substr($conf['document.root'], -1) === '/' ? substr($conf['document.root'], 0, -1) : $conf['document.root']; - -//set project path - if (isset($conf['project.path']) && !defined('PROJECT_PATH')) { - if (substr($conf['project.path'], 0, 1) === '/') { - define("PROJECT_PATH", $conf['project.path']); - } else { - if (!empty($conf['project.path'])) { - define("PROJECT_PATH", '/' . $conf['project.path']); - } else { - define("PROJECT_PATH", ''); - } - } - } - $_SERVER["PROJECT_PATH"] = PROJECT_PATH; - -//set project root using project path - if (!defined('PROJECT_ROOT')) { define("PROJECT_ROOT", $conf['document.root'] . PROJECT_PATH); } - $_SERVER["PROJECT_ROOT"] = PROJECT_ROOT; +//compatibility settings - planned to deprecate + global $conf, $db_type, $db_host, $db_port, $db_name, $db_username, $db_password; + $conf = $config->configuration(); + $db_type = $config->get('database.0.type'); + $db_host = $config->get('database.0.host'); + $db_port = $config->get('database.0.port'); + $db_name = $config->get('database.0.name'); + $db_username = $config->get('database.0.username'); + $db_password = $config->get('database.0.password'); //set the error reporting ini_set('display_errors', '1'); - if (isset($conf['error.reporting'])) { - $error_reporting_scope = $conf['error.reporting']; - } - else { - $error_reporting_scope = 'user'; - } + $error_reporting_scope = $config->get('error.reporting', 'user'); switch ($error_reporting_scope) { case 'user': error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED); @@ -106,37 +75,38 @@ //$db_username = $settings['database']['username']; //$db_password = $settings['database']['password']; -//get the database connection settings - $db_type = $conf['database.0.type']; - $db_host = $conf['database.0.host']; - $db_port = $conf['database.0.port']; - $db_name = $conf['database.0.name']; - $db_username = $conf['database.0.username']; - $db_password = $conf['database.0.password']; - //debug info //echo "Include Path: ".get_include_path()."\n"; //echo "Document Root: ".$_SERVER["DOCUMENT_ROOT"]."\n"; //echo "Project Root: ".$_SERVER["PROJECT_ROOT"]."\n"; -//class auto loader - if (!class_exists('auto_loader')) { - require_once "resources/classes/auto_loader.php"; - $autoload = new auto_loader(); + +//include global functions + require_once __DIR__ . "/functions.php"; + +//connect to the database + global $database; + $database = database::new(['config' => $config]); + +//if not using the command line required files + global $no_session; + if (!defined('STDIN') && empty($no_session)) { + require_once __DIR__ . '/php.php'; } -//additional includes - if (!defined('STDIN')) { - require_once "resources/php.php"; +//load settings + global $settings; + $settings = new settings(['database' => $database, 'domain_uuid' => $_SESSION['domain_uuid'] ?? '', 'user_uuid' => $_SESSION['domain_uuid'] ?? '']); + +//check if the cidr range is valid + global $no_cidr; + if (!defined('STDIN') && empty($no_cidr)) { + require_once __DIR__ . '/cidr.php'; } - require_once "resources/functions.php"; - if (is_array($conf) && count($conf) > 0) { - if (!defined('STDIN')) { - require_once "resources/cidr.php"; - } - if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/resources/switch.php")) { - require_once "resources/switch.php"; - } + +//include switch functions when available + if (file_exists(__DIR__ . '/switch.php')) { + require_once __DIR__ . '/switch.php'; } //change language on the fly - for translate tool (if available) @@ -147,9 +117,6 @@ //change the domain if (!empty($_GET["domain_uuid"]) && is_uuid($_GET["domain_uuid"]) && $_GET["domain_change"] == "true" && permission_exists('domain_select')) { - //connect to the database - $database = database::new(); - //include domains if (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/app_config.php") && !permission_exists('domain_all')) { include_once "app/domains/domains.php"; @@ -183,5 +150,3 @@ $domain = new domains(); $domain->set(); } - -?> diff --git a/resources/switch.php b/resources/switch.php index 906942b404..fa72e0ba13 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -948,7 +948,6 @@ if (!function_exists('save_switch_xml')) { function save_switch_xml() { if (is_readable($_SESSION['switch']['extensions']['dir'])) { if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/resources/classes/extension.php")) { - require_once $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."app/extensions/resources/classes/extension.php"; $extension = new extension; $extension->xml(); } @@ -958,7 +957,6 @@ if (!function_exists('save_switch_xml')) { save_setting_xml(); } if (file_exists($_SERVER["PROJECT_ROOT"]."/app/modules/app_config.php")) { - require_once $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/modules/resources/classes/modules.php"; $module = new modules; $module->xml(); //$msg = $module->msg; diff --git a/resources/templates/provision/algo/8180/algom{$mac}.conf b/resources/templates/provision/algo/8180/algom{$mac}.conf index bf143de62e..635787e1cb 100644 --- a/resources/templates/provision/algo/8180/algom{$mac}.conf +++ b/resources/templates/provision/algo/8180/algom{$mac}.conf @@ -1,7 +1,11 @@ admin.devname = sipalerter admin.keyui = 1 admin.lang = en +{if isset($admin_password) } +admin.pwd = {$admin_password} +{else} admin.pwd = algo +{/if} admin.timezone = America/New_York admin.voice = en admin.watchdog = 0 diff --git a/resources/templates/provision/grandstream/grp2612/{$mac}.xml b/resources/templates/provision/grandstream/grp2612/{$mac}.xml index d6d6634ac2..ba1ea01ede 100644 --- a/resources/templates/provision/grandstream/grp2612/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2612/{$mac}.xml @@ -4565,7 +4565,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/grp2612w/{$mac}.xml b/resources/templates/provision/grandstream/grp2612w/{$mac}.xml index 423013911b..7a6765af35 100644 --- a/resources/templates/provision/grandstream/grp2612w/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2612w/{$mac}.xml @@ -4560,7 +4560,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/grp2613/{$mac}.xml b/resources/templates/provision/grandstream/grp2613/{$mac}.xml index 8fe7f212a0..ab148d963c 100644 --- a/resources/templates/provision/grandstream/grp2613/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2613/{$mac}.xml @@ -4566,7 +4566,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/grp2614/{$mac}.xml b/resources/templates/provision/grandstream/grp2614/{$mac}.xml index d6d6634ac2..ba1ea01ede 100644 --- a/resources/templates/provision/grandstream/grp2614/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2614/{$mac}.xml @@ -4565,7 +4565,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/grp2615/{$mac}.xml b/resources/templates/provision/grandstream/grp2615/{$mac}.xml index 01b07777d0..5311dec42e 100644 --- a/resources/templates/provision/grandstream/grp2615/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2615/{$mac}.xml @@ -4558,7 +4558,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/grp2616/{$mac}.xml b/resources/templates/provision/grandstream/grp2616/{$mac}.xml index d6d6634ac2..ba1ea01ede 100644 --- a/resources/templates/provision/grandstream/grp2616/{$mac}.xml +++ b/resources/templates/provision/grandstream/grp2616/{$mac}.xml @@ -4565,7 +4565,7 @@ - + {$row.device_key_value} {/foreach} diff --git a/resources/templates/provision/grandstream/gxp2130/{$mac}.xml b/resources/templates/provision/grandstream/gxp2130/{$mac}.xml index 9162c1b7e3..efb75a3402 100644 --- a/resources/templates/provision/grandstream/gxp2130/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2130/{$mac}.xml @@ -180,6 +180,7 @@ + {if $row.sip_transport == ''}1{/if} {if $row.sip_transport == 'udp'}0{/if} {if $row.sip_transport == 'tcp'}1{/if} @@ -913,6 +914,7 @@ {if $grandstream_lan_port_vlan == '0'}No{else}Yes{/if} + @@ -2136,7 +2138,11 @@ + {if isset($grandstream_transfer_mode_via_vpk)} + {$grandstream_transfer_mode_via_vpk} + {else} BlindTransfer + {/if} Yes diff --git a/resources/templates/provision/grandstream/gxp2135/{$mac}.xml b/resources/templates/provision/grandstream/gxp2135/{$mac}.xml index c17ee0a6e9..e0d1b4748f 100644 --- a/resources/templates/provision/grandstream/gxp2135/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2135/{$mac}.xml @@ -38,7 +38,11 @@ {$row.server_address}:{$row.sip_port} {/if} + {if isset($row.server_address_secondary)} {$row.server_address_secondary}:{$row.sip_port} + {else} + + {/if} {if $row.sip_transport != 'dns srv' && isset($row.outbound_proxy_primary)} @@ -176,6 +180,7 @@ + {if $row.sip_transport == ''}1{/if} {if $row.sip_transport == 'udp'}0{/if} {if $row.sip_transport == 'tcp'}1{/if} @@ -909,6 +914,7 @@ {if $grandstream_lan_port_vlan == '0'}No{else}Yes{/if} + @@ -2132,7 +2138,11 @@ + {if isset($grandstream_transfer_mode_via_vpk)} {$grandstream_transfer_mode_via_vpk} + {else} + BlindTransfer + {/if} Yes diff --git a/resources/templates/provision/grandstream/gxp2140/{$mac}.xml b/resources/templates/provision/grandstream/gxp2140/{$mac}.xml index bb5a7f2856..bfea8b4834 100644 --- a/resources/templates/provision/grandstream/gxp2140/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2140/{$mac}.xml @@ -38,7 +38,11 @@ {$row.server_address}:{$row.sip_port} {/if} + {if isset($row.server_address_secondary)} {$row.server_address_secondary}:{$row.sip_port} + {else} + + {/if} {if $row.sip_transport != 'dns srv' && isset($row.outbound_proxy_primary)} @@ -176,10 +180,11 @@ - {if $row.sip_transport == ''}TCP{/if} - {if $row.sip_transport == 'udp'}UDP{/if} - {if $row.sip_transport == 'tcp'}TCP{/if} - {if $row.sip_transport == 'tls'}Tls{/if} + + {if $row.sip_transport == ''}1{/if} + {if $row.sip_transport == 'udp'}0{/if} + {if $row.sip_transport == 'tcp'}1{/if} + {if $row.sip_transport == 'tls'}2{/if} @@ -2133,7 +2138,11 @@ + {if isset($grandstream_transfer_mode_via_vpk)} + {$grandstream_transfer_mode_via_vpk} + {else} BlindTransfer + {/if} Yes @@ -3318,4 +3327,4 @@ {/foreach} - \ No newline at end of file + diff --git a/resources/templates/provision/grandstream/gxp2160/{$mac}.xml b/resources/templates/provision/grandstream/gxp2160/{$mac}.xml index 5bfc894586..5241c940a7 100644 --- a/resources/templates/provision/grandstream/gxp2160/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2160/{$mac}.xml @@ -38,7 +38,11 @@ {$row.server_address}:{$row.sip_port} {/if} + {if isset($row.server_address_secondary)} {$row.server_address_secondary}:{$row.sip_port} + {else} + + {/if} {if $row.sip_transport != 'dns srv' && isset($row.outbound_proxy_primary)} @@ -176,10 +180,11 @@ - {if $row.sip_transport == ''}TCP{/if} - {if $row.sip_transport == 'udp'}UDP{/if} - {if $row.sip_transport == 'tcp'}TCP{/if} - {if $row.sip_transport == 'tls'}Tls{/if} + + {if $row.sip_transport == ''}1{/if} + {if $row.sip_transport == 'udp'}0{/if} + {if $row.sip_transport == 'tcp'}1{/if} + {if $row.sip_transport == 'tls'}2{/if} @@ -2133,7 +2138,11 @@ + {if isset($grandstream_transfer_mode_via_vpk)} + {$grandstream_transfer_mode_via_vpk} + {else} BlindTransfer + {/if} Yes @@ -3318,4 +3327,4 @@ {/foreach} - \ No newline at end of file + diff --git a/resources/templates/provision/grandstream/gxp2170/{$mac}.xml b/resources/templates/provision/grandstream/gxp2170/{$mac}.xml index 282c33c4d4..a7e742435a 100644 --- a/resources/templates/provision/grandstream/gxp2170/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp2170/{$mac}.xml @@ -2138,7 +2138,11 @@ + {if isset($grandstream_transfer_mode_via_vpk)} + {$grandstream_transfer_mode_via_vpk} + {else} BlindTransfer + {/if} Yes diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index a4a3525ddd..50e3f282ac 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -201,9 +201,8 @@ if (!function_exists('fax_split_dtmf')) { //includes files require_once dirname(__DIR__) . "/resources/require.php"; - include "resources/classes/event_socket.php"; - include "resources/phpmailer/class.phpmailer.php"; - include "resources/phpmailer/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded + include_once "resources/phpmailer/class.phpmailer.php"; + include_once "resources/phpmailer/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded //set php ini values ini_set('max_execution_time', 900); //15 minutes diff --git a/themes/default/app_config.php b/themes/default/app_config.php index f2bb1c2fd9..0b7d35af68 100644 --- a/themes/default/app_config.php +++ b/themes/default/app_config.php @@ -1824,6 +1824,14 @@ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the height of buttons."; $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "8aeb3718-4a00-4e27-810b-41cd169a82c5"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "theme"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "input_height"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "28px"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the height of text inputs."; + $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "7f8048b5-e4aa-4625-987f-5f9b80abe81b"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "theme"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "input_background_color"; diff --git a/themes/default/css.php b/themes/default/css.php index b2d13c6882..5a49932170 100644 --- a/themes/default/css.php +++ b/themes/default/css.php @@ -117,6 +117,7 @@ $body_width = $_SESSION['theme']['body_width']['text'] ?? '90%'; $heading_text_color = $_SESSION['theme']['heading_text_color']['text'] ?? '#952424'; $heading_text_size = $_SESSION['theme']['heading_text_size']['text'] ?? '15px'; $heading_text_font = $_SESSION['theme']['heading_text_font']['text'] ?? 'arial'; +$input_height = $_SESSION['theme']['input_height']['text'] ?? '28px'; $input_text_font = $_SESSION['theme']['input_text_font']['text'] ?? 'Arial'; $input_text_size = $_SESSION['theme']['input_text_size']['text'] ?? '12px'; $input_text_color = $_SESSION['theme']['input_text_color']['text'] ?? '#000'; @@ -146,7 +147,7 @@ $input_shadow_outer_color_focus = isset($_SESSION['theme']['input_shadow_outer_c $input_toggle_style = $_SESSION['theme']['input_toggle_style']['text'] ?? 'switch_round'; $input_toggle_switch_background_color_true = $_SESSION['theme']['input_toggle_switch_background_color_true']['text'] ?? '#2e82d0'; $input_toggle_switch_background_color_false = $_SESSION['theme']['input_toggle_switch_background_color_false']['text'] ?? $input_border_color; -$input_toggle_switch_handle_symbol = $_SESSION['theme']['input_toggle_switch_handle_symbol']['boolean'] ?? 'false'; +$input_toggle_switch_handle_symbol = filter_var($_SESSION['theme']['input_toggle_switch_handle_symbol']['boolean'] ?? false, FILTER_VALIDATE_BOOL); $input_toggle_switch_handle_color = $_SESSION['theme']['input_toggle_switch_handle_color']['text'] ?? '#ffffff'; $login_body_top = $_SESSION['theme']['login_body_top']['text'] ?? '50%'; $login_body_left = $_SESSION['theme']['login_body_left']['text'] ?? '50%'; @@ -317,7 +318,7 @@ $modal_message_color = $_SESSION['theme']['modal_message_color']['text'] ?? '#44 $modal_message_alignment = $_SESSION['theme']['modal_message_alignment']['text'] ?? 'left'; $modal_message_margin = $_SESSION['theme']['modal_message_margin']['text'] ?? '0 0 20px 0'; $audio_player_indicator_color = $_SESSION['theme']['audio_player_indicator_color']['text'] ?? '#b90004'; -$audio_player_waveform_enabled = $_SESSION['theme']['audio_player_waveform_enabled']['boolean'] ?? 'false'; +$audio_player_waveform_enabled = filter_var($_SESSION['theme']['audio_player_waveform_enabled']['boolean'] ?? true, FILTER_VALIDATE_BOOL); $audio_player_waveform_height = $_SESSION['theme']['audio_player_waveform_height']['text'] ?? '70px'; $custom_css_code = $_SESSION['theme']['custom_css_code']['text'] ?? null; @@ -354,29 +355,29 @@ if (!empty($_SESSION['theme'])) { $background_images_enabled = false; if (!empty($_SESSION['username'])) { //logged in - use standard background images - if (!empty($_SESSION['theme']['background_image_enabled']) && $_SESSION['theme']['background_image_enabled']['boolean'] == 'true' && is_array($_SESSION['theme']['background_image'])) { + if (filter_var($_SESSION['theme']['background_image_enabled']['boolean'] ?? false, FILTER_VALIDATE_BOOL) && is_array($_SESSION['theme']['background_image'])) { $background_images_enabled = true; $background_images = $_SESSION['theme']['background_image']; } //logged in - use standard background colors - if (!empty($_SESSION['theme']['background_color_enabled']) && $_SESSION['theme']['background_color_enabled']['boolean'] == 'true' && !empty($_SESSION['theme']['background_color'][0]) && !empty($_SESSION['theme']['background_color'][1])) { + if (filter_var($_SESSION['theme']['background_color_enabled']['boolean'] ?? true, FILTER_VALIDATE_BOOL) && !empty($_SESSION['theme']['background_color'][0]) && !empty($_SESSION['theme']['background_color'][1])) { $background_colors[0] = $_SESSION['theme']['background_color'][0]; $background_colors[1] = $_SESSION['theme']['background_color'][1]; } - elseif (!empty($_SESSION['theme']['background_color_enabled']) && $_SESSION['theme']['background_color_enabled']['boolean'] == 'true' && !empty($_SESSION['theme']['background_color'][0])) { + elseif (filter_var($_SESSION['theme']['background_color_enabled']['boolean'] ?? true, FILTER_VALIDATE_BOOL) && !empty($_SESSION['theme']['background_color'][0])) { $background_colors[0] = $_SESSION['theme']['background_color'][0]; } } else { //not logged in - try using login background images - if (isset($_SESSION['theme']['login_background_image_enabled']['boolean']) && $_SESSION['theme']['login_background_image_enabled']['boolean'] == 'true' && is_array($_SESSION['theme']['login_background_image'])) { + if (filter_var($_SESSION['theme']['login_background_image_enabled']['boolean'] ?? false, FILTER_VALIDATE_BOOL) && is_array($_SESSION['theme']['login_background_image'])) { $background_images_enabled = true; $background_images = $_SESSION['theme']['login_background_image']; } //otherwise, use standard background images - if (!empty($_SESSION['theme']['background_image_enabled']['boolean']) && $_SESSION['theme']['background_image_enabled']['boolean'] == 'true' && is_array($_SESSION['theme']['background_image'])) { + if (filter_var($_SESSION['theme']['background_image_enabled']['boolean'] ?? true, FILTER_VALIDATE_BOOL) && is_array($_SESSION['theme']['background_image'])) { $background_images_enabled = true; $background_images = $_SESSION['theme']['background_image']; } @@ -389,11 +390,11 @@ else { elseif (!empty($_SESSION['theme']['login_background_color']) && !empty($_SESSION['theme']['login_background_color'][0])) { $background_colors[0] = $_SESSION['theme']['login_background_color'][0]; } - elseif (!empty($_SESSION['theme']['background_color_enabled']) && $_SESSION['theme']['background_color_enabled']['boolean'] == 'true' && !empty($_SESSION['theme']['background_color'][0]) && !empty($_SESSION['theme']['background_color'][1])) { + elseif (filter_var($_SESSION['theme']['background_color_enabled']['boolean'] ?? true, FILTER_VALIDATE_BOOL) && !empty($_SESSION['theme']['background_color'][0]) && !empty($_SESSION['theme']['background_color'][1])) { $background_colors[0] = $_SESSION['theme']['background_color'][0]; $background_colors[1] = $_SESSION['theme']['background_color'][1]; } - elseif (!empty($_SESSION['theme']['background_color_enabled']) && $_SESSION['theme']['background_color_enabled']['boolean'] == 'true' && !empty($_SESSION['theme']['background_color'][0])) { + elseif (filter_var($_SESSION['theme']['background_color_enabled']['boolean'] ?? true, FILTER_VALIDATE_BOOL) && !empty($_SESSION['theme']['background_color'][0])) { $background_colors[0] = $_SESSION['theme']['background_color'][0]; } } @@ -726,18 +727,28 @@ else { //default: white /* sub menu container (multiple columns) */ @media(min-width: 576px) { ul.navbar-nav > li.nav-item > ul.dropdown-menu.multi-column { - width: 330px; + width: max-content; } + ul.navbar-nav > li.nav-item > ul.dropdown-menu.multi-column:hover { + display: flex; + } + } + + ul.navbar-nav > li.nav-item > ul.dropdown-menu.multi-column > div.row > div > ul.multi-column-dropdown > li.nav-item { + width: 100%; + margin-right: calc( * 2); } /* sub menu item */ ul.navbar-nav > li.nav-item > ul.dropdown-menu > li.nav-item > a.nav-link, ul.navbar-nav > li.nav-item > ul.dropdown-menu.multi-column > div.row > div > ul.multi-column-dropdown > li.nav-item > a.nav-link { + width: 100%; font-family: ; color: ; font-size: ; margin: 0; padding: 3px 14px !important; + white-space: nowrap; } ul.navbar-nav > li.nav-item > ul.dropdown-menu.multi-column > div.row > div > ul.multi-column-dropdown { @@ -772,7 +783,6 @@ else { //default: white display: inline-block; font-size: 8pt; margin: 0 0 0 8px; - opacity: 0.30; } div.menu_side_sub > a.menu_side_item_sub > span.fas, @@ -810,8 +820,13 @@ else { //default: white /* logout icon */ a.logout_icon { + + position: absolute; + + display: block; + color: ; - padding: 14px 10px; + padding: 14px 10px 11px 10px; } a.logout_icon:hover, @@ -1084,46 +1099,6 @@ else { //default: white -moz-box-shadow: 0 2px ; box-shadow: 0 2px ; } - - div#body_header a { - color: ; - } - - div#body_header a:hover { - color: ; - text-decoration: none; - } - - div#body_header_user_menu { - z-index: 6; - display: none; - position: absolute; - top: 50px; - /* right: specified in /resources/classes/menu.php */ - padding: 15px; - background-color: ; - border: 1px solid ; - - -webkit-border-radius: ; - -moz-border-radius: ; - border-radius: ; - - -webkit-box-shadow: 0 2px ; - -moz-box-shadow: 0 2px ; - box-shadow: 0 2px ; - } - - @media (max-width: 575.98px) { - div#body_header_user_menu { - width: calc(100% - 20px); - /* right: specified in /resources/classes/menu.php */ - } - } - - div#body_header_user_menu a { - font-size: 90%; - text-decoration: none; - } div#body_header { padding: 10px; @@ -1135,6 +1110,48 @@ else { //default: white } + div#body_header a { + color: ; + } + + div#body_header a:hover { + color: ; + text-decoration: none; + } + + div#body_header_user_menu { + z-index: 6; + display: none; + position: absolute; + + top: 50px; + + /* right: specified in /resources/classes/menu.php */ + padding: 15px; + background-color: ; + border: 1px solid ; + + -webkit-border-radius: ; + -moz-border-radius: ; + border-radius: ; + + -webkit-box-shadow: 0 2px ; + -moz-box-shadow: 0 2px ; + box-shadow: 0 2px ; + } + + @media (max-width: 575.98px) { + div#body_header_user_menu { + width: calc(100% - 20px); + /* right: specified in /resources/classes/menu.php */ + } + } + + div#body_header_user_menu a { + font-size: 90%; + text-decoration: none; + } + div#body_header_brand_image { display: inline-block; margin-left: 8px; @@ -1527,8 +1544,8 @@ else { //default: white bottom: 0; width: 340px; padding: 20px 20px 100px 20px; - font-family: arial, san-serif; - font-size: 10pt; + font-family: ; + font-size: ; overflow: hidden; background: ; -webkit-box-shadow: ; @@ -1812,7 +1829,7 @@ else { //default: white font-size: ; color: ; text-align: left; - height: 28px; + height: ; padding: 4px 6px; margin: 1px; border-width: ; @@ -2218,7 +2235,7 @@ else { //default: white span.playback_progress_bar { background-color: ; - + width: 2px; height: ; margin-bottom: 0; @@ -2250,7 +2267,7 @@ else { //default: white background-image: -webkit-linear-gradient(top, rgba(0,0,0,0.10) 0%, transparent 100%); background-image: linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, transparent 100%); overflow: hidden; - + padding-bottom: 0px; background-size: 100% 100% !important; background-repeat: no-repeat; @@ -2889,6 +2906,7 @@ else { //default: white div.card { margin-bottom: 15px; + overflow-x: auto; top: ; - text-align: right; + text-align: left; border-top: ; border-right: ; border-bottom: ; @@ -3464,19 +3482,6 @@ else { //default: white float: left; } - div.action_bar > div.heading > div.count { - display: inline-block; - margin-left: 10px; - font-family: ; - font-size: ; - line-height: calc( + 1px); - color: ; - font-weight: ; - border-radius: ; - background-color: ; - padding: ; - } - div.action_bar > div.actions { float: right; white-space: normal; @@ -3511,6 +3516,21 @@ else { //default: white font-size: 1.4em; } +/* COUNT **********************************************************************/ + + div.count { + display: inline-block; + margin-left: 10px; + font-family: ; + font-size: ; + line-height: calc( + 1px); + color: ; + font-weight: ; + border-radius: ; + background-color: ; + padding: ; + } + /* LIST ************************************************************************/ .list { diff --git a/themes/default/template.php b/themes/default/template.php index 13749a5511..3cfd78a5fc 100644 --- a/themes/default/template.php +++ b/themes/default/template.php @@ -20,7 +20,7 @@ - + {*//link to custom css file *} {if !empty($settings.theme.custom_css)} @@ -687,17 +687,15 @@ {/literal} {/if} - //side/fixed menu: hide an open user menu in the body header or menu on scroll - {if $settings.theme.menu_style == 'side' || $settings.theme.menu_style == 'fixed' } - {literal} - $(window).on('scroll', function() { - $('#body_header_user_menu').fadeOut(200); - }); - $('div#main_content').on('click', function() { - $('#body_header_user_menu').fadeOut(200); - }); - {/literal} - {/if} + //hide an open user menu in the body header or menu on scroll + {literal} + $(window).on('scroll', function() { + $('#body_header_user_menu').fadeOut(200); + }); + $('div#main_content').on('click', function() { + $('#body_header_user_menu').fadeOut(200); + }); + {/literal} //create function to mimic toggling fade and slide at the same time {literal} @@ -1084,7 +1082,7 @@ obj = JSON.parse(this.responseText); //update the domain count - document.getElementById('domain_count').innerText = '('+ obj.length +')'; + document.getElementById('domain_count').innerText = obj.length; //add new options from the json results for (var i=0; i < obj.length; i++) { @@ -1184,7 +1182,7 @@