diff --git a/docs/ALTERNATE_NUMBER_DIALING.txt b/docs/ALTERNATE_NUMBER_DIALING.txt index 8c961e33..735d2a07 100644 --- a/docs/ALTERNATE_NUMBER_DIALING.txt +++ b/docs/ALTERNATE_NUMBER_DIALING.txt @@ -1,4 +1,4 @@ -ALTERNATE NUMBER DIALING Redesign Started: 2008-08-20 Updated: 2022-01-19 +ALTERNATE NUMBER DIALING Redesign Started: 2008-08-20 Updated: 2024-08-05 *** THIS SECTION OUTLINES PROPOSED CHANGES TO ALT-NUMBER-DIALING in the 2.0.5 version *** *** FOR INFORMATION ON THE 2.0.3 AND 2.0.4 VERSION OF ALT NUMBER DIALING LOOK BELOW THIS SECTION *** @@ -53,7 +53,11 @@ Using MULTI_LEAD is different from the other standard Auto-Alt-Dial functions, i The Auto-Alt-Statuses are still in used for MULTI_LEAD so you may want to make sure that statuses like DROP, PDROP and others to your campaign's auto-alt-dial statuses so that the other leads tied by vendor_lead_code in the campaign's lists are not deactivated. -There is a feature in the hopper section of the modify campaign page that it is recommended you activate if you are using MULTI_LEAD auto-alt dialing: Hopper VLC Dup Check. This feature will prevent multiple numbers from the same account from getting inserted into the hopper at the same time. +There is a feature in the hopper section of the modify campaign page that it is recommended you activate if you are using MULTI_LEAD auto-alt dialing: "Hopper VLC Dup Check". This feature will prevent multiple numbers from the same account from getting inserted into the hopper at the same time. + +Also, you can have the system automatically disable the rest of the leads for an account by adding a "Dispo Call URL" entry for the campaign using the "agc/deactivate_lead.php" script. For example: VARhttp://192.168.1.1/agc/deactivate_lead.php?search_field=vendor_lead_code&new_status=INACTIV&dispo=--A--dispo--B--&lead_id=--A--lead_id--B--&campaign_check=TESTCAMP&user=--A--user--B--&pass=--A--pass--B--&sale_status=SALE---XSALE&log_to_file=1 + +The above dispo call url example will set the other leads tied to the account linked by the vendor_lead_code to a status of 'INACTIV' when one of them is set as a SALE or XSALE. @@ -132,6 +136,7 @@ A new Campaign and List-Override feature was added in January of 2022(svn/trunk + Technical explanation: !!! DO NOT MAKE THESE DATABASE CHANGES, FOR DOCUMENTATION PURPOSES ONLY !!!! diff --git a/docs/NON-AGENT_API.txt b/docs/NON-AGENT_API.txt index 46c4600c..672cad33 100644 --- a/docs/NON-AGENT_API.txt +++ b/docs/NON-AGENT_API.txt @@ -2665,7 +2665,7 @@ ERROR: copy_did NOT AN ALLOWED DID - 98762 ERROR: copy_did DID DESCRIPTION MUST BE EITHER BLANK OR FROM 6 TO 50 CHARACTERS, THIS IS AN OPTIONAL FIELD - 6666|012 NOTICE: copy_did DID ALREADY EXISTS - 6666|1000 NOTICE: copy_did DID HAS BEEN ADDED - 6666|1000|1001|12|1 -ERROR: copy_did NO DIDS ADDED - 6666|1000|0|12|1 +ERROR: copy_did NO DIDS ADDED - 6666|1000|0|1 SUCCESS: copy_did DIDS HAVE BEEN ADDED - 6666|1000|1|0 NOTE: If DIDs are attempted to be copied, there will be output for each attempted DID as well as a SUCCESS message if any were successfully copied or an ERROR if none were diff --git a/www/VERM/VERM_AGENTS_rpt.inc b/www/VERM/VERM_AGENTS_rpt.inc index 69310be8..4f76ee67 100644 --- a/www/VERM/VERM_AGENTS_rpt.inc +++ b/www/VERM/VERM_AGENTS_rpt.inc @@ -1,11 +1,12 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1631 - First build # 230106-1304 - Added data flushing for large page outputs +# 240801-1130 - Code updates for PHP8 compatibility # # NANQUE, not an unanswered call? @@ -748,11 +749,11 @@ foreach ($agent_sessions_array as $user => $sessions) $total_dispo_time=array_sum(array_column($sessions,'dispo_sec')); $total_ALL_billable_time=($total_talk_time+$total_wait_time+$total_billable_time+$total_dispo_time); - $average_pause_time=sprintf('%02d', floor(($total_pause_time/$total_pauses)/3600)).gmdate(":i:s", round($total_pause_time/$total_pauses)); + $average_pause_time=sprintf('%02d', floor(MathZDC($total_pause_time, $total_pauses)/3600)).gmdate(":i:s", round(MathZDC($total_pause_time, $total_pauses))); $total_sessions=count($sessions); - $avg_session=sprintf('%02d', floor(($total_duration/$total_sessions)/3600)).gmdate(":i:s", round($total_duration/$total_sessions)); - $pauses_pct=sprintf("%.1f", 100*($total_pause_time/$total_duration)); - $pauses_per_session=sprintf("%.1f", ($total_pauses/$total_sessions)); + $avg_session=sprintf('%02d', floor(MathZDC($total_duration, $total_sessions)/3600)).gmdate(":i:s", round(MathZDC($total_duration, $total_sessions))); + $pauses_pct=sprintf("%.1f", 100*MathZDC($total_pause_time, $total_duration)); + $pauses_per_session=sprintf("%.1f", MathZDC($total_pauses, $total_sessions)); $total_pause_His=sprintf('%02d', floor($total_pause_time/3600)).gmdate(":i:s", $total_pause_time); $total_available_His=sprintf('%02d', floor($total_available_time/3600)).gmdate(":i:s", $total_available_time); @@ -836,7 +837,7 @@ foreach ($agent_sessions_array as $user => $sessions) $total_nonbillable_His=sprintf('%02d', floor($total_nonbillable_time/3600)).gmdate(":i:s", $total_nonbillable_time); $total_ALL_billable_His=sprintf('%02d', floor($total_ALL_billable_time/3600)).gmdate(":i:s", $total_ALL_billable_time); - $available_pct=sprintf("%.1f", 100*($total_duration/$grand_total_duration)); + $available_pct=sprintf("%.1f", 100*MathZDC($total_duration, $grand_total_duration)); $overlapping="0:00"; @@ -851,7 +852,7 @@ foreach ($agent_sessions_array as $user => $sessions) $HTML_output.="".$total_nonbillable_His.""; ### $HTML_output.="".$overlapping.""; $HTML_output.="".$available_pct." %"; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.="\n"; $CSV_output["agent_availability"].="\"".$agentName."\",\"".$total_available_His."\",\"".$total_pause_His."\",\"".$total_billable_His."\",\"".$total_nonbillable_His."\",\"".$available_pct." %\"\n"; @@ -901,7 +902,7 @@ foreach ($agent_sessions_array as $user => $sessions) $total_billable_His=sprintf('%02d', floor($total_billable_time/3600)).gmdate(":i:s", $total_billable_time); $total_ALL_billable_His=sprintf('%02d', floor($total_ALL_billable_time/3600)).gmdate(":i:s", $total_ALL_billable_time); - $queue_pct=sprintf("%.1f", 100*($total_calls/$grand_total_calls)); + $queue_pct=sprintf("%.1f", 100*MathZDC($total_calls, $grand_total_calls)); $agentName=($show_full_agent_info ? "$user - ".$fullname_info["$user"] : $fullname_info["$user"]); @@ -944,9 +945,9 @@ $CSV_output["answered_calls_by_user_group"]="\""._QXZ("Agent group")."\",\""._QX foreach ($user_groups_array as $user_group => $data) { $total_talk_His=sprintf('%02d', floor($data["talk_sec"]/3600)).gmdate(":i:s", $data["talk_sec"]); - $avg_talk_His=gmdate("H:i:s", round($data["talk_sec"]/$data["calls"])); + $avg_talk_His=gmdate("H:i:s", MathZDC(round($data["talk_sec"]), $data["calls"])); - $queue_pct=sprintf("%.1f", 100*($data["calls"]/$grand_total_calls)); + $queue_pct=sprintf("%.1f", 100*MathZDC($data["calls"], $grand_total_calls)); $HTML_output.="\n"; $HTML_output.="$user_group"."-".$usergroup_info["$user_group"].""; @@ -985,10 +986,10 @@ $CSV_output["answered_calls_by_location"]="\""._QXZ("Location")."\",\""._QXZ("N. foreach ($locations_array as $location => $data) { $total_talk_His=sprintf('%02d', floor($data["talk_sec"]/3600)).gmdate(":i:s", $data["talk_sec"]); - $avg_talk_His=gmdate("H:i:s", round($data["talk_sec"]/$data["calls"])); - $avg_wait_His=gmdate("H:i:s", round($data["wait_sec"]/$data["calls"])); + $avg_talk_His=gmdate("H:i:s", round(MathZDC($data["talk_sec"], $data["calls"]))); + $avg_wait_His=gmdate("H:i:s", round(MathZDC($data["wait_sec"], $data["calls"]))); - $queue_pct=sprintf("%.1f", 100*($data["calls"]/$grand_total_calls)); + $queue_pct=sprintf("%.1f", 100*MathZDC($data["calls"], $grand_total_calls)); $HTML_output.="\n"; @@ -1038,7 +1039,7 @@ $grand_total_pause_His=sprintf('%02d', floor($grand_total_pause_time/3600)).gmda $grand_total_duration_His=sprintf('%02d', floor($grand_total_duration/3600)).gmdate(":i:s", $grand_total_duration); $grand_total_billable_His=sprintf('%02d', floor($grand_total_billable_time/3600)).gmdate(":i:s", $grand_total_billable_time); $grand_total_nonbillable_His=sprintf('%02d', floor($grand_total_nonbillable_time/3600)).gmdate(":i:s", $grand_total_nonbillable_time); -$grand_total_occupancy=sprintf("%.1f", 100*($grand_total_talk_time/($grand_total_duration-$grand_total_pause_time))); +$grand_total_occupancy=sprintf("%.1f", 100*(MathZDC($grand_total_talk_time, ($grand_total_duration-$grand_total_pause_time)))); $HTML_output.="\n"; ### $HTML_output.=" "; @@ -1220,6 +1221,7 @@ $HTML_output.="\n"; $CSV_output["agents_by_hour"].="\""._QXZ("Total")."\"\n"; +ksort($agent_date_hour_array); foreach ($agent_date_hour_array as $array_date => $hour) { $total_distinct_agents=array(); @@ -1291,12 +1293,12 @@ $HTML_output.="\n"; $CSV_output["agent_sessions_view"]="\""._QXZ("Agent")."\",\""._QXZ("Login")."\",\""._QXZ("Talk")."\",\""._QXZ("Pause + Wait")."\",\""._QXZ("Pause")."\",\""._QXZ("Billable (pause)")."\",\""._QXZ("Not Billable (pause)")."\",\""._QXZ("Tot. Wait")."\",\""._QXZ("Sales")."\",\""._QXZ("S PH")."\",\""._QXZ("Cust Cont")."\",\""._QXZ("CC PH")."\",\""._QXZ("Human Ans")."\",\""._QXZ("HA PH")."\",\""._QXZ("Answered")."\",\""._QXZ("HA Conv.")."\",\""._QXZ("CC Conv.")."\",\""._QXZ("Goal Ftrs")."\",\""._QXZ("Ftrs")."\",\""._QXZ("Avg")."\"\n"; $grand_total_idle_time=$grand_total_pause_time+$grand_total_wait_time; -$grand_sph=sprintf("%.1f", $grand_total_sales/($grand_total_duration/3600)); -$grand_haph=sprintf("%.1f", $grand_total_human_answered/($grand_total_duration/3600)); -$grand_ccph=sprintf("%.1f", $grand_total_contacts/($grand_total_duration/3600)); -$grand_ha_conv=sprintf("%.1f", 100*($grand_total_sales/$grand_total_human_answered)); -$grand_cc_conv=sprintf("%.1f", 100*($grand_total_sales/$grand_total_contacts)); -$grand_avg_talk_time=round($grand_total_talk_time/$grand_total_calls); +$grand_sph=sprintf("%.1f", MathZDC($grand_total_sales, ($grand_total_duration/3600))); +$grand_haph=sprintf("%.1f", MathZDC($grand_total_human_answered, ($grand_total_duration/3600))); +$grand_ccph=sprintf("%.1f", MathZDC($grand_total_contacts, ($grand_total_duration/3600))); +$grand_ha_conv=sprintf("%.1f", 100*MathZDC($grand_total_sales, $grand_total_human_answered)); +$grand_cc_conv=sprintf("%.1f", 100*MathZDC($grand_total_sales, $grand_total_contacts)); +$grand_avg_talk_time=round(MathZDC($grand_total_talk_time, $grand_total_calls)); $grand_total_talk_His=sprintf('%02d', floor($grand_total_talk_time/3600)).gmdate(":i:s", $grand_total_talk_time); $grand_total_wait_His=sprintf('%02d', floor($grand_total_wait_time/3600)).gmdate(":i:s", $grand_total_wait_time); diff --git a/www/VERM/VERM_AJAX_functions.php b/www/VERM/VERM_AJAX_functions.php index 6b4eb922..5d23d436 100644 --- a/www/VERM/VERM_AJAX_functions.php +++ b/www/VERM/VERM_AJAX_functions.php @@ -6,6 +6,7 @@ # CHANGELOG: # 220825-1608 - First build # 240709-2151 - Added input variable filtering +# 240801-1130 - Code updates for PHP8 compatibility # $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; @@ -57,16 +58,16 @@ if ($non_latin < 1) $function = preg_replace('/[^\-_0-9a-zA-Z]/','',$function); $custom_report_vars = preg_replace('/[^-\/\|\_\#\*\,\.\_\[\]0-9a-zA-Z]/','',$custom_report_vars); $custom_report_name = preg_replace('/[^\-_0-9a-zA-Z]/','',$custom_report_name); - $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER); - $PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW); + $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER); + $PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW); } else { $function = preg_replace('/[^-_0-9\p{L}/u','',$function); $custom_report_vars = preg_replace('/[^-\/\|\_\#\*\,\.\_\[\]0-9\p{L}]/u','',$custom_report_vars); $custom_report_name = preg_replace('/[^-_0-9\p{L}/u','',$custom_report_name); - $PHP_AUTH_USER = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_USER); - $PHP_AUTH_PW = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_PW); + $PHP_AUTH_USER = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_USER); + $PHP_AUTH_PW = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_PW); } @@ -96,7 +97,7 @@ if ($function=="log_custom_report") { $rpt_log_stmt="insert ignore into verm_custom_report_holder(user, report_name, report_parameters) values('$PHP_AUTH_USER', '$custom_report_name', '$LOGhttp_referer') ON DUPLICATE KEY UPDATE report_name='$custom_report_name', report_parameters='$custom_report_vars'"; $rpt_log_rslt=mysql_to_mysqli($rpt_log_stmt, $link); - return mysqli_affected_rows($rpt_log_rslt); + return mysqli_affected_rows($link); } diff --git a/www/VERM/VERM_ANSWERED_rpt.inc b/www/VERM/VERM_ANSWERED_rpt.inc index 58cb19d1..1f921087 100644 --- a/www/VERM/VERM_ANSWERED_rpt.inc +++ b/www/VERM/VERM_ANSWERED_rpt.inc @@ -1,11 +1,12 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1629 - First build # 230106-1310 - Added auto download and page flushing for large data output, modification to uniqueid handling to speed up page load +# 240801-1130 - Code updates for PHP8 compatibility # # DROP, WAITTO, TIMEOT are unanswered statuses, not NANQUE @@ -465,7 +466,7 @@ $HTML_output.="\n"; $CSV_output["agents_on_queue"]="\""._QXZ("Agents on queue")."\"\n"; $CSV_output["agents_on_queue"].="\""._QXZ("Agent")."\",\""._QXZ("N. Calls")."\",\"\",\"...\",\""._QXZ("Total call time")."\",\""._QXZ("Average call time")."\"\n"; -$highest_agent_call_count=max($agent_call_counts); +$highest_agent_call_count=(count($agent_call_counts)>0 ? max($agent_call_counts) : 0); $agents_on_queue_graph_labels="["; $agents_on_queue_graph_data="["; @@ -624,7 +625,7 @@ $disconnection_causes_graph_data="["; $disconnection_causes_graph_bgcolor="["; # SAME FOR hoverBackgroundColor $disconnection_causes_graph_hovborder="["; -$max_term_reason=max($term_reasons); +$max_term_reason=(count($term_reasons)>0 ? max($term_reasons) : 0); $x=0; foreach ($term_reasons as $reason => $value) { @@ -689,7 +690,7 @@ while ($xfer_row=mysqli_fetch_row($xfer_rslt)) } # print_r($transferred_counts); -$max_xfer_count=max($transferred_counts); +$max_xfer_count=(count($transferred_counts)>0 ? max($transferred_counts) : 0); $x=0; foreach ($transferred_counts as $reason => $value) { @@ -737,7 +738,7 @@ $answered_calls_by_queue_graph_data="["; $answered_calls_by_queue_graph_bgcolor="["; # SAME FOR hoverBackgroundColor $answered_calls_by_queue_graph_hovborder="["; -$max_queue_count=max($queue_stats); +$max_queue_count=(count($queue_stats)>0 ? max($queue_stats) : 0); ksort($queue_stats); $x=0; foreach ($queue_stats as $queue => $value) @@ -799,7 +800,7 @@ $answered_calls_by_direction_graph_data="["; $answered_calls_by_direction_graph_bgcolor="["; # SAME FOR hoverBackgroundColor $answered_calls_by_direction_graph_hovborder="["; -$max_call_direction=max($call_directions); +$max_call_direction=(count($call_directions)>0 ? max($call_directions) : 0); ksort($call_directions); $call_directions["Any calls"]=0; $x=0; @@ -900,7 +901,7 @@ $queue_position_graph_data="["; $queue_position_graph_bgcolor="["; # SAME FOR hoverBackgroundColor $queue_position_graph_hovborder="["; -$max_queue_count=max($queue_positions); +$max_queue_count=(count($queue_positions)>0 ? max($queue_positions) : 0); $x=0; foreach ($queue_positions as $position => $value) { @@ -1015,7 +1016,7 @@ if ($ivr_path!="") if ($ivr_paths["$ivr_path"][3]<$ivr_call_time) {$ivr_paths["$ivr_path"][3]=$ivr_call_time;} } -$max_ivr_count=max($ivr_counts); +$max_ivr_count=(count($ivr_counts)>0 ? max($ivr_counts) : 0); if ($max_ivr_count<$untracked_calls) {$max_ivr_count=$untracked_calls;} $untracked_ivr_pct=sprintf("%.1f", MathZDC((100*$untracked_calls), $total_answered_calls)); @@ -1122,7 +1123,7 @@ while ($did_row=mysqli_fetch_array($did_rslt)) $untracked_did_calls--; } } -$max_did=max($did_counts); +$max_did=(count($did_counts)>0 ? max($did_counts) : 0); if ($max_did<$untracked_did_calls) {$max_did=$untracked_did_calls;} $untracked_did_pct=sprintf("%.1f", MathZDC((100*$untracked_did_calls), $total_answered_calls)); diff --git a/www/VERM/VERM_DAY_rpt.inc b/www/VERM/VERM_DAY_rpt.inc index 02772861..4f493bf8 100644 --- a/www/VERM/VERM_DAY_rpt.inc +++ b/www/VERM/VERM_DAY_rpt.inc @@ -1,11 +1,12 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1624 - First build # 230106-1311 - Added page flushing to show page load progress +# 240801-1130 - Code updates for PHP8 compatibility # $vicidial_user_log_table="vicidial_user_log"; @@ -193,17 +194,18 @@ while ($row=mysqli_fetch_array($rslt)) ### These counts are in here because by definition these SHOULD be answers, but you never know with some morons. ### "Real" campaign_id should have been gotten under the direction clause above - if (in_array($status, $sale_array["$campaign_id"]) || in_array($status, $sale_array["SYSTEM"])) + + if ((array_key_exists("$campaign_id", $sale_array) && in_array($status, $sale_array["$campaign_id"])) || in_array($status, $sale_array["SYSTEM"])) { $calls_array["$call_date"]["sales"]++; $total_sales++; } - if (in_array($status, $human_ans_array["$campaign_id"]) || in_array($status, $human_ans_array["SYSTEM"])) + if ((array_key_exists("$campaign_id", $human_ans_array) && in_array($status, $human_ans_array["$campaign_id"])) || in_array($status, $human_ans_array["SYSTEM"])) { $calls_array["$call_date"]["human_answered"]++; $total_human_answered++; } - if (in_array($status, $contact_array["$campaign_id"]) || in_array($status, $contact_array["SYSTEM"])) + if ((array_key_exists("$campaign_id", $contact_array) && in_array($status, $contact_array["$campaign_id"])) || in_array($status, $contact_array["SYSTEM"])) { $calls_array["$call_date"]["customer_contacts"]++; $total_customer_contacts++; @@ -234,7 +236,7 @@ while ($row=mysqli_fetch_array($rslt)) # Queue array $queue_array["$call_date"]["total_calls"]++; $queue_array["$call_date"]["total_queue"]+=$queue_position; - $queue_array["$call_date"]["avg_position"]=($queue_array["$call_date"]["total_queue"]/$queue_array["$call_date"]["total_calls"]); + $queue_array["$call_date"]["avg_position"]=MathZDC($queue_array["$call_date"]["total_queue"], $queue_array["$call_date"]["total_calls"]); # Min/max queue if (!$queue_array["$call_date"]["min_queue_position"] || $queue_position<$queue_array["$call_date"]["min_queue_position"]) { @@ -281,7 +283,7 @@ foreach ($answered_calls_array as $call_date_key => $call_date_data) $total_date_calls_answered=($answered_calls_array["$call_date_key"]["inbound"]+$answered_calls_array["$call_date_key"]["outbound"]); $total_date_calls_unanswered=($unanswered_calls_array["$call_date_key"]["inbound"]+$unanswered_calls_array["$call_date_key"]["outbound"]); - $avg_call_length=round($answered_calls_array["$call_date_key"]["total_length"]/$total_date_calls_answered); + $avg_call_length=round(MathZDC($answered_calls_array["$call_date_key"]["total_length"], $total_date_calls_answered)); $avg_call_length_fmt=($avg_call_length>=3600 ? floor($avg_call_length/3600).":" : "").gmdate("i:s", $avg_call_length); $min_call_length_fmt=($answered_calls_array["$call_date_key"]["min_call_length"]>=3600 ? floor($answered_calls_array["$call_date_key"]["min_call_length"]/3600).":" : "").gmdate("i:s", $answered_calls_array["$call_date_key"]["min_call_length"]); @@ -290,15 +292,15 @@ foreach ($answered_calls_array as $call_date_key => $call_date_data) $HTML_output.=""; $HTML_output.="".$call_date_key.""; $HTML_output.="".$total_date_calls_answered.""; - $HTML_output.="".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$total_date_calls_answered), $total_answered_calls)))." %"; + $HTML_output.=""; $HTML_output.="".$avg_call_length_fmt.""; $HTML_output.="".$min_call_length_fmt.""; $HTML_output.="".$max_call_length_fmt.""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["answered_call_distribution"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %\",\"\",\"".$avg_call_length_fmt."\",\"".$min_call_length_fmt."\",\"".$max_call_length_fmt."\",\"\"\n"; + $CSV_output["answered_call_distribution"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", (MathZDC((100*$total_date_calls_answered), $total_answered_calls)))." %\",\"\",\"".$avg_call_length_fmt."\",\"".$min_call_length_fmt."\",\"".$max_call_length_fmt."\",\"\"\n"; } $HTML_output.=""; # $HTML_output.=""._QXZ("Export as")."...CSV"; @@ -344,7 +346,7 @@ foreach ($answered_calls_array as $call_date_key => $call_date_data) $total_date_calls_answered=($answered_calls_array["$call_date_key"]["inbound"]+$answered_calls_array["$call_date_key"]["outbound"]); $total_date_calls_unanswered=($unanswered_calls_array["$call_date_key"]["inbound"]+$unanswered_calls_array["$call_date_key"]["outbound"]); - $avg_wait_time=round($answered_calls_array["$call_date_key"]["total_wait"]/$total_date_calls_answered); + $avg_wait_time=round(MathZDC($answered_calls_array["$call_date_key"]["total_wait"], $total_date_calls_answered)); $avg_wait_time_fmt=($avg_wait_time>=3600 ? floor($avg_wait_time/3600).":" : "").gmdate("i:s", $avg_wait_time); $min_wait_time_fmt=($answered_calls_array["$call_date_key"]["min_wait_time"]>=3600 ? floor($answered_calls_array["$call_date_key"]["min_wait_time"]/3600).":" : "").gmdate("i:s", $answered_calls_array["$call_date_key"]["min_wait_time"]); @@ -353,15 +355,15 @@ foreach ($answered_calls_array as $call_date_key => $call_date_data) $HTML_output.=""; $HTML_output.="".$call_date_key.""; $HTML_output.="".$total_date_calls_answered.""; - $HTML_output.="".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$total_date_calls_answered), $total_answered_calls)))." %"; + $HTML_output.=""; $HTML_output.="".$avg_wait_time_fmt.""; $HTML_output.="".$min_wait_time_fmt.""; $HTML_output.="".$max_wait_time_fmt.""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["answered_call_wait_time"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %\",\"\",\"".$avg_wait_time_fmt."\",\"".$min_wait_time_fmt."\",\"".$max_wait_time_fmt."\",\"\"\n"; + $CSV_output["answered_call_wait_time"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", (MathZDC((100*$total_date_calls_answered), $total_answered_calls)))." %\",\"\",\"".$avg_wait_time_fmt."\",\"".$min_wait_time_fmt."\",\"".$max_wait_time_fmt."\",\"\"\n"; } $HTML_output.=""; # $HTML_output.=""._QXZ("Export as")."...CSV"; @@ -397,7 +399,7 @@ $CSV_output["unanswered_call_wait_time"]="\""._QXZ("Day")."\",\""._QXZ("Num")."\ $max_avg_wait_time=0; foreach ($calls_array as $call_date_key => $call_date_data) { - $avg_wait_time=round($unanswered_calls_array["$call_date_key"]["total_wait"]/($unanswered_calls_array["$call_date_key"]["inbound"]+$unanswered_calls_array["$call_date_key"]["outbound"])); + $avg_wait_time=round(MathZDC($unanswered_calls_array["$call_date_key"]["total_wait"], ($unanswered_calls_array["$call_date_key"]["inbound"]+$unanswered_calls_array["$call_date_key"]["outbound"]))); # print $unanswered_calls_array["$call_date_key"]["total_wait"]."/".($unanswered_calls_array["$call_date_key"]["inbound"]+$unanswered_calls_array["$call_date_key"]["outbound"])."\n"; $unanswered_calls_array["$call_date_key"]["avg_wait_time"]=$avg_wait_time+0; if ($max_avg_wait_time<$avg_wait_time) {$max_avg_wait_time=$avg_wait_time;} @@ -409,7 +411,7 @@ foreach ($unanswered_calls_array as $call_date_key => $call_date_data) $total_date_calls_answered=($unanswered_calls_array["$call_date_key"]["inbound"]+$unanswered_calls_array["$call_date_key"]["outbound"]); $total_date_calls_unanswered=($unanswered_calls_array["$call_date_key"]["inbound"]+$unanswered_calls_array["$call_date_key"]["outbound"]); - $avg_wait_time=round($unanswered_calls_array["$call_date_key"]["total_wait"]/$total_date_calls_unanswered); + $avg_wait_time=round(MathZDC($unanswered_calls_array["$call_date_key"]["total_wait"], $total_date_calls_unanswered)); $avg_wait_time_fmt=($avg_wait_time>=3600 ? floor($avg_wait_time/3600).":" : "").gmdate("i:s", $avg_wait_time); $min_wait_time_fmt=($unanswered_calls_array["$call_date_key"]["min_wait_time"]>=3600 ? floor($unanswered_calls_array["$call_date_key"]["min_wait_time"]/3600).":" : "").gmdate("i:s", $unanswered_calls_array["$call_date_key"]["min_wait_time"]); @@ -418,15 +420,15 @@ foreach ($unanswered_calls_array as $call_date_key => $call_date_data) $HTML_output.=""; $HTML_output.="".$call_date_key.""; $HTML_output.="".$total_date_calls_unanswered.""; - $HTML_output.="".sprintf("%.1f", ((100*$total_date_calls_unanswered)/$total_unanswered_calls))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$total_date_calls_unanswered), $total_unanswered_calls)))." %"; + $HTML_output.=""; $HTML_output.="".$avg_wait_time_fmt.""; $HTML_output.="".$min_wait_time_fmt.""; $HTML_output.="".$max_wait_time_fmt.""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["unanswered_call_wait_time"].="\"".$call_date_key."\",\"".$total_date_calls_unanswered."\",\"".sprintf("%.1f", ((100*$total_date_calls_unanswered)/$total_unanswered_calls))." %\",\"\",\"".$avg_wait_time_fmt."\",\"".$min_wait_time_fmt."\",\"".$max_wait_time_fmt."\",\"\"\n"; + $CSV_output["unanswered_call_wait_time"].="\"".$call_date_key."\",\"".$total_date_calls_unanswered."\",\"".sprintf("%.1f", (MathZDC((100*$total_date_calls_unanswered), $total_unanswered_calls)))." %\",\"\",\"".$avg_wait_time_fmt."\",\"".$min_wait_time_fmt."\",\"".$max_wait_time_fmt."\",\"\"\n"; } $HTML_output.=""; @@ -461,25 +463,25 @@ $HTML_output.="\n"; $CSV_output["sales_per_day"]="\""._QXZ("Day")."\",\""._QXZ("Human ans. conv")."\",\""._QXZ("Customer cont. conv")."\",\""._QXZ("Sales")."\",\"\",\"\",\""._QXZ("Human answers")."\",\""._QXZ("Customer contacts")."\",\"\",\"\"\n"; #print_r($calls_array); -$max_day_sales=max(array_column($calls_array, 'sales')); -$max_day_customer_contacts=max(array_column($calls_array, 'customer_contacts')); +$max_day_sales=(count(array_column($calls_array, 'sales'))>0 ? max(array_column($calls_array, 'sales')) : 0); +$max_day_customer_contacts=(count(array_column($calls_array, 'customer_contacts'))>0 ? max(array_column($calls_array, 'customer_contacts')) : 0); #print "
$max_day_sales
\n"; foreach ($calls_array as $call_date_key => $data) { $HTML_output.=""; $HTML_output.="$call_date_key"; - $HTML_output.="".sprintf("%.1f", ((100*$data["sales"])/$data["human_answered"]))." %"; - $HTML_output.="".sprintf("%.1f", ((100*$data["sales"])/$data["customer_contacts"]))." %"; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$data["sales"]), $data["human_answered"])))." %"; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$data["sales"]), $data["customer_contacts"])))." %"; $HTML_output.="".($data["sales"]+0).""; - $HTML_output.="".sprintf("%.1f", ((100*$data["sales"])/$total_sales))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$data["sales"]), $total_sales)))." %"; + $HTML_output.=""; $HTML_output.="".$data["human_answered"].""; $HTML_output.="".$data["customer_contacts"].""; - $HTML_output.="".sprintf("%.1f", ((100*$data["customer_contacts"])/$total_customer_contacts))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$data["customer_contacts"]), $total_customer_contacts)))." %"; + $HTML_output.=""; $HTML_output.="\n"; - $CSV_output["sales_per_day"].="\"$call_date_key\",\"".sprintf("%.1f", ((100*$data["sales"])/$data["human_answered"]))." %\",\"".sprintf("%.1f", ((100*$data["sales"])/$data["customer_contacts"]))." %\",\"".($data["sales"]+0)."\",\"".sprintf("%.1f", ((100*$data["sales"])/$total_sales))." %\",\"\",\"".$data["human_answered"]."\",\"".$data["customer_contacts"]."\",\"".sprintf("%.1f", ((100*$data["customer_contacts"])/$total_customer_contacts))." %\",\"\"\n"; + $CSV_output["sales_per_day"].="\"$call_date_key\",\"".sprintf("%.1f", (MathZDC((100*$data["sales"]), $data["human_answered"])))." %\",\"".sprintf("%.1f", (MathZDC((100*$data["sales"]), $data["customer_contacts"])))." %\",\"".($data["sales"]+0)."\",\"".sprintf("%.1f", (MathZDC((100*$data["sales"]), $total_sales)))." %\",\"\",\"".$data["human_answered"]."\",\"".$data["customer_contacts"]."\",\"".sprintf("%.1f", (MathZDC((100*$data["customer_contacts"]), $total_customer_contacts)))." %\",\"\"\n"; } $HTML_output.=""; # $HTML_output.=""._QXZ("Export as")."...CSV"; @@ -509,17 +511,17 @@ $HTML_output.="\n"; ### Removed Coverage column before Steps 5/19/22 - not needed $CSV_output["queue_length_per_day"]="\""._QXZ("Day")."\",\""._QXZ("Avg")."\",\"...\",\""._QXZ("Min")."\",\""._QXZ("Max")."\",\"...\",\""._QXZ("Average Sum of Queue Positions Per Hour")."\"\n"; -$max_call_position=max(array_column($queue_array, 'max_queue_position')); -$max_avg_position=max(array_column($queue_array, 'avg_position')); +$max_call_position=(count(array_column($queue_array, 'max_queue_position'))>0 ? max(array_column($queue_array, 'max_queue_position')) : 0); +$max_avg_position=(count(array_column($queue_array, 'avg_position'))>0 ? max(array_column($queue_array, 'avg_position')) : 0); foreach ($queue_array as $call_date_key => $data) { $HTML_output.=""; $HTML_output.="$call_date_key"; $HTML_output.="".sprintf("%.1f", $queue_array["$call_date"]["avg_position"]).""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.="".$queue_array["$call_date_key"]["min_queue_position"].""; $HTML_output.="".$queue_array["$call_date_key"]["max_queue_position"].""; - $HTML_output.=""; + $HTML_output.=""; ### $HTML_output.="100% **"; $HTML_output.="".sprintf("%.1f", $queue_array["$call_date_key"]["total_queue"]/24).""; # Always seems to be 24 hours for the date - even when I ran starting at 8am. $HTML_output.="\n"; @@ -554,13 +556,13 @@ foreach ($user_array as $call_date_key => $users_that_day) $HTML_output.=""; $HTML_output.="$call_date_key"; $HTML_output.="".count($users_that_day).""; - $HTML_output.="".sprintf("%.1f", (100*count($users_that_day)/$total_distinct_users_per_date))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC(100*count($users_that_day), $total_distinct_users_per_date)))." %"; + $HTML_output.=""; $HTML_output.="\n"; if (!$download_rpt) {echo $HTML_output; ob_flush(); flush(); $HTML_output="";} - $CSV_output["schedule_adherence_per_day"].="\"$call_date_key\",\"".count($users_that_day)."\",\"".sprintf("%.1f", (100*count($users_that_day)/$total_distinct_users_per_date))." %\",\"\"\n"; + $CSV_output["schedule_adherence_per_day"].="\"$call_date_key\",\"".count($users_that_day)."\",\"".sprintf("%.1f", (MathZDC(100*count($users_that_day), $total_distinct_users_per_date)))." %\",\"\"\n"; # print "agents for $call_date_key: ".count($users_that_day)."\n"; @@ -618,6 +620,7 @@ $HTML_output.="\n"; $CSV_output["inclusive_sla_per_day"].="\n"; +$svc_lvl_row=array(); foreach ($calls_array as $call_date_key => $data) { $svc_lvl_stmt="select $SLA_query from vicidial_closer_log where call_date>='".$call_date_key." $start_time' and call_date<='".$call_date_key." $end_time' $and_vicidial_closer_log_SQL and (user!='VDCL')"; # and campaign_id in ($ingroup_str) and user in ('VDCL', $user_str) @@ -640,8 +643,8 @@ foreach ($calls_array as $call_date_key => $data) for ($f=0; $f"; - $CSV_output["inclusive_sla_per_day"].=",\"".sprintf("%.1f", ((100*$svc_lvl_row[$f])/$answered_calls))." %\""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$svc_lvl_row[$f]), $answered_calls)))." %"; + $CSV_output["inclusive_sla_per_day"].=",\"".sprintf("%.1f", (MathZDC((100*$svc_lvl_row[$f]), $answered_calls)))." %\""; } $HTML_output.="\n"; diff --git a/www/VERM/VERM_DOW_rpt.inc b/www/VERM/VERM_DOW_rpt.inc index 451fb35b..56d1cf20 100644 --- a/www/VERM/VERM_DOW_rpt.inc +++ b/www/VERM/VERM_DOW_rpt.inc @@ -1,10 +1,11 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1623 - First build +# 240801-1130 - Code updates for PHP8 compatibility # # NANQUE, not an unanswered call? @@ -114,7 +115,7 @@ for ($q=0; $q<=6; $q++) $user_array["$key"]=array(); } -$stmt="select dayname(call_date) as cdate, dayofweek(call_date) as day_no, campaign_id, status, user, length_in_sec as call_length, uniqueid, '0' as wait_sec, 'O' as direction, '1' as queue_position, lead_id from vicidial_log $vicidial_log_SQL $and_NANQUE_clause $exc_addtl_statuses UNION ALL select dayname(call_date) as cdate, dayofweek(call_date) as day_no, campaign_id, status, user, if(comments='EMAIL', length_in_sec, length_in_sec-queue_seconds) as call_length, uniqueid, queue_seconds as wait_sec, 'I' as direction, queue_position, lead_id from vicidial_closer_log $vicidial_closer_log_SQL $and_NANQUE_clause $exc_addtl_statuses order by day_no"; +$stmt="select dayname(call_date) as cdate, dayofweek(call_date) as day_no, campaign_id, status, user, length_in_sec as call_length, uniqueid, '0' as wait_sec, 'O' as direction, '1' as queue_position, lead_id from vicidial_log $vicidial_log_SQL $and_NANQUE_clause $exc_addtl_statuses UNION ALL select dayname(call_date) as cdate, dayofweek(call_date) as day_no, campaign_id, status, user, if(comments='EMAIL', length_in_sec, length_in_sec-queue_seconds) as call_length, uniqueid, if(comments='EMAIL', '0', queue_seconds) as wait_sec, 'I' as direction, queue_position, lead_id from vicidial_closer_log $vicidial_closer_log_SQL $and_NANQUE_clause $exc_addtl_statuses order by day_no"; if ($DB) {$HTML_output.="$stmt";} # print $stmt."\n"; $rslt=mysql_to_mysqli($stmt, $link); @@ -233,17 +234,17 @@ while ($row=mysqli_fetch_array($rslt)) ### These counts are in here because by definition these SHOULD be answers, but you never know with some morons. ### "Real" campaign_id should have been gotten under the direction clause above - if (in_array($status, $sale_array["$campaign_id"]) || in_array($status, $sale_array["SYSTEM"])) + if ((array_key_exists("$campaign_id", $sale_array) && in_array($status, $sale_array["$campaign_id"])) || in_array($status, $sale_array["SYSTEM"])) { $calls_array["$call_date"]["sales"]++; $total_sales++; } - if (in_array($status, $human_ans_array["$campaign_id"]) || in_array($status, $human_ans_array["SYSTEM"])) + if ((array_key_exists("$campaign_id", $human_ans_array) && in_array($status, $human_ans_array["$campaign_id"])) || in_array($status, $human_ans_array["SYSTEM"])) { $calls_array["$call_date"]["human_answered"]++; $total_human_answered++; } - if (in_array($status, $contact_array["$campaign_id"]) || in_array($status, $contact_array["SYSTEM"])) + if ((array_key_exists("$campaign_id", $contact_array) && in_array($status, $contact_array["$campaign_id"])) || in_array($status, $contact_array["SYSTEM"])) { $calls_array["$call_date"]["customer_contacts"]++; $total_customer_contacts++; @@ -274,7 +275,7 @@ while ($row=mysqli_fetch_array($rslt)) # Queue array $queue_array["$call_date"]["total_calls"]++; $queue_array["$call_date"]["total_queue"]+=$queue_position; - $queue_array["$call_date"]["avg_position"]=($queue_array["$call_date"]["total_queue"]/$queue_array["$call_date"]["total_calls"]); + $queue_array["$call_date"]["avg_position"]=(MathZDC($queue_array["$call_date"]["total_queue"], $queue_array["$call_date"]["total_calls"])); # Min/max queue if (!$queue_array["$call_date"]["min_queue_position"] || $queue_position<$queue_array["$call_date"]["min_queue_position"]) { @@ -332,21 +333,23 @@ foreach ($answered_calls_array as $call_date_key => $call_date_data) $avg_call_length=round(MathZDC($answered_calls_array["$call_date_key"]["total_length"], $total_date_calls_answered)); $avg_call_length_fmt=($avg_call_length>=3600 ? floor($avg_call_length/3600).":" : "").gmdate("i:s", $avg_call_length); + $answered_calls_array["$call_date_key"]["min_call_length"]+=0; + $answered_calls_array["$call_date_key"]["max_call_length"]+=0; $min_call_length_fmt=($answered_calls_array["$call_date_key"]["min_call_length"]>=3600 ? floor($answered_calls_array["$call_date_key"]["min_call_length"]/3600).":" : "").gmdate("i:s", $answered_calls_array["$call_date_key"]["min_call_length"]); $max_call_length_fmt=($answered_calls_array["$call_date_key"]["max_call_length"]>=3600 ? floor($answered_calls_array["$call_date_key"]["max_call_length"]/3600).":" : "").gmdate("i:s", $answered_calls_array["$call_date_key"]["max_call_length"]); $HTML_output.=""; $HTML_output.="".$call_date_key.""; $HTML_output.="".$total_date_calls_answered.""; - $HTML_output.="".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$total_date_calls_answered), $total_answered_calls)))." %"; + $HTML_output.=""; $HTML_output.="".$avg_call_length_fmt.""; $HTML_output.="".$min_call_length_fmt.""; $HTML_output.="".$max_call_length_fmt.""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["answered_call_distribution"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %\",\"\",\"".$avg_call_length_fmt."\",\"".$min_call_length_fmt."\",\"".$max_call_length_fmt."\",\"\"\n"; + $CSV_output["answered_call_distribution"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", (MathZDC((100*$total_date_calls_answered), $total_answered_calls)))." %\",\"\",\"".$avg_call_length_fmt."\",\"".$min_call_length_fmt."\",\"".$max_call_length_fmt."\",\"\"\n"; $answered_call_distribution_graph_labels.="\"$call_date_key\","; $answered_call_distribution_graph_data1.="\"$total_date_calls_answered\","; @@ -420,21 +423,23 @@ foreach ($answered_calls_array as $call_date_key => $call_date_data) $avg_wait_time=round(MathZDC($answered_calls_array["$call_date_key"]["total_wait"], $total_date_calls_answered)); $avg_wait_time_fmt=($avg_wait_time>=3600 ? floor($avg_wait_time/3600).":" : "").gmdate("i:s", $avg_wait_time); + $answered_calls_array["$call_date_key"]["min_wait_time"]+=0; + $answered_calls_array["$call_date_key"]["max_wait_time"]+=0; $min_wait_time_fmt=($answered_calls_array["$call_date_key"]["min_wait_time"]>=3600 ? floor($answered_calls_array["$call_date_key"]["min_wait_time"]/3600).":" : "").gmdate("i:s", $answered_calls_array["$call_date_key"]["min_wait_time"]); $max_wait_time_fmt=($answered_calls_array["$call_date_key"]["max_wait_time"]>=3600 ? floor($answered_calls_array["$call_date_key"]["max_wait_time"]/3600).":" : "").gmdate("i:s", $answered_calls_array["$call_date_key"]["max_wait_time"]); $HTML_output.=""; $HTML_output.="".$call_date_key.""; $HTML_output.="".$total_date_calls_answered.""; - $HTML_output.="".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$total_date_calls_answered), $total_answered_calls)))." %"; + $HTML_output.=""; $HTML_output.="".$avg_wait_time_fmt.""; $HTML_output.="".$min_wait_time_fmt.""; $HTML_output.="".$max_wait_time_fmt.""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["answered_call_wait_time"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %\",\"\",\"".$avg_wait_time_fmt."\",\"".$min_wait_time_fmt."\",\"".$max_wait_time_fmt."\",\"\"\n"; + $CSV_output["answered_call_wait_time"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", (MathZDC((100*$total_date_calls_answered), $total_answered_calls)))." %\",\"\",\"".$avg_wait_time_fmt."\",\"".$min_wait_time_fmt."\",\"".$max_wait_time_fmt."\",\"\"\n"; $answered_call_wait_time_graph_labels.="\"$call_date_key\","; $answered_call_wait_time_graph_data1.="\"$total_date_calls_answered\","; @@ -509,21 +514,23 @@ foreach ($unanswered_calls_array as $call_date_key => $call_date_data) $avg_wait_time=round(MathZDC($unanswered_calls_array["$call_date_key"]["total_wait"], $total_date_calls_unanswered)); $avg_wait_time_fmt=($avg_wait_time>=3600 ? floor($avg_wait_time/3600).":" : "").gmdate("i:s", $avg_wait_time); + $unanswered_calls_array["$call_date_key"]["min_wait_time"]+=0; + $unanswered_calls_array["$call_date_key"]["max_wait_time"]+=0; $min_wait_time_fmt=($unanswered_calls_array["$call_date_key"]["min_wait_time"]>=3600 ? floor($unanswered_calls_array["$call_date_key"]["min_wait_time"]/3600).":" : "").gmdate("i:s", $unanswered_calls_array["$call_date_key"]["min_wait_time"]); $max_wait_time_fmt=($unanswered_calls_array["$call_date_key"]["max_wait_time"]>=3600 ? floor($unanswered_calls_array["$call_date_key"]["max_wait_time"]/3600).":" : "").gmdate("i:s", $unanswered_calls_array["$call_date_key"]["max_wait_time"]); $HTML_output.=""; $HTML_output.="".$call_date_key.""; $HTML_output.="".$total_date_calls_unanswered.""; - $HTML_output.="".sprintf("%.1f", ((100*$total_date_calls_unanswered)/$total_unanswered_calls))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$total_date_calls_unanswered), $total_unanswered_calls)))." %"; + $HTML_output.=""; $HTML_output.="".$avg_wait_time_fmt.""; $HTML_output.="".$min_wait_time_fmt.""; $HTML_output.="".$max_wait_time_fmt.""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["unanswered_call_wait_time"].="\"".$call_date_key."\",\"".$total_date_calls_unanswered."\",\"".sprintf("%.1f", ((100*$total_date_calls_unanswered)/$total_unanswered_calls))." %\",\"\",\"".$avg_wait_time_fmt."\",\"".$min_wait_time_fmt."\",\"".$max_wait_time_fmt."\",\"\"\n"; + $CSV_output["unanswered_call_wait_time"].="\"".$call_date_key."\",\"".$total_date_calls_unanswered."\",\"".sprintf("%.1f", (MathZDC((100*$total_date_calls_unanswered), $total_unanswered_calls)))." %\",\"\",\"".$avg_wait_time_fmt."\",\"".$min_wait_time_fmt."\",\"".$max_wait_time_fmt."\",\"\"\n"; $unanswered_call_wait_time_graph_labels.="\"$call_date_key\","; $unanswered_call_wait_time_graph_data1.="\"$total_date_calls_unanswered\","; @@ -573,8 +580,8 @@ $HTML_output.="\n"; $CSV_output["sales_per_day"]="\""._QXZ("Day")."\",\""._QXZ("Human ans. conv")."\",\""._QXZ("Customer cont. conv")."\",\""._QXZ("Sales")."\",\"\",\"\",\""._QXZ("Human answers")."\",\""._QXZ("Customer contacts")."\",\"\",\"\"\n"; #print_r($calls_array); -$max_day_sales=max(array_column($calls_array, 'sales')); -$max_day_customer_contacts=max(array_column($calls_array, 'customer_contacts')); +$max_day_sales=(count(array_column($calls_array, 'sales'))>0 ? max(array_column($calls_array, 'sales')) : 0); +$max_day_customer_contacts=(count(array_column($calls_array, 'customer_contacts'))>0 ? max(array_column($calls_array, 'customer_contacts')) : 0); #print "
$max_day_sales
\n"; foreach ($calls_array as $call_date_key => $data) { @@ -583,15 +590,15 @@ foreach ($calls_array as $call_date_key => $data) $HTML_output.="".sprintf("%.1f", MathZDC((100*$data["sales"]), $data["human_answered"]))." %"; $HTML_output.="".sprintf("%.1f", MathZDC((100*$data["sales"]), $data["customer_contacts"]))." %"; $HTML_output.="".($data["sales"]+0).""; - $HTML_output.="".sprintf("%.1f", ((100*$data["sales"])/$total_sales))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$data["sales"]), $total_sales)))." %"; + $HTML_output.=""; $HTML_output.="".$data["human_answered"].""; $HTML_output.="".$data["customer_contacts"].""; - $HTML_output.="".sprintf("%.1f", ((100*$data["customer_contacts"])/$total_customer_contacts))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$data["customer_contacts"]), $total_customer_contacts)))." %"; + $HTML_output.=""; $HTML_output.="\n"; - $CSV_output["sales_per_day"].="\"$call_date_key\",\"".sprintf("%.1f", MathZDC((100*$data["sales"]), $data["human_answered"]))." %\",\"".sprintf("%.1f", MathZDC((100*$data["sales"]), $data["customer_contacts"]))." %\",\"".($data["sales"]+0)."\",\"".sprintf("%.1f", MathZDC((100*$data["sales"]), $total_sales))." %\",\"\",\"".$data["human_answered"]."\",\"".$data["customer_contacts"]."\",\"".sprintf("%.1f", ((100*$data["customer_contacts"])/$total_customer_contacts))." %\",\"\"\n"; + $CSV_output["sales_per_day"].="\"$call_date_key\",\"".sprintf("%.1f", MathZDC((100*$data["sales"]), $data["human_answered"]))." %\",\"".sprintf("%.1f", MathZDC((100*$data["sales"]), $data["customer_contacts"]))." %\",\"".($data["sales"]+0)."\",\"".sprintf("%.1f", MathZDC((100*$data["sales"]), $total_sales))." %\",\"\",\"".$data["human_answered"]."\",\"".$data["customer_contacts"]."\",\"".sprintf("%.1f", (MathZDC((100*$data["customer_contacts"]), $total_customer_contacts)))." %\",\"\"\n"; } $HTML_output.=""; # $HTML_output.=""._QXZ("Export as")."...CSV"; @@ -621,17 +628,17 @@ $HTML_output.="\n"; ### Removed Coverage column before Steps 5/19/22 - not needed $CSV_output["queue_length_per_day"]="\""._QXZ("Day")."\",\""._QXZ("Avg")."\",\"...\",\""._QXZ("Min")."\",\""._QXZ("Max")."\",\"...\",\""._QXZ("Average Sum of Queue Positions Per Hour")."\"\n"; -$max_call_position=max(array_column($queue_array, 'max_queue_position')); -$max_avg_position=max(array_column($queue_array, 'avg_position')); +$max_call_position=(count(array_column($queue_array, 'max_queue_position'))>0 ? max(array_column($queue_array, 'max_queue_position')) : 0); +$max_avg_position=(count(array_column($queue_array, 'avg_position'))>0 ? max(array_column($queue_array, 'avg_position')) : 0); foreach ($queue_array as $call_date_key => $data) { $HTML_output.=""; $HTML_output.="$call_date_key"; $HTML_output.="".sprintf("%.1f", $queue_array["$call_date_key"]["avg_position"]).""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.="".$queue_array["$call_date_key"]["min_queue_position"].""; $HTML_output.="".$queue_array["$call_date_key"]["max_queue_position"].""; - $HTML_output.=""; + $HTML_output.=""; ### $HTML_output.="100% **"; $HTML_output.="".sprintf("%.1f", $queue_array["$call_date_key"]["total_queue"]/24).""; # Always seems to be 24 hours for the date - even when I ran starting at 8am. $HTML_output.="\n"; @@ -666,13 +673,13 @@ foreach ($user_array as $call_date_key => $users_that_day) $HTML_output.=""; $HTML_output.="$call_date_key"; $HTML_output.="".count($users_that_day).""; - $HTML_output.="".sprintf("%.1f", (100*count($users_that_day)/$total_distinct_users_per_date))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC(100*count($users_that_day), $total_distinct_users_per_date)))." %"; + $HTML_output.=""; $HTML_output.="\n"; if (!$download_rpt) {echo $HTML_output; ob_flush(); flush(); $HTML_output="";} - $CSV_output["schedule_adherence_per_day"].="\"$call_date_key\",\"".count($users_that_day)."\",\"".sprintf("%.1f", (100*count($users_that_day)/$total_distinct_users_per_date))." %\",\"\"\n"; + $CSV_output["schedule_adherence_per_day"].="\"$call_date_key\",\"".count($users_that_day)."\",\"".sprintf("%.1f", (MathZDC(100*count($users_that_day), $total_distinct_users_per_date)))." %\",\"\"\n"; # print "agents for $call_date_key: ".count($users_that_day)."\n"; @@ -730,6 +737,7 @@ $HTML_output.="\n"; $CSV_output["inclusive_sla_per_day"].="\n"; +$svc_lvl_row=array(); foreach ($calls_array as $call_date_key => $data) { $svc_lvl_stmt="select $SLA_query from vicidial_closer_log where call_date>='$start_date $start_time' and call_date<='$end_date $end_time' and dayname(call_date)='$call_date_key' $and_vicidial_closer_log_SQL and (user!='VDCL')"; # and campaign_id in ($ingroup_str) and user in ('VDCL', $user_str) diff --git a/www/VERM/VERM_HOUR_rpt.inc b/www/VERM/VERM_HOUR_rpt.inc index 7428e715..02b5ea60 100644 --- a/www/VERM/VERM_HOUR_rpt.inc +++ b/www/VERM/VERM_HOUR_rpt.inc @@ -1,11 +1,12 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1620 - First build # 230106-1311 - Added page flushing to show page load progress +# 240801-1130 - Code updates for PHP8 compatibility # # NANQUE, not an unanswered call? @@ -250,17 +251,17 @@ while ($row=mysqli_fetch_array($rslt)) ### These counts are in here because by definition these SHOULD be answers, but you never know with some morons. ### "Real" campaign_id should have been gotten under the direction clause above - if (in_array($status, $sale_array["$campaign_id"]) || in_array($status, $sale_array["SYSTEM"])) + if ((array_key_exists("$campaign_id", $sale_array) && in_array($status, $sale_array["$campaign_id"])) || in_array($status, $sale_array["SYSTEM"])) { $calls_array["$call_date"]["sales"]++; $total_sales++; } - if (in_array($status, $human_ans_array["$campaign_id"]) || in_array($status, $human_ans_array["SYSTEM"])) + if ((array_key_exists("$campaign_id", $human_ans_array) && in_array($status, $human_ans_array["$campaign_id"])) || in_array($status, $human_ans_array["SYSTEM"])) { $calls_array["$call_date"]["human_answered"]++; $total_human_answered++; } - if (in_array($status, $contact_array["$campaign_id"]) || in_array($status, $contact_array["SYSTEM"])) + if ((array_key_exists("$campaign_id", $contact_array) && in_array($status, $contact_array["$campaign_id"])) || in_array($status, $contact_array["SYSTEM"])) { $calls_array["$call_date"]["customer_contacts"]++; $total_customer_contacts++; @@ -291,7 +292,7 @@ while ($row=mysqli_fetch_array($rslt)) # Queue array $queue_array["$call_date"]["total_calls"]++; $queue_array["$call_date"]["total_queue"]+=$queue_position; - $queue_array["$call_date"]["avg_position"]=($queue_array["$call_date"]["total_queue"]/$queue_array["$call_date"]["total_calls"]); + $queue_array["$call_date"]["avg_position"]=MathZDC($queue_array["$call_date"]["total_queue"], $queue_array["$call_date"]["total_calls"]); # Min/max queue if (!$queue_array["$call_date"]["min_queue_position"] || $queue_position<$queue_array["$call_date"]["min_queue_position"]) { @@ -349,21 +350,23 @@ foreach ($answered_calls_array as $call_date_key => $call_date_data) $avg_call_length=round(MathZDC($answered_calls_array["$call_date_key"]["total_length"], $total_date_calls_answered)); $avg_call_length_fmt=($avg_call_length>=3600 ? floor($avg_call_length/3600).":" : "").gmdate("i:s", floor($avg_call_length)); + $answered_calls_array["$call_date_key"]["min_call_length"]+=0; + $answered_calls_array["$call_date_key"]["max_call_length"]+=0; $min_call_length_fmt=($answered_calls_array["$call_date_key"]["min_call_length"]>=3600 ? floor($answered_calls_array["$call_date_key"]["min_call_length"]/3600).":" : "").gmdate("i:s", $answered_calls_array["$call_date_key"]["min_call_length"]); $max_call_length_fmt=($answered_calls_array["$call_date_key"]["max_call_length"]>=3600 ? floor($answered_calls_array["$call_date_key"]["max_call_length"]/3600).":" : "").gmdate("i:s", $answered_calls_array["$call_date_key"]["max_call_length"]); $HTML_output.=""; $HTML_output.="".$call_date_key.""; $HTML_output.="".$total_date_calls_answered.""; - $HTML_output.="".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$total_date_calls_answered), $total_answered_calls)))." %"; + $HTML_output.=""; $HTML_output.="".$avg_call_length_fmt.""; $HTML_output.="".$min_call_length_fmt.""; $HTML_output.="".$max_call_length_fmt.""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["answered_call_distribution"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %\",\"\",\"".$avg_call_length_fmt."\",\"".$min_call_length_fmt."\",\"".$max_call_length_fmt."\",\"\"\n"; + $CSV_output["answered_call_distribution"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", MathZDC((100*$total_date_calls_answered), $total_answered_calls))." %\",\"\",\"".$avg_call_length_fmt."\",\"".$min_call_length_fmt."\",\"".$max_call_length_fmt."\",\"\"\n"; $answered_call_distribution_graph_labels.="\"$call_date_key\","; $answered_call_distribution_graph_data1.="\"$total_date_calls_answered\","; @@ -436,21 +439,23 @@ foreach ($answered_calls_array as $call_date_key => $call_date_data) $avg_wait_time=round(MathZDC($answered_calls_array["$call_date_key"]["total_wait"], $total_date_calls_answered)); $avg_wait_time_fmt=($avg_wait_time>=3600 ? floor($avg_wait_time/3600).":" : "").gmdate("i:s", floor($avg_wait_time)); + $answered_calls_array["$call_date_key"]["min_wait_time"]+=0; + $answered_calls_array["$call_date_key"]["max_wait_time"]+=0; $min_wait_time_fmt=($answered_calls_array["$call_date_key"]["min_wait_time"]>=3600 ? floor($answered_calls_array["$call_date_key"]["min_wait_time"]/3600).":" : "").gmdate("i:s", $answered_calls_array["$call_date_key"]["min_wait_time"]); $max_wait_time_fmt=($answered_calls_array["$call_date_key"]["max_wait_time"]>=3600 ? floor($answered_calls_array["$call_date_key"]["max_wait_time"]/3600).":" : "").gmdate("i:s", $answered_calls_array["$call_date_key"]["max_wait_time"]); $HTML_output.=""; $HTML_output.="".$call_date_key.""; $HTML_output.="".$total_date_calls_answered.""; - $HTML_output.="".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", MathZDC((100*$total_date_calls_answered), $total_answered_calls))." %"; + $HTML_output.=""; $HTML_output.="".$avg_wait_time_fmt.""; $HTML_output.="".$min_wait_time_fmt.""; $HTML_output.="".$max_wait_time_fmt.""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["answered_call_wait_time"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", ((100*$total_date_calls_answered)/$total_answered_calls))." %\",\"\",\"".$avg_wait_time_fmt."\",\"".$min_wait_time_fmt."\",\"".$max_wait_time_fmt."\",\"\"\n"; + $CSV_output["answered_call_wait_time"].="\"".$call_date_key."\",\"".$total_date_calls_answered."\",\"".sprintf("%.1f", MathZDC((100*$total_date_calls_answered), $total_answered_calls))." %\",\"\",\"".$avg_wait_time_fmt."\",\"".$min_wait_time_fmt."\",\"".$max_wait_time_fmt."\",\"\"\n"; $answered_call_wait_time_graph_labels.="\"$call_date_key\","; $answered_call_wait_time_graph_data1.="\"$total_date_calls_answered\","; @@ -525,6 +530,8 @@ foreach ($unanswered_calls_array as $call_date_key => $call_date_data) $avg_wait_time=round(MathZDC($unanswered_calls_array["$call_date_key"]["total_wait"], $total_date_calls_unanswered)); $avg_wait_time_fmt=($avg_wait_time>=3600 ? floor($avg_wait_time/3600).":" : "").gmdate("i:s", floor($avg_wait_time)); + $unanswered_calls_array["$call_date_key"]["min_wait_time"]+=0; + $unanswered_calls_array["$call_date_key"]["max_wait_time"]+=0; $min_wait_time_fmt=($unanswered_calls_array["$call_date_key"]["min_wait_time"]>=3600 ? floor($unanswered_calls_array["$call_date_key"]["min_wait_time"]/3600).":" : "").gmdate("i:s", $unanswered_calls_array["$call_date_key"]["min_wait_time"]); $max_wait_time_fmt=($unanswered_calls_array["$call_date_key"]["max_wait_time"]>=3600 ? floor($unanswered_calls_array["$call_date_key"]["max_wait_time"]/3600).":" : "").gmdate("i:s", $unanswered_calls_array["$call_date_key"]["max_wait_time"]); @@ -589,8 +596,8 @@ $HTML_output.="\n"; $CSV_output["sales_per_day"]="\""._QXZ("Day")."\",\""._QXZ("Human ans. conv")."\",\""._QXZ("Customer cont. conv")."\",\""._QXZ("Sales")."\",\"\",\"\",\""._QXZ("Human answers")."\",\""._QXZ("Customer contacts")."\",\"\",\"\"\n"; #print_r($calls_array); -$max_day_sales=max(array_column($calls_array, 'sales')); -$max_day_customer_contacts=max(array_column($calls_array, 'customer_contacts')); +$max_day_sales=(count(array_column($calls_array, 'sales'))>0 ? max(array_column($calls_array, 'sales')) : 0); +$max_day_customer_contacts=(count(array_column($calls_array, 'customer_contacts'))>0 ? max(array_column($calls_array, 'customer_contacts')) : 0); #print "
$max_day_sales
\n"; foreach ($calls_array as $call_date_key => $data) { @@ -637,17 +644,17 @@ $HTML_output.="\n"; ### Removed Coverage column before Steps 5/19/22 - not needed $CSV_output["queue_length_per_day"]="\""._QXZ("Day")."\",\""._QXZ("Avg")."\",\"...\",\""._QXZ("Min")."\",\""._QXZ("Max")."\",\"...\",\""._QXZ("Average Sum of Queue Positions Per Hour")."\"\n"; -$max_call_position=max(array_column($queue_array, 'max_queue_position')); -$max_avg_position=max(array_column($queue_array, 'avg_position')); +$max_call_position=(count(array_column($queue_array, 'max_queue_position'))>0 ? max(array_column($queue_array, 'max_queue_position')) : 0); +$max_avg_position=(count(array_column($queue_array, 'avg_position'))>0 ? max(array_column($queue_array, 'avg_position')) : 0); foreach ($queue_array as $call_date_key => $data) { $HTML_output.=""; $HTML_output.="$call_date_key"; $HTML_output.="".sprintf("%.1f", $queue_array["$call_date_key"]["avg_position"]).""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.="".$queue_array["$call_date_key"]["min_queue_position"].""; $HTML_output.="".$queue_array["$call_date_key"]["max_queue_position"].""; - $HTML_output.=""; + $HTML_output.=""; ### $HTML_output.="100% **"; $HTML_output.="".sprintf("%.1f", $queue_array["$call_date_key"]["total_queue"]/24).""; # Always seems to be 24 hours for the date - even when I ran starting at 8am. $HTML_output.="\n"; @@ -682,13 +689,13 @@ foreach ($user_array as $call_date_key => $users_that_day) $HTML_output.=""; $HTML_output.="$call_date_key"; $HTML_output.="".count($users_that_day).""; - $HTML_output.="".sprintf("%.1f", (100*count($users_that_day)/$total_distinct_users_per_date))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC(100*count($users_that_day), $total_distinct_users_per_date)))." %"; + $HTML_output.=""; $HTML_output.="\n"; if (!$download_rpt) {echo $HTML_output; ob_flush(); flush(); $HTML_output="";} - $CSV_output["schedule_adherence_per_day"].="\"$call_date_key\",\"".count($users_that_day)."\",\"".sprintf("%.1f", (100*count($users_that_day)/$total_distinct_users_per_date))." %\",\"\"\n"; + $CSV_output["schedule_adherence_per_day"].="\"$call_date_key\",\"".count($users_that_day)."\",\"".sprintf("%.1f", MathZDC(100*count($users_that_day), $total_distinct_users_per_date))." %\",\"\"\n"; # print "agents for $call_date_key: ".count($users_that_day)."\n"; @@ -781,7 +788,7 @@ foreach ($calls_array as $call_date_key => $data) } $HTML_output.=""; # $HTML_output.=""._QXZ("Export as")."...CSV"; -$HTML_output.=""._QXZ("Export as")."..."; +$HTML_output.=""._QXZ("Export as")."..."; $HTML_output.=""; $HTML_output.=""; diff --git a/www/VERM/VERM_IVR_rpt.inc b/www/VERM/VERM_IVR_rpt.inc index 40bb8a84..4db33bbc 100644 --- a/www/VERM/VERM_IVR_rpt.inc +++ b/www/VERM/VERM_IVR_rpt.inc @@ -1,11 +1,12 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1619 - First build # 230106-1328 - Added page flushing to show page load progress +# 240801-1130 - Code updates for PHP8 compatibility # if (isset($_GET["page_no"])) {$page_no=$_GET["page_no"];} @@ -262,14 +263,14 @@ foreach ($ivr_data as $ivr_path => $data) $HTML_output.="".$ivr_value.""; $HTML_output.="".$data["calls"].""; $HTML_output.="".$data["goals"].""; - $HTML_output.="".sprintf("%.1f", (100*($data["calls"]-$data["hangups"])/$data["calls"]))." %"; + $HTML_output.="".sprintf("%.1f", (MathZDC(100*($data["calls"]-$data["hangups"]), $data["calls"])))." %"; $HTML_output.="".$data["hangups"].""; - $HTML_output.="".sprintf("%.1f", (100*$data["hangups"]/$data["calls"]))." %"; + $HTML_output.="".sprintf("%.1f", (MathZDC(100*$data["hangups"], $data["calls"])))." %"; $HTML_output.="\n"; if (!$download_rpt) {echo $HTML_output; ob_flush(); flush(); $HTML_output="";} - $CSV_output["ivr_traversal"].="\"".$CSV_ivr_value."\",\"".$data["calls"]."\",\"".($data["calls"]-$data["hangups"])."\",\"".sprintf("%.1f", (100*($data["calls"]-$data["hangups"])/$data["calls"]))." %\",\"".$data["hangups"]."\",\"".sprintf("%.1f", (100*$data["hangups"]/$data["calls"]))." %\"\n"; + $CSV_output["ivr_traversal"].="\"".$CSV_ivr_value."\",\"".$data["calls"]."\",\"".($data["calls"]-$data["hangups"])."\",\"".sprintf("%.1f", (MathZDC(100*($data["calls"]-$data["hangups"]), $data["calls"])))." %\",\"".$data["hangups"]."\",\"".sprintf("%.1f", (MathZDC(100*$data["hangups"], $data["calls"])))." %\"\n"; if(preg_match('/\-TOTAL$/', $ivr_path)) {unset($ivr_data["$ivr_path"]);} # Remove total, don't need anymore } @@ -317,9 +318,9 @@ foreach ($ivr_data as $comment_d => $data) if ($prev_base_path!=$base_path) { # Calculate totals for base path - $total_success_rate=sprintf("%.1f", (100*(($total_prompt_calls-$total_prompt_hangups)/$total_prompt_calls))); - $total_hangup_rate=sprintf("%.1f", (100*($total_prompt_hangups/$total_prompt_calls))); - $total_average_sec=round($total_prompt_time/$total_prompt_calls); + $total_success_rate=sprintf("%.1f", (100*MathZDC(($total_prompt_calls-$total_prompt_hangups), $total_prompt_calls))); + $total_hangup_rate=sprintf("%.1f", (100*MathZDC($total_prompt_hangups, $total_prompt_calls))); + $total_average_sec=round(MathZDC($total_prompt_time, $total_prompt_calls)); $base_average_time=($total_average_sec>=3600 ? intval(floor($total_average_sec/3600)).date(":i:s", $total_average_sec) : intval(date("i", $total_average_sec)).":".date("s", $total_average_sec)); $base_total_time=($total_prompt_time>=3600 ? intval(floor($total_prompt_time/3600)).date(":i:s", $total_prompt_time) : intval(date("i", $total_prompt_time)).":".date("s", $total_prompt_time)); $base_minimum_time=($total_minimum_time>=3600 ? intval(floor($total_minimum_time/3600)).date(":i:s", $total_minimum_time) : intval(date("i", $total_minimum_time)).":".date("s", $total_minimum_time)); @@ -359,14 +360,14 @@ foreach ($ivr_data as $comment_d => $data) $total_maximum_time=0; } - $average_sec=round($data["time"]/$data["calls"]); + $average_sec=round(MathZDC($data["time"], $data["calls"])); $average_time=($average_sec>=3600 ? intval(floor($average_sec/3600)).date(":i:s", $average_sec) : intval(date("i", $average_sec)).":".date("s", $average_sec)); $total_time=($data["time"]>=3600 ? intval(floor($data["time"]/3600)).date(":i:s", $data["time"]) : intval(date("i", $data["time"])).":".date("s", $data["time"])); $minimum_time=($data["minimum_time"]>=3600 ? intval(floor($data["minimum_time"]/3600)).date(":i:s", $data["minimum_time"]) : intval(date("i", $data["minimum_time"])).":".date("s", $data["minimum_time"])); $maximum_time=($data["maximum_time"]>=3600 ? intval(floor($data["maximum_time"]/3600)).date(":i:s", $data["maximum_time"]) : intval(date("i", $data["maximum_time"])).":".date("s", $data["maximum_time"])); - $success_rate=sprintf("%.1f", (100*(($data["calls"]-$data["hangups"])/$data["calls"]))); - $hangup_rate=sprintf("%.1f", (100*($data["hangups"]/$data["calls"]))); + $success_rate=sprintf("%.1f", (100*(MathZDC(($data["calls"]-$data["hangups"]), $data["calls"])))); + $hangup_rate=sprintf("%.1f", (100*(MathZDC($data["hangups"], $data["calls"])))); #$traversal_outputs.=" - $selection -> ".$data["calls"].", ".($data["calls"]-$data["hangups"]).", $success_rate %, ".$data["hangups"].", $hangup_rate % \n"; #$CSV_time_outputs.=" - $selection -> ".$data["calls"].", $average_time, $total_time, $minimum_time, $maximum_time\n"; $HTML_datarows.=" #  $selection".$data["calls"]."$average_time$total_time$minimum_time$maximum_time\n"; @@ -382,7 +383,7 @@ foreach ($ivr_data as $comment_d => $data) } } -$total_average_sec=round($total_prompt_time/$total_prompt_calls); +$total_average_sec=round(MathZDC($total_prompt_time, $total_prompt_calls)); $base_average_time=($total_average_sec>=3600 ? intval(floor($total_average_sec/3600)).date(":i:s", $total_average_sec) : intval(date("i", $total_average_sec)).":".date("s", $total_average_sec)); $base_total_time=($total_prompt_time>=3600 ? intval(floor($total_prompt_time/3600)).date(":i:s", $total_prompt_time) : intval(date("i", $total_prompt_time)).":".date("s", $total_prompt_time)); $base_minimum_time=($total_minimum_time>=3600 ? intval(floor($total_minimum_time/3600)).date(":i:s", $total_minimum_time) : intval(date("i", $total_minimum_time)).":".date("s", $total_minimum_time)); @@ -449,7 +450,7 @@ foreach ($path_data as $goal => $path) $final_key_path=preg_replace('/ \=\> $/', "", $final_key_path); $CSV_final_key_path=$final_key_path; - $average_sec=round($data["time"]/$data["calls"]); + $average_sec=round(MathZDC($data["time"], $data["calls"])); $average_time=($average_sec>=3600 ? intval(floor($average_sec/3600)).date(":i:s", $average_sec) : intval(date("i", $average_sec)).":".date("s", $average_sec)); $minimum_time=($data["minimum_time"]>=3600 ? intval(floor($data["minimum_time"]/3600)).date(":i:s", $data["minimum_time"]) : intval(date("i", $data["minimum_time"])).":".date("s", $data["minimum_time"])); $maximum_time=($data["maximum_time"]>=3600 ? intval(floor($data["maximum_time"]/3600)).date(":i:s", $data["maximum_time"]) : intval(date("i", $data["maximum_time"])).":".date("s", $data["maximum_time"])); @@ -621,7 +622,7 @@ $HTML_output.="\n"; + $call_outcome=$status; + } + # JCJ 12/6/22 - added for overriding certain statuses + if (array_key_exists($status, $outcome_status_overrides)) + { + $call_outcome=$outcome_status_overrides["$status"]; + $status=$call_outcome; + } + # JCJ 12/6/22 - added for removing certain statuses that should basically be lagged in certain conditions + # 1/27/23 - changed $outcome_lagged_status_overrides to normal array instead of associative + else if (in_array($status, $outcome_lagged_status_overrides) && strlen($uniqueid)<1) { $status="LAGGED"; $call_outcome=""; } - else + /* JCJ 12/6/22 - commented out, may be useful later + # 1/27/23 - changed $outcome_lagged_status_overrides to normal array instead of associative, below section won't work now + else if (array_key_exists($status, $outcome_lagged_status_overrides)) { - $status=$call_outcome; + # print_r($outcome_lagged_status_overrides); + # $HTML_output.="\n"; } - # $HTML_output.="*** $uniqueid, $call_outcome, $status //-->\n"; - } -*/ + */ - if ($status_names["$status"] && !in_array($status, $unknown_network_statuses)) - { - $call_outcome=$status_names["$status"]; - - $call_type="Known"; - } - else if (in_array($status, $unknown_network_statuses) || strlen($call_outcome)<=1) - { - # $call_outcome.=" (unknown)"; - $call_outcome="Network/LAGGED"; - } - else - { - $call_outcome.=" (unknown)"; # commented out 10/13, uncommented 11/2 (known_outcome_stauses not working as they expect) - } - - if (strlen($call_outcome)<=1) - { - $call_type="None"; - } - -/* Added 10/13, removed 11/2 - known_outcome_statuses not having desired effect - if (in_array($status, $selectable_array["$campaign_id"]) || in_array($status, $selectable_array["SYSTEM"]) || in_array($status, $known_outcome_statuses)) - { - $outcomes_array["selected"]++; - - $agent_details_array["$full_name"]["selected"]++; - - $call_type="Known"; - } - else - { - $status="---"; - $call_type="System/Auto"; - $call_outcome="(unknown)"; - } -*/ - - # Human answered (contact) - if (in_array($status, $human_ans_array["$campaign_id"]) || in_array($status, $human_ans_array["SYSTEM"])) - { - $outcomes_array["human_answered"]++; - - $agent_details_array["$full_name"]["human_answered"]++; - - $call_type="Human answered"; - } - - # Customer contact (qualified contact) - if (in_array($status, $contact_array["$campaign_id"]) || in_array($status, $contact_array["SYSTEM"])) - { - $outcomes_array["customer_contacts"]++; - - $agent_details_array["$full_name"]["customer_contacts"]++; - - $call_type="Customer contact"; - } - - # Sales - if (in_array($status, $sale_array["$campaign_id"]) || in_array($status, $sale_array["SYSTEM"])) - { - $outcomes_array["sales"]++; - - $agent_details_array["$full_name"]["sales"]++; - - $call_type="Sale"; - } - - if (!$call_types_array["$call_outcome"]) {$call_types_array["$call_outcome"]=$call_type;} - - # Only count results if this is an agent log record with a lead id, i.e. an actual call - if (strlen($lead_id)>0) - { - $call_results_array["$call_outcome"]["total"]++; - $call_results_total_calls++; - - if (in_array($status, $lost_statuses_array)) + if ($status_names["$status"] && !in_array($status, $unknown_network_statuses)) { - $call_results_array["$call_outcome"]["lost"]++; - $call_results_array["$call_outcome"]["taken"]+=0; + $call_outcome=$status_names["$status"]; + + $call_type="Known"; + } + else if (in_array($status, $unknown_network_statuses) || strlen($call_outcome)<=1) + { + # $call_outcome.=" (unknown)"; + $call_outcome="Network/LAGGED"; } else { - $call_results_array["$call_outcome"]["lost"]+=0; - $call_results_array["$call_outcome"]["taken"]++; + $call_outcome.=" (unknown)"; # commented out 10/13, uncommented 11/2 (known_outcome_stauses not working as they expect) } - $call_results_array["$call_outcome"]["call_type"]=$call_type; - # $outcomes_per_agent_array["$full_name"]["$call_type"]["$call_outcome"]["$status"]++; # + if (strlen($call_outcome)<=1) + { + $call_type="None"; + } - $opa_key="$full_name|$call_type|$call_outcome|$status"; - $outcomes_per_agent_array["$opa_key"]++; + /* Added 10/13, removed 11/2 - known_outcome_statuses not having desired effect + if (in_array($status, $selectable_array["$campaign_id"]) || in_array($status, $selectable_array["SYSTEM"]) || in_array($status, $known_outcome_statuses)) + { + $outcomes_array["selected"]++; - # $outcomes_per_agent_array_agents["$full_name"]++; # - # $outcomes_per_agent_array_types["$call_type"]++; # - # $outcomes_per_agent_array_outcomes["$call_outcome"]++; # - # $outcomes_per_agent_array_statuses["$full_name"]++; # + $agent_details_array["$full_name"]["selected"]++; + + $call_type="Known"; + } + else + { + $status="---"; + $call_type="System/Auto"; + $call_outcome="(unknown)"; + } + */ + + # Human answered (contact) + if (in_array($status, $human_ans_array["$campaign_id"]) || in_array($status, $human_ans_array["SYSTEM"])) + { + $outcomes_array["human_answered"]++; + + $agent_details_array["$full_name"]["human_answered"]++; + + $call_type="Human answered"; + } + + # Customer contact (qualified contact) + if (in_array($status, $contact_array["$campaign_id"]) || in_array($status, $contact_array["SYSTEM"])) + { + $outcomes_array["customer_contacts"]++; + + $agent_details_array["$full_name"]["customer_contacts"]++; + + $call_type="Customer contact"; + } + + # Sales + if (in_array($status, $sale_array["$campaign_id"]) || in_array($status, $sale_array["SYSTEM"])) + { + $outcomes_array["sales"]++; + + $agent_details_array["$full_name"]["sales"]++; + + $call_type="Sale"; + } + + if (!$call_types_array["$call_outcome"]) {$call_types_array["$call_outcome"]=$call_type;} + + # Only count results if this is an agent log record with a lead id, i.e. an actual call + if (strlen($lead_id)>0) + { + $call_results_array["$call_outcome"]["total"]++; + $call_results_total_calls++; + + if (in_array($status, $lost_statuses_array)) + { + $call_results_array["$call_outcome"]["lost"]++; + $call_results_array["$call_outcome"]["taken"]+=0; + } + else + { + $call_results_array["$call_outcome"]["lost"]+=0; + $call_results_array["$call_outcome"]["taken"]++; + } + $call_results_array["$call_outcome"]["call_type"]=$call_type; + + # $outcomes_per_agent_array["$full_name"]["$call_type"]["$call_outcome"]["$status"]++; # + + $opa_key="$full_name|$call_type|$call_outcome|$status"; + $outcomes_per_agent_array["$opa_key"]++; + + # $outcomes_per_agent_array_agents["$full_name"]++; # + # $outcomes_per_agent_array_types["$call_type"]++; # + # $outcomes_per_agent_array_outcomes["$call_outcome"]++; # + # $outcomes_per_agent_array_statuses["$full_name"]++; # + } } } @@ -415,8 +420,8 @@ $max_call_results_total_pct=0; $max_call_results_taken_pct=0; foreach ($call_results_array as $outcome => $data) { - $call_results_array["$outcome"]["total_pct"]=sprintf("%.1f", 100*($data["total"]/$call_results_total_calls)); - $call_results_array["$outcome"]["taken_pct"]=sprintf("%.1f", 100*($data["taken"]/$call_results_total_calls)); + $call_results_array["$outcome"]["total_pct"]=sprintf("%.1f", 100*(MathZDC($data["total"], $call_results_total_calls))); + $call_results_array["$outcome"]["taken_pct"]=sprintf("%.1f", 100*(MathZDC($data["taken"], $call_results_total_calls))); if ($max_call_results_total_pct<$call_results_array["$outcome"]["total_pct"]) {$max_call_results_total_pct=$call_results_array["$outcome"]["total_pct"];} if ($max_call_results_taken_pct<$call_results_array["$outcome"]["taken_pct"]) {$max_call_results_taken_pct=$call_results_array["$outcome"]["taken_pct"];} } @@ -425,7 +430,7 @@ $max_billable_activities_total_time=0; $billable_activities_grand_total_time=0; foreach ($billable_activities_array as $pause_code => $data) { - $billable_activities_array["$pause_code"]["avg"]=round($data["total_time"]/$data["n_times"]); + $billable_activities_array["$pause_code"]["avg"]=round(MathZDC($data["total_time"], $data["n_times"])); if ($max_billable_activities_total_time<$data["total_time"]) {$max_billable_activities_total_time=$data["total_time"];} $billable_activities_grand_total_time+=$data["total_time"]; } @@ -434,7 +439,7 @@ $max_nonbillable_activities_total_time=0; $nonbillable_activities_grand_total_time=0; foreach ($nonbillable_activities_array as $pause_code => $data) { - $nonbillable_activities_array["$pause_code"]["avg"]=round($data["total_time"]/$data["n_times"]); + $nonbillable_activities_array["$pause_code"]["avg"]=round(MathZDC($data["total_time"], $data["n_times"])); if ($max_nonbillable_activities_total_time<$data["total_time"]) {$max_nonbillable_activities_total_time=$data["total_time"];} $nonbillable_activities_grand_total_time+=$data["total_time"]; } @@ -443,8 +448,8 @@ foreach ($nonbillable_activities_array as $pause_code => $data) $sph=sprintf("%.1f", MathZDC($outcomes_array["sales"], ($outcomes_array["total_billable_time"] / 3600))); $ccph=sprintf("%.1f", MathZDC($outcomes_array["customer_contacts"], ($outcomes_array["total_billable_time"] / 3600))); $haph=sprintf("%.1f", MathZDC($outcomes_array["human_answered"], ($outcomes_array["total_billable_time"] / 3600))); -$ha_conv_index=sprintf("%.1f", 100*($outcomes_array["sales"]/$outcomes_array["customer_contacts"])); -$cc_conv_index=sprintf("%.1f", 100*($outcomes_array["sales"]/$outcomes_array["human_answered"])); +$ha_conv_index=sprintf("%.1f", 100*(MathZDC($outcomes_array["sales"], $outcomes_array["customer_contacts"]))); +$cc_conv_index=sprintf("%.1f", 100*(MathZDC($outcomes_array["sales"], $outcomes_array["human_answered"]))); $HTML_output.="

"._QXZ("Statuses").":$NWB#VERM_OUTCOMES-outcomes$NWE

"; $HTML_output.="
"; @@ -509,7 +514,7 @@ if ($sort_call_results=="outcomes desc") { krsort($call_results_array); } -else +else if(!preg_match('/^outcomes/', $sort_call_results)) { if ($sort_cr_index) { @@ -566,9 +571,9 @@ foreach ($call_results_array as $outcome => $data) $HTML_output.="".$data["taken"].""; $HTML_output.="".$data["lost"].""; $HTML_output.="".$data["total_pct"]." %"; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.="".$data["taken_pct"]." %"; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; $HTML_output.="\n"; @@ -605,7 +610,7 @@ if ($sort_billable_activities=="activity desc") { krsort($billable_activities_array); } -else +else if (!preg_match('/^activity/', $sort_billable_activities)) { if ($sort_ba_index) { @@ -649,7 +654,7 @@ $CSV_output["billable_activities"]="\""._QXZ("Activity")."\",\""._QXZ("N. Times" foreach ($billable_activities_array as $pause_code => $data) { - $pct=sprintf("%.1f", ((100*$data["total_time"])/$billable_activities_grand_total_time)); + $pct=sprintf("%.1f", (MathZDC((100*$data["total_time"]), $billable_activities_grand_total_time))); $HTML_output.=""; $HTML_output.="".$pause_code.""; @@ -695,7 +700,7 @@ if ($sort_nonbillable_activities=="activity desc") { krsort($nonbillable_activities_array); } -else +else if (!preg_match('/^activity/', $sort_nonbillable_activities)) { if ($sort_nba_index) { @@ -738,7 +743,7 @@ $CSV_output["nonbillable_activities"]="\""._QXZ("Activity")."\",\""._QXZ("N. Tim foreach ($nonbillable_activities_array as $pause_code => $data) { - $pct=sprintf("%.1f", ((100*$data["total_time"])/$nonbillable_activities_grand_total_time)); + $pct=sprintf("%.1f", (MathZDC((100*$data["total_time"]), $nonbillable_activities_grand_total_time))); $HTML_output.=""; $HTML_output.="".$pause_code.""; @@ -759,7 +764,7 @@ $HTML_output.=""; $HTML_output.=""._QXZ("Export as")."..."; $HTML_output.=""; $HTML_output.=""; -$HTML_output.=""; +$HTML_output.=""; if (!$download_rpt) {echo $HTML_output; ob_flush(); flush(); $HTML_output="";} ############################### @@ -794,16 +799,16 @@ foreach($agent_details_array as $agent_name => $data) $billable_seconds=($data["available"]+$data["billable"]); $billable_hours=$billable_seconds/3600; - $av_pct=sprintf("%.1f", (100*($data["available"]/$billable_seconds))); - $b_pct=sprintf("%.1f", (100*($data["billable"]/$billable_seconds))); + $av_pct=sprintf("%.1f", (100*(MathZDC($data["available"], $billable_seconds)))); + $b_pct=sprintf("%.1f", (100*(MathZDC($data["billable"], $billable_seconds)))); # ??? - Not sure of the logic below, but whatever. $ha_conv_pct=sprintf("%.1f", (100*MathZDC($data["sales"], $data["human_answered"], 0))); $cc_conv_pct=sprintf("%.1f", (100*MathZDC($data["sales"], $data["customer_contacts"], 0))); - $nb_pct=sprintf("%.1f", (100*($data["nonbillable"]/$billable_seconds))); - $sph=sprintf("%.1f", ($data["sales"]/$billable_hours)); - $ccph=sprintf("%.1f", ($data["customer_contacts"]/$billable_hours)); - $haph=sprintf("%.1f", ($data["human_answered"]/$billable_hours)); + $nb_pct=sprintf("%.1f", (100*(MathZDC($data["nonbillable"], $billable_seconds)))); + $sph=sprintf("%.1f", (MathZDC($data["sales"], $billable_hours))); + $ccph=sprintf("%.1f", (MathZDC($data["customer_contacts"], $billable_hours))); + $haph=sprintf("%.1f", (MathZDC($data["human_answered"], $billable_hours))); $HTML_output.=""; $HTML_output.="".$agent_name.""; @@ -928,7 +933,7 @@ foreach($final_opa_array as $key => $row) $HTML_output.="".$row["outcome"].""; $HTML_output.="".$row["type"].""; $HTML_output.="".$row["total"].""; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.="\n"; $CSV_output["agent_outcomes"].="\"$row[agent]\",\"$row[status]\",\"$row[outcome]\",\"$row[type]\",\"$row[total]\"\n"; diff --git a/www/VERM/VERM_STATS_rpt.inc b/www/VERM/VERM_STATS_rpt.inc index f0c3ce72..81fbdb80 100644 --- a/www/VERM/VERM_STATS_rpt.inc +++ b/www/VERM/VERM_STATS_rpt.inc @@ -1,10 +1,11 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1616 - First build +# 240801-1130 - Code updates for PHP8 compatibility # # DROP, WAITTO, TIMEOT are unanswered statuses, not NANQUE @@ -367,7 +368,7 @@ $HTML_output.="\n"; $CSV_output["agents_on_queue"]="\""._QXZ("Agents on queue")."\"\n"; $CSV_output["agents_on_queue"].="\""._QXZ("Agent")."\",\""._QXZ("N. Calls")."\",\"\",\"...\",\""._QXZ("Total call time")."\",\""._QXZ("Average call time")."\"\n"; -$highest_agent_call_count=max($agent_call_counts); +$highest_agent_call_count=(count($agent_call_counts)>0 ? max($agent_call_counts) : 0); $agents_on_queue_graph_labels="["; $agents_on_queue_graph_data="["; @@ -524,7 +525,7 @@ $disconnection_causes_graph_data="["; $disconnection_causes_graph_bgcolor="["; # SAME FOR hoverBackgroundColor $disconnection_causes_graph_hovborder="["; -$max_term_reason=max($term_reasons); +$max_term_reason=(count($term_reasons)>0 ? max($term_reasons) : 0); $x=0; foreach ($term_reasons as $reason => $value) { diff --git a/www/VERM/VERM_UNANSWERED_rpt.inc b/www/VERM/VERM_UNANSWERED_rpt.inc index 31dceb0d..4c971497 100644 --- a/www/VERM/VERM_UNANSWERED_rpt.inc +++ b/www/VERM/VERM_UNANSWERED_rpt.inc @@ -1,11 +1,12 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1614 - First build # 230106-1506 - Uniqueid array modification to speed up page loading, added page flushing +# 240801-1130 - Code updates for PHP8 compatibility # if (isset($_GET["sort_agents_on_queue"])) {$sort_agents_on_queue=$_GET["sort_agents_on_queue"];} @@ -62,6 +63,7 @@ $max_unanswered_position=0; $min_unanswered_position=1000000; $unanswered_queue_stats=array(); # campaign id breakdown BY UNANSWERED CALLS $unanswered_term_reasons=array(); # UNANSWERED CALLS ONLY +$unanswered_calls_by_agent=array(); $unanswered_call_directions=array(); # UNANSWERED CALLS $unanswered_call_stints=array(); # UNANSWERED CALLS $unanswered_agent_events=array(); # UNANSWERED CALLS @@ -687,7 +689,7 @@ $disconnection_causes_graph_data="["; $disconnection_causes_graph_bgcolor="["; # SAME FOR hoverBackgroundColor $disconnection_causes_graph_hovborder="["; -$max_term_reason=max($unanswered_term_reasons); +$max_term_reason=(count($unanswered_term_reasons)>0 ? max($unanswered_term_reasons) : 0); $x=0; foreach ($unanswered_term_reasons as $reason => $value) { @@ -787,7 +789,7 @@ $unanswered_calls_by_queue_graph_data="["; $unanswered_calls_by_queue_graph_bgcolor="["; # SAME FOR hoverBackgroundColor $unanswered_calls_by_queue_graph_hovborder="["; -$max_queue_count=max($unanswered_queue_stats); +$max_queue_count=(count($unanswered_queue_stats)>0 ? max($unanswered_queue_stats) : 0); ksort($unanswered_queue_stats); $x=0; foreach ($unanswered_queue_stats as $queue => $value) @@ -842,7 +844,7 @@ $HTML_output.=""; $CSV_output["unanswered_calls_by_agent"]="\""._QXZ("Unanswered calls, by agent").":\"\n"; $CSV_output["unanswered_calls_by_agent"].="\"\",\""._QXZ("Campaign/ingroup")."\",\""._QXZ("N. Calls")."\",\"\",\"...\"\n"; -$max_queue_count=max($unanswered_calls_by_agent); +$max_queue_count=(count($unanswered_calls_by_agent)>0 ? max($unanswered_calls_by_agent) : 0); ksort($unanswered_calls_by_agent); $x=0; foreach ($unanswered_calls_by_agent as $user => $value) @@ -916,18 +918,18 @@ foreach($svc_lvl_row as $interval => $sum) $HTML_output.="$int_name "._QXZ("seconds").":"; $HTML_output.="".$sum.""; $HTML_output.="$delta  "; - $HTML_output.="".sprintf("%.1f", ((100*$sum)/$unanswered_inbound_calls))." %"; - $HTML_output.="".sprintf("%.1f", ((100*$sum)/$total_unanswered_calls))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$sum), $unanswered_inbound_calls)))." %"; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$sum), $total_unanswered_calls)))." %"; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["unanswered_calls_by_distribution"].="\"$int_name seconds:\",\"$sum\",\"$delta\",\"".sprintf("%.1f", ((100*$sum)/$unanswered_inbound_calls))." %\",\"".sprintf("%.1f", ((100*$sum)/$total_inbound_calls))." %\"\n"; + $CSV_output["unanswered_calls_by_distribution"].="\"$int_name seconds:\",\"$sum\",\"$delta\",\"".sprintf("%.1f", (MathZDC((100*$sum), $unanswered_inbound_calls)))." %\",\"".sprintf("%.1f", (MathZDC((100*$sum), $total_inbound_calls)))." %\"\n"; $unanswered_calls_by_distribution_graph_labels.="\"$int_name\","; $unanswered_calls_by_distribution_graph_delta_data.="\"".($prev_int || $x>0 ? ($sum-$prev_int) : "0")."\","; $unanswered_calls_by_distribution_graph_delta_bgcolor.="\"#33CCCC\","; $unanswered_calls_by_distribution_graph_delta_hovborder.="\"#66FFFF\","; - $unanswered_calls_by_distribution_graph_percent_data.="\"".sprintf("%.1f", ((100*$sum)/$unanswered_inbound_calls))."\","; + $unanswered_calls_by_distribution_graph_percent_data.="\"".sprintf("%.1f", (MathZDC((100*$sum), $unanswered_inbound_calls)))."\","; $unanswered_calls_by_distribution_graph_percent_bgcolor.="\"#FFCC66\","; $unanswered_calls_by_distribution_graph_percent_hovborder.="\"#FFFF99\","; @@ -998,17 +1000,17 @@ foreach($svc_lvl_row as $interval => $sum) $HTML_output.="$int_name "._QXZ("seconds").":"; $HTML_output.="".$sum.""; $HTML_output.="$delta  "; - $HTML_output.="".sprintf("%.1f", ((100*$sum)/$total_inbound_calls))." %"; - $HTML_output.=""; + $HTML_output.="".sprintf("%.1f", (MathZDC((100*$sum), $total_inbound_calls)))." %"; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["service_level_agreement"].="\"$int_name seconds:\",\"$sum\",\"$delta\",\"".sprintf("%.1f", ((100*$sum)/$total_inbound_calls))." %\"\n"; + $CSV_output["service_level_agreement"].="\"$int_name seconds:\",\"$sum\",\"$delta\",\"".sprintf("%.1f", (MathZDC((100*$sum), $total_inbound_calls)))." %\"\n"; $service_level_agreement_graph_labels.="\"$int_name\","; $service_level_agreement_graph_delta_data.="\"".($prev_int ? ($sum-$prev_int) : "0")."\","; $service_level_agreement_graph_delta_bgcolor.="\"#33CCCC\","; $service_level_agreement_graph_delta_hovborder.="\"#66FFFF\","; - $service_level_agreement_graph_percent_data.="\"".sprintf("%.1f", ((100*$sum)/$total_inbound_calls))."\","; + $service_level_agreement_graph_percent_data.="\"".sprintf("%.1f", (MathZDC((100*$sum), $total_inbound_calls)))."\","; $service_level_agreement_graph_percent_bgcolor.="\"#FFCC66\","; $service_level_agreement_graph_percent_hovborder.="\"#FFFF99\","; @@ -1053,6 +1055,7 @@ $CSV_output["unanswered_calls_by_keypress"].="\""._QXZ("Key")."\",\""._QXZ("N. C $keypress_stmt="select extension, count(*) as ct From live_inbound_log where uniqueid in ('".implode("', '", $unans_uniqueid_array)."') and extension not in ('s', 'i', 't') and comment_a='CALLMENU' group by extension order by extension"; if ($DB) {$HTML_output.="$keypress_stmt";} $keypress_rslt=mysql_to_mysqli($keypress_stmt, $link); +$kp_array=array(); while ($kp_row=mysqli_fetch_array($keypress_rslt)) { $kp_array["$kp_row[extension]"]+=$kp_row["ct"]; @@ -1206,16 +1209,16 @@ $queue_position_graph_data="["; $queue_position_graph_bgcolor="["; # SAME FOR hoverBackgroundColor $queue_position_graph_hovborder="["; -$max_queue_count=max($unanswered_queue_positions); +$max_queue_count=(count($unanswered_queue_positions)>0 ? max($unanswered_queue_positions) : 0); $x=0; foreach ($unanswered_queue_positions as $position => $value) { - $position_pct=sprintf("%.1f", (100*$value)/$total_unanswered_calls); + $position_pct=sprintf("%.1f", MathZDC((100*$value), $total_unanswered_calls)); $HTML_output.=""; $HTML_output.="".$position.""; $HTML_output.="".$value.""; $HTML_output.="".$position_pct." %"; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; $CSV_output["queue_position"].="\"".$position."\",\"".$value."\",\"".$position_pct." %\",\"\"\n"; @@ -1270,16 +1273,16 @@ $queue_position_all_calls_graph_bgcolor="["; # SAME FOR hoverBackgroundColor $queue_position_all_calls_graph_hovborder="["; ksort($queue_positions); -$max_queue_count=max($queue_positions); +$max_queue_count=(count($queue_positions)>0 ? max($queue_positions) : 0); $x=0; foreach ($queue_positions as $position => $value) { - $position_pct=sprintf("%.1f", (100*$value)/$total_calls); + $position_pct=sprintf("%.1f", MathZDC((100*$value), $total_calls)); $HTML_output.=""; $HTML_output.="".$position.""; $HTML_output.="".$value.""; $HTML_output.="".$position_pct." %"; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; $CSV_output["queue_position_all_calls_all_calls"].="\"".$position."\",\"".$value."\",\"".$position_pct." %\",\"\"\n"; @@ -1384,9 +1387,9 @@ if ($ivr_path!="") if ($ivr_paths["$ivr_path"][3]<$ivr_call_time) {$ivr_paths["$ivr_path"][3]=$ivr_call_time;} } -$max_ivr_count=max($ivr_counts); +$max_ivr_count=(count($ivr_counts)>0 ? max($ivr_counts) : 0); if ($max_ivr_count<$untracked_calls) {$max_ivr_count=$untracked_calls;} -$untracked_ivr_pct=sprintf("%.1f", (100*$untracked_calls)/$total_unanswered_calls); +$untracked_ivr_pct=sprintf("%.1f", MathZDC((100*$untracked_calls), $total_unanswered_calls)); $HTML_output.="

"._QXZ("IVR selection").": $NWB#VERM_UNANSWERED-ivr_selection$NWE

"; $HTML_output.="
"; @@ -1408,7 +1411,7 @@ $HTML_output.=""; $HTML_output.=""._QXZ("Untracked").""; $HTML_output.="$untracked_calls"; $HTML_output.="".$untracked_ivr_pct." %"; -$HTML_output.=""; +$HTML_output.=""; $HTML_output.=" "; $HTML_output.=" "; $HTML_output.=" "; @@ -1440,7 +1443,7 @@ foreach ($ivr_paths as $pathname => $value) $HTML_output.="".$pathname.""; $HTML_output.="".$value[0].""; $HTML_output.="".$ivr_pct." %"; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.="".$total_duration.""; $HTML_output.="".$average_duration.""; $HTML_output.="".$min_duration.""; @@ -1550,9 +1553,9 @@ if ($ivr_path!="") if ($ivr_paths["$ivr_path"][3]<$ivr_call_time) {$ivr_paths["$ivr_path"][3]=$ivr_call_time;} } -$max_ivr_count=max($ivr_counts); +$max_ivr_count=(count($ivr_counts)>0 ? max($ivr_counts) : 0); if ($max_ivr_count<$untracked_calls) {$max_ivr_count=$untracked_calls;} -$untracked_ivr_pct=sprintf("%.1f", (100*$untracked_calls)/$total_calls); +$untracked_ivr_pct=sprintf("%.1f", MathZDC((100*$untracked_calls), $total_calls)); $HTML_output.="

"._QXZ("IVR selection, all calls").": $NWB#VERM_UNANSWERED-IVR_selection_all_calls$NWE

"; $HTML_output.="
"; @@ -1575,7 +1578,7 @@ $HTML_output.=""; $HTML_output.=""._QXZ("Untracked").""; $HTML_output.="$untracked_calls"; $HTML_output.="".$untracked_ivr_pct." %"; -$HTML_output.=""; +$HTML_output.=""; $HTML_output.=" "; $HTML_output.=" "; $HTML_output.=" "; @@ -1606,7 +1609,7 @@ foreach ($ivr_paths as $pathname => $value) $HTML_output.="".$pathname.""; $HTML_output.="".$value[0].""; $HTML_output.="".$ivr_pct." %"; - $HTML_output.=""; + $HTML_output.=""; $HTML_output.="".$total_duration.""; $HTML_output.="".$average_duration.""; $HTML_output.="".$min_duration.""; @@ -1656,10 +1659,10 @@ while ($did_row=mysqli_fetch_array($did_rslt)) $untracked_did_calls--; } } -$max_did=max($did_counts); +$max_did=(count($did_counts)>0 ? max($did_counts) : 0); if ($max_did<$untracked_did_calls) {$max_did=$untracked_did_calls;} -$untracked_did_pct=sprintf("%.1f", ((100*$untracked_did_calls)/$total_unanswered_calls)); +$untracked_did_pct=sprintf("%.1f", (MathZDC((100*$untracked_did_calls), $total_unanswered_calls))); $HTML_output.="

"._QXZ("Inbound DID used").": $NWB#VERM_UNANSWERED-did_used$NWE

"; $HTML_output.="
"; $HTML_output.=""; @@ -1743,10 +1746,10 @@ while ($did_row=mysqli_fetch_array($did_rslt)) $untracked_did_calls--; } } -$max_did=max($did_counts); +$max_did=(count($did_counts)>0 ? max($did_counts) : 0); if ($max_did<$untracked_did_calls) {$max_did=$untracked_did_calls;} -$untracked_did_pct=sprintf("%.1f", ((100*$untracked_did_calls)/$total_calls)); +$untracked_did_pct=sprintf("%.1f", (MathZDC((100*$untracked_did_calls), $total_calls))); $HTML_output.="

"._QXZ("Inbound DID used, for all calls").": $NWB#VERM_UNANSWERED-did_used_all_calls$NWE

"; $HTML_output.="
"; $HTML_output.="
"; @@ -1779,7 +1782,7 @@ ksort($did_counts); $x=1; foreach ($did_counts as $did => $value) { - $did_pct=sprintf("%.1f", (100*$value)/$total_answered_calls); + $did_pct=sprintf("%.1f", MathZDC((100*$value), $total_answered_calls)); $HTML_output.=""; $HTML_output.=""; $HTML_output.=""; @@ -1881,8 +1884,8 @@ foreach($total_queue_stats as $campaign_name => $data) $CSV_output["call_overview"].="\"".$campaign_name."\",\"".$data["calls"]."\",\"".$data["answered"]."\",\"".$data["unanswered"]."\",\"".($avg_call_time>=3600 ? floor($avg_call_time/3600).":" : "").gmdate("i:s", $avg_call_time)."\",\"".($data["call_time"]>=3600 ? floor($data["call_time"]/3600).":" : "").gmdate("i:s", $data["call_time"])."\",\"".($avg_wait_time>=3600 ? floor($avg_wait_time/3600).":" : "").gmdate("i:s", $avg_wait_time)."\",\"".($data["wait_time"]>=3600 ? floor($data["wait_time"]/3600).":" : "").gmdate("i:s", $data["wait_time"])."\"\n"; } -$avg_call_time=round($total_queue_call_time/$total_queue_answered); -$avg_wait_time=round($total_queue_wait_time/$total_queue_calls); +$avg_call_time=round(MathZDC($total_queue_call_time, $total_queue_answered)); +$avg_wait_time=round(MathZDC($total_queue_wait_time, $total_queue_calls)); $HTML_output.=""; $HTML_output.=""; @@ -1948,18 +1951,18 @@ foreach($svc_lvl_row as $interval => $sum) $HTML_output.=""; $HTML_output.=""; $HTML_output.=""; - $HTML_output.=""; - $HTML_output.=""; - $HTML_output.=""; + $HTML_output.=""; + $HTML_output.=""; + $HTML_output.=""; $HTML_output.=""; - $CSV_output["answered_service_level_agreement"].="\"$int_name "._QXZ("seconds").":\",\"$sum\",\"$delta\",\"".sprintf("%.1f", ((100*$sum)/$answered_inbound_calls))." %\",\"".sprintf("%.1f", ((100*$sum)/$total_inbound_calls))." %\"\n"; + $CSV_output["answered_service_level_agreement"].="\"$int_name "._QXZ("seconds").":\",\"$sum\",\"$delta\",\"".sprintf("%.1f", (MathZDC((100*$sum), $answered_inbound_calls)))." %\",\"".sprintf("%.1f", (MathZDC((100*$sum), $total_inbound_calls)))." %\"\n"; $answered_service_level_agreement_graph_labels.="\"$int_name\","; $answered_service_level_agreement_graph_delta_data.="\"".($prev_int ? ($sum-$prev_int) : "0")."\","; $answered_service_level_agreement_graph_delta_bgcolor.="\"#33CCCC\","; $answered_service_level_agreement_graph_delta_hovborder.="\"#66FFFF\","; - $answered_service_level_agreement_graph_percent_data.="\"".sprintf("%.1f", ((100*$sum)/$answered_inbound_calls))."\","; + $answered_service_level_agreement_graph_percent_data.="\"".sprintf("%.1f", (MathZDC((100*$sum), $answered_inbound_calls)))."\","; $answered_service_level_agreement_graph_percent_bgcolor.="\"#FFCC66\","; $answered_service_level_agreement_graph_percent_hovborder.="\"#FFFF99\","; diff --git a/www/VERM/VERM_admin.php b/www/VERM/VERM_admin.php index 6fc739aa..b9f0f291 100644 --- a/www/VERM/VERM_admin.php +++ b/www/VERM/VERM_admin.php @@ -1,10 +1,11 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1609 - First build +# 240801-1130 - Code updates for PHP8 compatibility # @@ -75,8 +76,9 @@ if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} if ( (strlen($group)>1) and (strlen($groups[0])<1) ) {$groups[0] = $group;} else {$group = $groups[0];} -if (!isset($user_group_filter)) {$user_group_filter=array();} -if (!isset($ingroup_filter)) {$ingroup_filter=array();} +if (!is_array($groups)) {$groups=array();} +if (!is_array($user_group_filter)) {$user_group_filter=array();} +if (!is_array($ingroup_filter)) {$ingroup_filter=array();} $NOW_TIME = date("Y-m-d H:i:s"); $NOW_DAY = date("Y-m-d"); @@ -394,7 +396,6 @@ $allactivecampaigns .= "''"; $i=0; $group_string='|'; -if (!$groups) {$groups=array();} $group_ct = count($groups); while($i < $group_ct) { diff --git a/www/VERM/VERM_custom_report.php b/www/VERM/VERM_custom_report.php index dbd95d5e..4faa326d 100644 --- a/www/VERM/VERM_custom_report.php +++ b/www/VERM/VERM_custom_report.php @@ -1,10 +1,11 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1606 - First build +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -150,8 +151,8 @@ if (file_exists('options.php')) if ( (strlen($group)>1) and (strlen($groups[0])<1) ) {$groups[0] = $group;} else {$group = $groups[0];} -if (!isset($user_group_filter) || $user_group_filter=='') {$user_group_filter=array();} -if (!isset($ingroup_filter) || $ingroup_filter=='') {$ingroup_filter=array();} +if (!is_array($user_group_filter) || $user_group_filter=='') {$user_group_filter=array();} +if (!is_array($ingroup_filter) || $ingroup_filter=='') {$ingroup_filter=array();} $NOW_TIME = date("Y-m-d H:i:s"); $NOW_DAY = date("Y-m-d"); @@ -476,7 +477,7 @@ $allactivecampaigns .= "''"; $i=0; $group_string='|'; -if (!$groups) {$groups=array();} +if (!is_array($groups)) {$groups=array();} $group_ct = count($groups); while($i < $group_ct) { diff --git a/www/VERM/VERM_global_vars.inc b/www/VERM/VERM_global_vars.inc index 11e7ea26..205538a8 100644 --- a/www/VERM/VERM_global_vars.inc +++ b/www/VERM/VERM_global_vars.inc @@ -1,11 +1,12 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1622 - First build # 230106-1317 - Added missing QXZ, added pull of selectable statuses, human answered statues now include DISPO and SYSTEM +# 240801-1130 - Code updates for PHP8 compatibility # if (isset($_GET["start_date"])) {$start_date=$_GET["start_date"];} @@ -278,11 +279,25 @@ while ($callmenu_row=mysqli_fetch_row($callmenu_rslt)) # Compile closer campaigns for waiting calls $campaign_closer_names=array(); +# 7/31/24 - below arrays moved here to be declared as they need to exist for every campaign in the queue, not just ones where there are pause codes. +# Null campaign entries for the pause code arrays will cause an error; +$billable_pause_codes=array(); +$payable_pause_codes=array(); +$sale_array=array("SYSTEM" => array()); +$selectable_array=array("SYSTEM" => array()); +$human_ans_array=array("SYSTEM" => array()); +$contact_array=array("SYSTEM" => array()); $campaign_closer_stmt="select campaign_id, closer_campaigns from vicidial_campaigns $queueSQL_where"; $campaign_closer_rslt=mysql_to_mysqli($campaign_closer_stmt, $link); while ($campaign_closer_row=mysqli_fetch_row($campaign_closer_rslt)) { $campaign_closer_names["$campaign_closer_row[0]"]="$campaign_closer_row[1]"; + $billable_pause_codes["$campaign_closer_row[0]"]=array(); + $payable_pause_codes["$campaign_closer_row[0]"]=array(); + $sale_array["$campaign_closer_row[0]"]=array(); + $selectable_array["$campaign_closer_row[0]"]=array(); + $human_ans_array["$campaign_closer_row[0]"]=array(); + $contact_array["$campaign_closer_row[0]"]=array(); } # Compile closer campaigns for waiting calls @@ -303,7 +318,7 @@ while ($terminal_row=mysqli_fetch_row($terminal_rslt)) $terminal_names["$terminal_row[0]"]="$terminal_row[1]"; } -$sale_array=array("SYSTEM" => array()); +# $sale_array=array("SYSTEM" => array()); $sale_stmt="select distinct status, 'SYSTEM' as campaign_id from vicidial_statuses where sale='Y' UNION select distinct status, campaign_id from vicidial_campaign_statuses where sale='Y'"; $sale_rslt=mysql_to_mysqli($sale_stmt, $link); while ($sale_row=mysqli_fetch_array($sale_rslt)) @@ -312,7 +327,7 @@ while ($sale_row=mysqli_fetch_array($sale_rslt)) array_push($sale_array["$sale_row[campaign_id]"], $sale_row["status"]); } -$selectable_array=array("SYSTEM" => array()); +# $selectable_array=array("SYSTEM" => array()); $selectable_stmt="select distinct status, 'SYSTEM' as campaign_id from vicidial_statuses where selectable='Y' UNION select distinct status, campaign_id from vicidial_campaign_statuses where selectable='Y'"; $selectable_rslt=mysql_to_mysqli($selectable_stmt, $link); while ($selectable_row=mysqli_fetch_array($selectable_rslt)) @@ -321,7 +336,7 @@ while ($selectable_row=mysqli_fetch_array($selectable_rslt)) array_push($selectable_array["$selectable_row[campaign_id]"], $selectable_row["status"]); } -$human_ans_array=array("SYSTEM" => array()); +# $human_ans_array=array("SYSTEM" => array()); $human_ans_stmt="select distinct status, 'SYSTEM' as campaign_id from vicidial_statuses where human_answered='Y' UNION select distinct status, campaign_id from vicidial_campaign_statuses where human_answered='Y' UNION select 'DISPO', 'SYSTEM'"; $human_ans_rslt=mysql_to_mysqli($human_ans_stmt, $link); while ($human_ans_row=mysqli_fetch_array($human_ans_rslt)) @@ -330,7 +345,7 @@ while ($human_ans_row=mysqli_fetch_array($human_ans_rslt)) array_push($human_ans_array["$human_ans_row[campaign_id]"], $human_ans_row["status"]); } -$contact_array=array("SYSTEM" => array()); +# $contact_array=array("SYSTEM" => array()); $contact_stmt="select distinct status, 'SYSTEM' as campaign_id from vicidial_statuses where customer_contact='Y' UNION select distinct status, campaign_id from vicidial_campaign_statuses where customer_contact='Y'"; $contact_rslt=mysql_to_mysqli($contact_stmt, $link); while ($contact_row=mysqli_fetch_array($contact_rslt)) @@ -365,8 +380,8 @@ if (mysqli_num_rows($container_rslt)>0) $pause_code_stmt="select * from vicidial_pause_codes"; $pause_code_rslt=mysql_to_mysqli($pause_code_stmt, $link); -$billable_pause_codes=array(); -$payable_pause_codes=array(); +# $billable_pause_codes=array(); +# $payable_pause_codes=array(); $pause_code_names=array(); while ($pause_code_row=mysqli_fetch_array($pause_code_rslt)) { diff --git a/www/VERM/VERM_inbound_comparison_report.php b/www/VERM/VERM_inbound_comparison_report.php index c497014c..c389dc20 100644 --- a/www/VERM/VERM_inbound_comparison_report.php +++ b/www/VERM/VERM_inbound_comparison_report.php @@ -2,14 +2,17 @@ # VERM_inbound_comparison_report.php +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 + # changes # 230225-1531 - First build of script +# 240801-1139 - Code updates for PHP8 compatibility # $startMS = microtime(); -$version = '2.14-41'; -$build = '230225-1531'; +$version = '2.14-42'; +$build = '240801-1139'; header ("Content-type: text/html; charset=utf-8"); @@ -86,6 +89,9 @@ if ($SSallow_web_debug < 1) {$DB=0;} # $PHP_SELF=$_SERVER['PHP_SELF']; # $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); +if(!is_array($comparison_years)) {$comparison_years=array();} +if(!is_array($comparison_months)) {$comparison_months=array();} + $start_date=preg_replace('/[^-0-9]/', '', $start_date); $end_date=preg_replace('/[^-0-9]/', '', $end_date); $comparison_years=preg_replace('/[^0-9]/', '', $comparison_years); @@ -393,6 +399,11 @@ if ($vicidial_queue_groups && $submit_report) $included_inbound_groups_clause="and group_id in ('".preg_replace('/\s/', "', '", $included_inbound_groups)."')"; $where_included_inbound_groups_clause="where group_id in ('".preg_replace('/\s/', "', '", $included_inbound_groups)."')"; } + else + { + $included_campaigns_array=array(); + $included_inbound_groups_array=array(); + } $atomic_queue_str=""; @@ -1186,8 +1197,10 @@ $HTML_output.="//-->\n"; if ($DB) {$HTML_output.="$calls_stmt";} -$calls_rslt=mysqli_query($link, $calls_stmt); - +if($calls_stmt) + { + $calls_rslt=mysqli_query($link, $calls_stmt); + } if (file_exists('options.php')) diff --git a/www/VERM/VERM_main_report_page.php b/www/VERM/VERM_main_report_page.php index 2b49c2a5..a7a38bf8 100644 --- a/www/VERM/VERM_main_report_page.php +++ b/www/VERM/VERM_main_report_page.php @@ -1,12 +1,13 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220828-1402 - First build # 230106-1332 - Added auto download variables, permissions, report logging # 230116-1640 - Ingroup-related clauses no longer allow blank campaign_id values (double-dipping issue) +# 240801-1130 - Code updates for PHP8 compatibility # # NANQUE, not an unanswered call? @@ -566,6 +567,9 @@ if ($vicidial_queue_groups) $included_campaigns_clause="and campaign_id in ('')"; $included_inbound_groups_clause="and group_id in ('')"; $where_included_inbound_groups_clause="where group_id in ('')"; + + $included_campaigns_array=array(); + $included_inbound_groups_array=array(); } } else @@ -573,6 +577,9 @@ else $included_campaigns_clause="and campaign_id in ('')"; $included_inbound_groups_clause="and group_id in ('')"; $where_included_inbound_groups_clause="where group_id in ('')"; + + $included_campaigns_array=array(); + $included_inbound_groups_array=array(); } diff --git a/www/VERM/VERM_wallboard_widgets.php b/www/VERM/VERM_wallboard_widgets.php index 19209e2a..2435436b 100644 --- a/www/VERM/VERM_wallboard_widgets.php +++ b/www/VERM/VERM_wallboard_widgets.php @@ -1,10 +1,11 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1601 - First build +# 240801-1130 - Code updates for PHP8 compatibility # $report_name="VERM reports"; @@ -727,9 +728,9 @@ if ($widget_type=="N_WAITING_CALLS") } else { - $waiting_clause="sum(if(status='LIVE' IN('XFER') $included_campaigns_clause), 1, 0)"; + $waiting_clause="sum(if(status in ('LIVE', 'XFER') $included_campaigns_clause, 1, 0))"; # sum(if(status='LIVE' IN('XFER') $included_campaigns_clause), 1, 0) - $stmtB="from vicidial_auto_calls where status='LIVE' IN('XFER') $included_campaigns_clause order by queue_priority desc,campaign_id,call_time;"; + $stmtB="from vicidial_auto_calls where status in ('LIVE', 'XFER') $included_campaigns_clause order by queue_priority desc,campaign_id,call_time;"; } diff --git a/www/VERM/dbconnect_mysqli.php b/www/VERM/dbconnect_mysqli.php index 421d0b5e..3a48ed30 100644 --- a/www/VERM/dbconnect_mysqli.php +++ b/www/VERM/dbconnect_mysqli.php @@ -4,7 +4,7 @@ # # database connection settings and some global web settings # -# Copyright (C) 2022 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES: # 130328-0022 - Converted ereg to preg functions @@ -16,8 +16,26 @@ # 150626-2120 - Modified mysqli_error() to mysqli_connect_error() where appropriate # 160325-1434 - Changes for sidebar update # 220827-1948 - VERM version +# 240801-1130 - Code updates for PHP8 compatibility +# 240805-2103 - Added PHP_error_reporting_OVERRIDE options # +$PHP_error_reporting_OVERRIDE=0; +if (file_exists('options.php')) + { + require('options.php'); + } +if ($PHP_error_reporting_OVERRIDE > 0) + { + $php_err_suppression_value=32767; # E_ALL + $php_err_suppression_value-=($PHP_error_reporting_HIDE_ERRORS ? 1 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_WARNINGS ? 2 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_PARSES ? 4 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_NOTICES ? 8 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_DEPRECATIONS ? 8192 : 0); + error_reporting($php_err_suppression_value); + } + if ( file_exists("/etc/astguiclient.conf") ) { $DBCagc = file("/etc/astguiclient.conf"); diff --git a/www/VERM/display_agent_details.php b/www/VERM/display_agent_details.php index f20b60f2..84bdd4af 100644 --- a/www/VERM/display_agent_details.php +++ b/www/VERM/display_agent_details.php @@ -1,13 +1,15 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1612 - First build +# 240801-1130 - Code updates for PHP8 compatibility # $subreport_name="VERM Reports"; $report_display_type="display_agent_details.php"; +$startMS = microtime(); $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; diff --git a/www/VERM/display_call_details.php b/www/VERM/display_call_details.php index 71bdaaa1..c9d90c7e 100644 --- a/www/VERM/display_call_details.php +++ b/www/VERM/display_call_details.php @@ -1,11 +1,12 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1611 - First build # 230126-1158 - Added recording log access, QXZ translation +# 240801-1130 - Code updates for PHP8 compatibility # $subreport_name="VERM Reports"; $report_display_type="display_call_details.php"; @@ -318,8 +319,8 @@ $ENDtime=date("U"); $endMS = microtime(); $startMSary = explode(" ",$startMS); $endMSary = explode(" ",$endMS); -$runS = ($endMSary[0] - $startMSary[0]); -$runM = ($endMSary[1] - $startMSary[1]); +$runS = ((int)$endMSary[0] - (int)$startMSary[0]); +$runM = ((int)$endMSary[1] - (int)$startMSary[1]); $TOTALrun = ($runS + $runM); $stmt="UPDATE vicidial_report_log set run_time='$TOTALrun' where report_log_id='$report_log_id';"; diff --git a/www/VERM/display_outcomes_details.php b/www/VERM/display_outcomes_details.php index eb654b9e..525f0909 100644 --- a/www/VERM/display_outcomes_details.php +++ b/www/VERM/display_outcomes_details.php @@ -1,13 +1,15 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1610 - First build +# 240801-1130 - Code updates for PHP8 compatibility # $subreport_name="VERM Reports"; $report_display_type="display_outcomes_details.php"; +$startMS=microtime(); $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; diff --git a/www/VERM/options-example.php b/www/VERM/options-example.php new file mode 100644 index 00000000..1a0b0d9a --- /dev/null +++ b/www/VERM/options-example.php @@ -0,0 +1,19 @@ +, Joe Johnson LICENSE: AGPLv2 +# +# rename this file to options.php for the settings here to go into effect +# +# CHANGELOG +# 240802-1250 - First Build + +# If this option is set to 1, then the error_reporting in php.ini will be ignored and settings below will be used for this directory +$PHP_error_reporting_OVERRIDE = 0; + # PHP error reporting options, set to 1 to keep the type of error from being displayed, either on-screen or to the error logs. +$PHP_error_reporting_HIDE_ERRORS = 0; # STRONGLY advise leaving this value alone, but you do you. +$PHP_error_reporting_HIDE_WARNINGS = 0; +$PHP_error_reporting_HIDE_PARSES = 0; +$PHP_error_reporting_HIDE_NOTICES = 0; +$PHP_error_reporting_HIDE_DEPRECATIONS= 0; +?> diff --git a/www/agc/agentCORS.php b/www/agc/agentCORS.php index 510f84f0..26556fe0 100644 --- a/www/agc/agentCORS.php +++ b/www/agc/agentCORS.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CORS settings coming from the options.php script (the first 3 variables must be set for these features to be active) # $CORS_allowed_origin = ''; # if multiple origins allowed, separate them by a pipe (also allows PHP preg syntax) @@ -20,15 +20,33 @@ # # CHANGELOG # 210616-1012 - First Build +# 240801-1130 - Code updates for PHP8 compatibility +# 240805-2103 - Added PHP_error_reporting_OVERRIDE options # +$PHP_error_reporting_OVERRIDE=0; +if (file_exists('options.php')) + { + require('options.php'); + } +if ($PHP_error_reporting_OVERRIDE > 0) + { + $php_err_suppression_value=32767; # E_ALL + $php_err_suppression_value-=($PHP_error_reporting_HIDE_ERRORS ? 1 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_WARNINGS ? 2 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_PARSES ? 4 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_NOTICES ? 8 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_DEPRECATIONS ? 8192 : 0); + error_reporting($php_err_suppression_value); + } + $NOW_TIME = date("Y-m-d H:i:s"); if (strlen($php_script) < 1) {$donothing=1;} else { - $CORS_origin = $_SERVER['HTTP_ORIGIN']; # The client browser origin server + $CORS_origin = "$_SERVER[HTTP_ORIGIN]"; # The client browser origin server - treated as string for stripos command $CORS_method = isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']) ? $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] : $_SERVER['REQUEST_METHOD']; # Either the requested HTTP method or the current one $CORS_affected_scripts = " $CORS_affected_scripts "; # surround with spaces for preg match below @@ -114,4 +132,4 @@ else } } } -?> \ No newline at end of file +?> diff --git a/www/agc/dbconnect_mysqli.php b/www/agc/dbconnect_mysqli.php index fd5d84ff..2de3bceb 100644 --- a/www/agc/dbconnect_mysqli.php +++ b/www/agc/dbconnect_mysqli.php @@ -4,14 +4,32 @@ # # database connection settings and some global web settings # -# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES: # 130328-0022 - Converted ereg to preg functions # 130802-0957 - Changed to PHP mysqli functions # 150626-2120 - Modified mysqli_error() to mysqli_connect_error() where appropriate +# 240801-1130 - Code updates for PHP8 compatibility +# 240805-2103 - Added PHP_error_reporting_OVERRIDE options # +$PHP_error_reporting_OVERRIDE=0; +if (file_exists('options.php')) + { + require('options.php'); + } +if ($PHP_error_reporting_OVERRIDE > 0) + { + $php_err_suppression_value=32767; # E_ALL + $php_err_suppression_value-=($PHP_error_reporting_HIDE_ERRORS ? 1 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_WARNINGS ? 2 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_PARSES ? 4 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_NOTICES ? 8 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_DEPRECATIONS ? 8192 : 0); + error_reporting($php_err_suppression_value); + } + if ( file_exists("/etc/astguiclient.conf") ) { $DBCagc = file("/etc/astguiclient.conf"); diff --git a/www/agc/options-example.php b/www/agc/options-example.php index 3dfeb0bd..ab2dc5a3 100644 --- a/www/agc/options-example.php +++ b/www/agc/options-example.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # rename this file to options.php for the settings here to go into effect # @@ -30,6 +30,7 @@ # 230617-0815 - Added dead_logging_version option # 231109-0830 - Changed link_to_grey_version to disabled by default # 231115-1610 - Added allow_vlc_lookup, default_consultative +# 240802-1250 - Added options to customize PHP error reporting # $conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording @@ -114,6 +115,15 @@ $INSERT_window_onload = ''; # inserted at the end of the onload function $INSERT_agent_events = ''; # inserted within the agent_events function $INSERT_before_body_close = ''; # inserted before each BODY close tag +# If this option is set to 1, then the error_reporting in php.ini will be ignored and settings below will be used for this directory +$PHP_error_reporting_OVERRIDE = 0; + # PHP error reporting options, set to 1 to keep the type of error from being displayed, either on-screen or to the error logs. +$PHP_error_reporting_HIDE_ERRORS = 0; # STRONGLY advise leaving this value alone, but you do you. +$PHP_error_reporting_HIDE_WARNINGS = 0; +$PHP_error_reporting_HIDE_PARSES = 0; +$PHP_error_reporting_HIDE_NOTICES = 0; +$PHP_error_reporting_HIDE_DEPRECATIONS= 0; + # CORS settings: (to enable, customize the variables below, and uncomment the "require_once('agentCORS.php');" line at the bottom) # (NOTE: The first 3 variables must be set for these features to be active) $CORS_allowed_origin = ''; # if multiple origins allowed, separate them by a pipe (also allows PHP preg syntax) @@ -133,4 +143,4 @@ $CORS_debug = 0; # 0 = no, 1 = yes (default is no) This will generate a lot $customer_chat_refresh_seconds = 1; # How often (in seconds) to refresh customer ang agent chat window $manager_chat_refresh_seconds = 1; # How often (in seconds) to refresh manager chat window -?> \ No newline at end of file +?> diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index d1be0376..a4f8a8c9 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -551,10 +551,11 @@ # 240420-2227 - ConfBridge code added # 240517-0901 - Added ALT option for start_call_url fields # 240612-0206 - Fix for extension_appended_cidname newer options +# 240801-1140 - Code updates for PHP8 compatibility # -$version = '2.14-444'; -$build = '240612-0206'; +$version = '2.14-445'; +$build = '240801-1140'; $php_script = 'vdc_db_query.php'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=913; @@ -11659,8 +11660,8 @@ if ($ACTION == 'VDADcheckINCOMINGother') $chat_group_str=""; $VLA_inOUT='NONE'; $queue_seconds=0; - if (!isset($inbound_email_groups)) {$inbound_email_groups=array();} - if (!isset($inbound_chat_groups)) {$inbound_chat_groups=array();} + if (!is_array($inbound_email_groups)) {$inbound_email_groups=array();} + if (!is_array($inbound_chat_groups)) {$inbound_chat_groups=array();} $email_group_ct=count($inbound_email_groups); # This should always be greater than zero for the script to reach this point, but just in case... for ($i=0; $i<$email_group_ct; $i++) diff --git a/www/chat_customer/customer_chat_code.php b/www/chat_customer/customer_chat_code.php index d10d15f0..593c5c83 100644 --- a/www/chat_customer/customer_chat_code.php +++ b/www/chat_customer/customer_chat_code.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # Example for incorporating the customer side of the Vicidial chat into a web page. # Can be called as an include file, if desired. @@ -13,8 +13,26 @@ # 160108-1659 - Added available_agents variable # 160120-1944 - Added show_email variable # 220220-1921 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility +# 240805-2103 - Added PHP_error_reporting_OVERRIDE options # +$PHP_error_reporting_OVERRIDE=0; +if (file_exists('options.php')) + { + require('options.php'); + } +if ($PHP_error_reporting_OVERRIDE > 0) + { + $php_err_suppression_value=32767; # E_ALL + $php_err_suppression_value-=($PHP_error_reporting_HIDE_ERRORS ? 1 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_WARNINGS ? 2 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_PARSES ? 4 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_NOTICES ? 8 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_DEPRECATIONS ? 8192 : 0); + error_reporting($php_err_suppression_value); + } + if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} if (isset($_GET["chat_id"])) {$chat_id=$_GET["chat_id"];} @@ -34,17 +52,17 @@ if (isset($_GET["available_agents"])) {$available_agents=$_GET["available_agen if (isset($_GET["show_email"])) {$show_email=$_GET["show_email"];} elseif (isset($_POST["show_email"])) {$show_email=$_POST["show_email"];} -$lead_id = preg_replace("/[^0-9]/","",$lead_id); -$chat_id = preg_replace('/[^-\_\.0-9a-zA-Z]/','',$chat_id); -$group_id = preg_replace('/[^-\_0-9\p{L}]/u','',$group_id); -$chat_group_id = preg_replace('/[^-\_0-9\p{L}]/u','',$chat_group_id); -$email = preg_replace('/[^-\.\:\/\@\_0-9\p{L}]/u','',$email); -$unique_userID = preg_replace('/[^-\.\_0-9a-zA-Z]/','',$unique_userID); -$language = preg_replace('/[^-\_0-9a-zA-Z]/','',$language); -$available_agents = preg_replace('/[^-\_0-9a-zA-Z]/','',$available_agents); -$show_email = preg_replace('/[^-\_0-9a-zA-Z]/','',$show_email); +if (isset($lead_id)) {$lead_id = preg_replace("/[^0-9]/","",$lead_id);} +if (isset($chat_id)) {$chat_id = preg_replace('/[^-\_\.0-9a-zA-Z]/','',$chat_id);} +if (isset($group_id)) {$group_id = preg_replace('/[^-\_0-9\p{L}]/u','',$group_id);} +if (isset($chat_group_id)) {$chat_group_id = urlencode(preg_replace('/[^-\_0-9\p{L}]/u','',$chat_group_id));} +if (isset($email)) {$email = urlencode(preg_replace('/[^-\.\:\/\@\_0-9\p{L}]/u','',$email));} +if (isset($unique_userID)) {$unique_userID = urlencode(preg_replace('/[^-\.\_0-9a-zA-Z]/','',$unique_userID));} +if (isset($language)) {$language = urlencode(preg_replace('/[^-\_0-9a-zA-Z]/','',$language));} +if (isset($available_agents)) {urlencode($available_agents = preg_replace('/[^-\_0-9a-zA-Z]/','',$available_agents));} +if (isset($show_email)) {$show_email = urlencode(preg_replace('/[^-\_0-9a-zA-Z]/','',$show_email));} -$URL_vars="?user=".urlencode($unique_userID)."&lead_id=".$lead_id."&group_id=".urlencode($chat_group_id)."&chat_id=".$chat_id."&email=".urlencode($email)."&language=".urlencode($language)."&available_agents=".urlencode($available_agents)."&show_email=".urlencode($show_email); +$URL_vars="?user=".$unique_userID."&lead_id=".$lead_id."&group_id=".$chat_group_id."&chat_id=".$chat_id."&email=".$email."&language=".$language."&available_agents=".$available_agents."&show_email=".$show_email; header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 diff --git a/www/chat_customer/customer_chat_functions.php b/www/chat_customer/customer_chat_functions.php index 8dbe5a25..8c64a566 100644 --- a/www/chat_customer/customer_chat_functions.php +++ b/www/chat_customer/customer_chat_functions.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # CHANGES # 151212-0828 - First Build for customer chat @@ -16,6 +16,7 @@ # 160805-2315 - Added coding to show logos in customer display # 161026-2230 - Added translation QXZ to untranslated text # 220220-1940 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # require("dbconnect_mysqli.php"); @@ -54,24 +55,24 @@ if (isset($_GET["available_agents"])) {$available_agents=$_GET["available_age if (isset($_GET["show_email"])) {$show_email=$_GET["show_email"];} elseif (isset($_POST["show_email"])) {$show_email=$_POST["show_email"];} -$chat_member_name = preg_replace('/[^- \.\,\_0-9a-zA-Z]/',"",$chat_member_name); +if(isset($chat_member_name)) {$chat_member_name = preg_replace('/[^- \.\,\_0-9a-zA-Z]/',"",$chat_member_name);} if (!$user) {echo "No user, no using."; exit;} -$DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); -$lead_id = preg_replace("/[^0-9]/","",$lead_id); -$chat_id = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$chat_id); -$chat_level = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$chat_level); -$group_id = preg_replace('/[^- \_0-9a-zA-Z]/','',$group_id); -$language = preg_replace('/[^-\_0-9a-zA-Z]/','',$language); -$user = preg_replace("/\'|\"|\\\\|;/","",$user); -$chat_member_name = preg_replace("/\'|\"|\\\\|;/","",$chat_member_name); -$available_agents = preg_replace('/[^-\_0-9a-zA-Z]/','',$available_agents); -$show_email = preg_replace('/[^-\_0-9a-zA-Z]/','',$show_email); -$chat_message = preg_replace('/\|/', '|', $chat_message); -$action = preg_replace('/[^-\_0-9a-zA-Z]/','',$action); -$user_level = preg_replace('/[^-\_0-9a-zA-Z]/','',$user_level); -$keepalive = preg_replace('/[^-\_0-9a-zA-Z]/','',$keepalive); -$current_message_count = preg_replace('/[^-\_0-9a-zA-Z]/','',$current_message_count); +if(isset($DB)) {$DB = preg_replace("/[^0-9a-zA-Z]/","",$DB);} +if(isset($lead_id)) {$lead_id = preg_replace("/[^0-9]/","",$lead_id);} +if(isset($chat_id)) {$chat_id = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$chat_id);} +if(isset($chat_level)) {$chat_level = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$chat_level);} +if(isset($group_id)) {$group_id = preg_replace('/[^- \_0-9a-zA-Z]/','',$group_id);} +if(isset($language)) {$language = preg_replace('/[^-\_0-9a-zA-Z]/','',$language);} +if(isset($user)) {$user = preg_replace("/\'|\"|\\\\|;/","",$user);} +if(isset($chat_member_name)) {$chat_member_name = preg_replace("/\'|\"|\\\\|;/","",$chat_member_name);} +if(isset($available_agents)) {$available_agents = preg_replace('/[^-\_0-9a-zA-Z]/','',$available_agents);} +if(isset($show_email)) {$show_email = preg_replace('/[^-\_0-9a-zA-Z]/','',$show_email);} +if(isset($chat_message)) {$chat_message = preg_replace('/\|/', '|', $chat_message);} +if(isset($action)) {$action = preg_replace('/[^-\_0-9a-zA-Z]/','',$action);} +if(isset($user_level)) {$user_level = preg_replace('/[^-\_0-9a-zA-Z]/','',$user_level);} +if(isset($keepalive)) {$keepalive = preg_replace('/[^-\_0-9a-zA-Z]/','',$keepalive);} +if(isset($current_message_count)) {$current_message_count = preg_replace('/[^-\_0-9a-zA-Z]/','',$current_message_count);} $use_agent_colors=1; if (file_exists('options.php')) @@ -510,4 +511,4 @@ if ($action=="update_chat_window" && $chat_id) { } } -?> \ No newline at end of file +?> diff --git a/www/chat_customer/dbconnect_mysqli.php b/www/chat_customer/dbconnect_mysqli.php index f60ff110..19a36d32 100644 --- a/www/chat_customer/dbconnect_mysqli.php +++ b/www/chat_customer/dbconnect_mysqli.php @@ -4,12 +4,30 @@ # # database connection settings and some global web settings # -# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES: # 151212-0827 - First Build for customer chat +# 240801-1130 - Code updates for PHP8 compatibility +# 240805-2103 - Added PHP_error_reporting_OVERRIDE options # +$PHP_error_reporting_OVERRIDE=0; +if (file_exists('options.php')) + { + require('options.php'); + } +if ($PHP_error_reporting_OVERRIDE > 0) + { + $php_err_suppression_value=32767; # E_ALL + $php_err_suppression_value-=($PHP_error_reporting_HIDE_ERRORS ? 1 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_WARNINGS ? 2 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_PARSES ? 4 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_NOTICES ? 8 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_DEPRECATIONS ? 8192 : 0); + error_reporting($php_err_suppression_value); + } + if ( file_exists("/etc/astguiclient.conf") ) { $DBCagc = file("/etc/astguiclient.conf"); diff --git a/www/chat_customer/options-example.php b/www/chat_customer/options-example.php index fbf32eac..68f45fe8 100644 --- a/www/chat_customer/options-example.php +++ b/www/chat_customer/options-example.php @@ -1,3 +1,23 @@ , Joe Johnson LICENSE: AGPLv2 +# +# rename this file to options.php for the settings here to go into effect +# +# CHANGELOG +# 160818-0200 - First build +# 240802-1250 - Added options to customize PHP error output +# + +# If this option is set to 1, then the error_reporting in php.ini will be ignored and settings below will be used for this directory +$PHP_error_reporting_OVERRIDE = 0; + # PHP error reporting options, set to 1 to keep the type of error from being displayed, either on-screen or to the error logs. +$PHP_error_reporting_HIDE_ERRORS = 0; # STRONGLY advise leaving this value alone, but you do you. +$PHP_error_reporting_HIDE_WARNINGS = 0; +$PHP_error_reporting_HIDE_PARSES = 0; +$PHP_error_reporting_HIDE_NOTICES = 0; +$PHP_error_reporting_HIDE_DEPRECATIONS= 0; + $use_agent_colors = '1'; # set to 1 to use the agent_screen_colors setting in the system settings ?> diff --git a/www/chat_customer/vicidial_chat_customer_side.php b/www/chat_customer/vicidial_chat_customer_side.php index cb2deeb9..836f40bf 100644 --- a/www/chat_customer/vicidial_chat_customer_side.php +++ b/www/chat_customer/vicidial_chat_customer_side.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # The main page of the customer chat interface. This will display a form for the customer # to fill out to attempt to initiate a chat with an available agent in the in-group @@ -19,6 +19,7 @@ # 160203-1052 - Added display of chat message after ending it # 160805-2315 - Added coding to show logos in customer display # 220220-1915 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # require("dbconnect_mysqli.php"); @@ -57,17 +58,17 @@ if (isset($_GET["show_email"])) {$show_email=$_GET["show_email"];} $PHP_SELF=$_SERVER['PHP_SELF']; $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); -$lead_id = preg_replace("/[^0-9]/","",$lead_id); -$user = preg_replace("/\'|\"|\\\\|;/","",$user); -$chat_id = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$chat_id); -$group_id = preg_replace('/[^- \_0-9a-zA-Z]/','',$group_id); -$language = preg_replace('/[^-\_0-9a-zA-Z]/','',$language); -$available_agents = preg_replace('/[^-\_0-9a-zA-Z]/','',$available_agents); -$status_link = preg_replace('/[^-\_0-9a-zA-Z]/','',$status_link); -$show_email = preg_replace('/[^-\_0-9a-zA-Z]/','',$show_email); -$send_request = preg_replace('/[^-\_0-9a-zA-Z]/','',$send_request); -$join_chat = preg_replace('/[^-\_0-9a-zA-Z]/','',$join_chat); -$stage = preg_replace('/[^-\_0-9a-zA-Z]/','',$stage); +if (isset($lead_id)) {$lead_id = preg_replace("/[^0-9]/","",$lead_id);} +if (isset($user)) {$user = preg_replace("/\'|\"|\\\\|;/","",$user);} +if (isset($chat_id)) {$chat_id = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$chat_id);} +if (isset($group_id)) {$group_id = preg_replace('/[^- \_0-9a-zA-Z]/','',$group_id);} +if (isset($language)) {$language = preg_replace('/[^-\_0-9a-zA-Z]/','',$language);} +if (isset($available_agents)) {$available_agents = preg_replace('/[^-\_0-9a-zA-Z]/','',$available_agents);} +if (isset($status_link)) {$status_link = preg_replace('/[^-\_0-9a-zA-Z]/','',$status_link);} +if (isset($show_email)) {$show_email = preg_replace('/[^-\_0-9a-zA-Z]/','',$show_email);} +if (isset($send_request)) {$send_request = preg_replace('/[^-\_0-9a-zA-Z]/','',$send_request);} +if (isset($join_chat)) {$join_chat = preg_replace('/[^-\_0-9a-zA-Z]/','',$join_chat);} +if (isset($stage)) {$stage = preg_replace('/[^-\_0-9a-zA-Z]/','',$stage);} ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### @@ -668,7 +669,7 @@ $chat_title= _QXZ("Request chat with agent"); # This can be modified for customi - @@ -710,7 +711,7 @@ $chat_title= _QXZ("Request chat with agent"); # This can be modified for customi - @@ -797,7 +798,7 @@ $chat_title= _QXZ("Request chat with agent"); # This can be modified for customi - diff --git a/www/vicidial/AST_3way_press_log_report.php b/www/vicidial/AST_3way_press_log_report.php index bfcf2e7c..dfd83480 100644 --- a/www/vicidial/AST_3way_press_log_report.php +++ b/www/vicidial/AST_3way_press_log_report.php @@ -8,6 +8,7 @@ # 231228-2204 - First build # 240108-1556 - Added channel/server display # 240114-1018 - Added Agent Gone summary stat +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -48,7 +49,7 @@ $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); $start_screen=0; -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE; $start_screen=1;} if (!isset($end_date)) {$end_date = $NOW_DATE;} diff --git a/www/vicidial/AST_AMD_log_report.php b/www/vicidial/AST_AMD_log_report.php index 706fa47c..cd1ddd9b 100644 --- a/www/vicidial/AST_AMD_log_report.php +++ b/www/vicidial/AST_AMD_log_report.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # CHANGES # 190329-1852 - First build, based on AST_carrier_log_report.php # 191013-0839 - Fixes for PHP7 # 220303-1415 - Added allow_web_debug system setting # 220812-0951 - Added User Group report permissions checking +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -52,9 +53,9 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $START_TIME=date("U"); $NOW_DATE = date("Y-m-d"); -if (!isset($server_ip)) {$server_ip = array();} -if (!isset($AMDSTATUS)) {$AMDSTATUS = array();} -if (!isset($AMDRESPONSE)) {$AMDRESPONSE = array();} +if (!is_array($server_ip)) {$server_ip = array();} +if (!is_array($AMDSTATUS)) {$AMDSTATUS = array();} +if (!is_array($AMDRESPONSE)) {$AMDRESPONSE = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (strlen($query_date_D) < 6) {$query_date_D = "00:00:00";} if (strlen($query_date_T) < 6) {$query_date_T = "23:59:59";} diff --git a/www/vicidial/AST_API_log_report.php b/www/vicidial/AST_API_log_report.php index 40b74ae3..75534204 100644 --- a/www/vicidial/AST_API_log_report.php +++ b/www/vicidial/AST_API_log_report.php @@ -3,7 +3,7 @@ # # This report is for viewing the a report of API activity to the vicidial_api_log table # -# Copyright (C) 2022 Joe Johnson, Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -17,6 +17,7 @@ # 180502-2115 - Added new help display # 191013-0829 - Fixes for PHP7 # 220303-1028 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -63,10 +64,10 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $report_name="API Log Report"; $NOW_DATE = date("Y-m-d"); -if (!isset($users)) {$users=array();} -if (!isset($agent_users)) {$agent_users=array();} -if (!isset($functions)) {$functions=array();} -if (!isset($results)) {$results=array();} +if (!is_array($users)) {$users=array();} +if (!is_array($agent_users)) {$agent_users=array();} +if (!is_array($functions)) {$functions=array();} +if (!is_array($results)) {$results=array();} if (!isset($api_date_D)) {$api_date_D=$NOW_DATE;} if (!isset($api_date_end_D)) {$api_date_end_D=$NOW_DATE;} if (!isset($api_date_T)) {$api_date_T="00:00:00";} @@ -732,6 +733,7 @@ if ($SUBMIT && $api_date_D && $api_date_T && $api_date_end_D && $api_date_end_T) if ($DB) {print $stmt."\n";} # print $stmt."\n"; + $url_vars=array(); $URL_header=''; $ASCII_border="+---------------------+--------------------------------+------------+----------------------+--------------------------------+------------+----------------------+----------+-----------+----------------------+-----------+\n"; if ($show_urls) diff --git a/www/vicidial/AST_CLOSERstats.php b/www/vicidial/AST_CLOSERstats.php index b17021a3..f3e041d1 100644 --- a/www/vicidial/AST_CLOSERstats.php +++ b/www/vicidial/AST_CLOSERstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES: # 60619-1714 - Added variable filtering to eliminate SQL injection attack threat @@ -70,6 +70,7 @@ # 211022-0735 - Added IR_SLA_all_statuses options.php setting # 212207-2217 - Added IQNANQ to drop SQL calculation queries # 220303-0850 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -121,7 +122,7 @@ $MT[0]='0'; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} diff --git a/www/vicidial/AST_CLOSERstats_v2.php b/www/vicidial/AST_CLOSERstats_v2.php index 54731cc4..29970113 100644 --- a/www/vicidial/AST_CLOSERstats_v2.php +++ b/www/vicidial/AST_CLOSERstats_v2.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES: # 60619-1714 - Added variable filtering to eliminate SQL injection attack threat @@ -75,6 +75,7 @@ # 211027-1050 - Added optional campaign selection(camp_select), for calculation of OCR only # 212207-2227 - Added IQNANQ to drop SQL calculation queries, fix for AHT calculation in show_camp mode # 221208-1013 - Added vicidial_inbound_callback_queue stats +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -132,8 +133,8 @@ $MT[0]='0'; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($campaigns)) {$campaigns = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($campaigns)) {$campaigns = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} diff --git a/www/vicidial/AST_CLOSERsummary_hourly.php b/www/vicidial/AST_CLOSERsummary_hourly.php index 67393702..0036f6d8 100644 --- a/www/vicidial/AST_CLOSERsummary_hourly.php +++ b/www/vicidial/AST_CLOSERsummary_hourly.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -35,6 +35,7 @@ # 200605-1100 - user_group bug fix # 220303-0829 - Added allow_web_debug system setting # 230526-1740 - Patch for user_group bug, related to Issue #1346 +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -85,7 +86,7 @@ $MT[0]='0'; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} diff --git a/www/vicidial/AST_CMstats.php b/www/vicidial/AST_CMstats.php index 7f609a65..a49bc7c9 100644 --- a/www/vicidial/AST_CMstats.php +++ b/www/vicidial/AST_CMstats.php @@ -1,13 +1,14 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGES # 180724-2109 - First build # 180829-1155 - Added totals # 191013-0849 - Fixes for PHP7 # 220303-0822 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -49,8 +50,8 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($callmenus)) {$callmenus=array();} -if (!isset($group)) {$group = array();} +if (!is_array($callmenus)) {$callmenus=array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = "$NOW_DATE 00:00:00";} if (!isset($end_date)) {$end_date = "$NOW_DATE 23:23:59";} diff --git a/www/vicidial/AST_DIDdetail.php b/www/vicidial/AST_DIDdetail.php index fe5ca90b..cb54f5fc 100644 --- a/www/vicidial/AST_DIDdetail.php +++ b/www/vicidial/AST_DIDdetail.php @@ -1,11 +1,12 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # # 220510-0945 - First build +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -49,7 +50,7 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (!isset($time_BEGIN)) {$time_BEGIN = "00:00:00";} diff --git a/www/vicidial/AST_DIDstats.php b/www/vicidial/AST_DIDstats.php index c224ce54..cd15f5b2 100644 --- a/www/vicidial/AST_DIDstats.php +++ b/www/vicidial/AST_DIDstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -38,6 +38,7 @@ # 191013-0850 - Fixes for PHP7 # 210525-1715 - Fixed help display, modification for more call details # 220303-0759 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -79,7 +80,7 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (!isset($time_BEGIN)) {$time_BEGIN = "00:00:00";} diff --git a/www/vicidial/AST_DIDstats_v2.php b/www/vicidial/AST_DIDstats_v2.php index de423db2..93d71b6d 100644 --- a/www/vicidial/AST_DIDstats_v2.php +++ b/www/vicidial/AST_DIDstats_v2.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -9,6 +9,7 @@ # 170903-0941 - Added screen color settings # 191013-0817 - Fixes for PHP7 # 220303-0726 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -50,7 +51,7 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (!isset($time_BEGIN)) {$time_BEGIN = "00:00:00";} diff --git a/www/vicidial/AST_IVRstats.php b/www/vicidial/AST_IVRstats.php index f65fef77..1894a45e 100644 --- a/www/vicidial/AST_IVRstats.php +++ b/www/vicidial/AST_IVRstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # 81026-2026 - First build @@ -42,6 +42,7 @@ # 180507-2315 - Added new help display # 191013-0835 - Fixes for PHP7 # 220221-0926 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -81,7 +82,7 @@ if (strlen($type)<2) {$type='inbound';} $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = "$NOW_DATE 00:00:00";} if (!isset($end_date)) {$end_date = "$NOW_DATE 23:23:59";} @@ -971,9 +972,7 @@ else $s++; } - $TOTALcalls = sprintf("%6s", $TOTALcalls); - $totFLOWtotal = sprintf("%6s", $totFLOWtotal); - $totFLOWdrop = sprintf("%6s", $totFLOWdrop); + $TavgFLOWivr_time = MathZDC($totFLOWivr_time, $TOTALcalls); $TavgFLOWivr_time = round($TavgFLOWivr_time, 0); $TavgFLOWivr_time = sprintf("%4s", $TavgFLOWivr_time); @@ -983,6 +982,9 @@ else $totFLOWdropPCT = (MathZDC($totFLOWdrop, $totFLOWtotal) * 100); $totFLOWdropPCT = round($totFLOWdropPCT, 0); $totFLOWdropPCT = sprintf("%5s", $totFLOWdropPCT); + $TOTALcalls = sprintf("%6s", $TOTALcalls); + $totFLOWtotal = sprintf("%6s", $totFLOWtotal); + $totFLOWdrop = sprintf("%6s", $totFLOWdrop); $ASCII_text.="+--------+--------+--------+--------+------+------+------------\n"; $ASCII_text.="| $TOTALcalls | $totFLOWtotal | $totFLOWdrop | $totFLOWdropPCT% | $TavgFLOWivr_time | $TavgFLOWtotal_time |\n"; diff --git a/www/vicidial/AST_LISTS_campaign_stats.php b/www/vicidial/AST_LISTS_campaign_stats.php index 92aea6e3..43bc77d9 100644 --- a/www/vicidial/AST_LISTS_campaign_stats.php +++ b/www/vicidial/AST_LISTS_campaign_stats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # This is a list inventory report, not a calling report. This report will show # statistics for all of the lists in the selected campaigns @@ -33,6 +33,7 @@ # 180507-2315 - Added new help display # 191013-0819 - Fixes for PHP7 # 220302-1315 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -66,7 +67,7 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} $report_name = 'Lists Campaign Statuses Report'; $db_source = 'M'; diff --git a/www/vicidial/AST_LISTS_pass_report.php b/www/vicidial/AST_LISTS_pass_report.php index d91bde51..49524f2a 100644 --- a/www/vicidial/AST_LISTS_pass_report.php +++ b/www/vicidial/AST_LISTS_pass_report.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # This is a list inventory report, not a calling report. This report will show # statistics for all of the lists in the selected campaigns @@ -27,6 +27,7 @@ # 210330-1659 - Added extra warnings and forced confirmation before running report # 220221-0906 - Added allow_web_debug system setting # 221109-0729 - Fix for DOWNLOAD link and use_lists variable in links +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -62,7 +63,7 @@ if (isset($_GET["search_archived_data"])) {$search_archived_data=$_GET["search $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); @@ -589,7 +590,7 @@ if (strlen($group[0]) < 1) } else if (strlen($group[0]) >= 1 && !$confirm_run) { - $MAIN.=""._QXZ("REMINDER - THIS REPORT CAN TAKE A LONG TIME TO RUN AND WILL INTERFERE WITH DIALING IF EXECUTED DURING PRODUCTION.")."
"._QXZ("IF YOU ARE SURE YOU WOULD LIKE TO RUN THE REPORT AT THIS TIME")." "._QXZ("CLICK HERE")."
"; + $MAIN.=""._QXZ("REMINDER - THIS REPORT CAN TAKE A LONG TIME TO RUN AND WILL INTERFERE WITH DIALING IF EXECUTED DURING PRODUCTION.")."
"._QXZ("IF YOU ARE SURE YOU WOULD LIKE TO RUN THE REPORT AT THIS TIME")." "._QXZ("CLICK HERE")."
"; } else { diff --git a/www/vicidial/AST_LISTS_stats.php b/www/vicidial/AST_LISTS_stats.php index ddc6174b..57374557 100644 --- a/www/vicidial/AST_LISTS_stats.php +++ b/www/vicidial/AST_LISTS_stats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # This is a list inventory report, not a calling report. This report will show # statistics for all of the lists in the selected campaigns @@ -19,6 +19,7 @@ # 170903-0951 - Added screen color settings # 180507-2315 - Added new help display # 220302-1214 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -52,7 +53,7 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($list)) {$list = array();} +if (!is_array($list)) {$list = array();} $report_name = 'Lists Statuses Report'; $db_source = 'M'; diff --git a/www/vicidial/AST_OUTBOUNDsummary_interval.php b/www/vicidial/AST_OUTBOUNDsummary_interval.php index 13ed0508..7caeec1b 100644 --- a/www/vicidial/AST_OUTBOUNDsummary_interval.php +++ b/www/vicidial/AST_OUTBOUNDsummary_interval.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -35,6 +35,7 @@ # 180507-2315 - Added new help display # 191013-0813 - Fixes for PHP7 # 220302-1007 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -83,7 +84,7 @@ $MT[0]='0'; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} diff --git a/www/vicidial/AST_VDADstats.php b/www/vicidial/AST_VDADstats.php index 51289e0a..3015c55e 100644 --- a/www/vicidial/AST_VDADstats.php +++ b/www/vicidial/AST_VDADstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # 60619-1718 - Added variable filtering to eliminate SQL injection attack threat @@ -58,6 +58,7 @@ # 190823-1620 - Fixed download archive bug # 191013-0852 - Fixes for PHP7 # 220301-1641 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -113,8 +114,8 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($list_ids)) {$list_ids = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($list_ids)) {$list_ids = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} @@ -1395,7 +1396,7 @@ else if ($Ctally_to_print > 0) { $rowx=mysqli_fetch_row($rslt); - $AGENTsec = "$rowx[0]"; + $AGENTsec = $rowx[0]; } if ($DB) {$ASCII_text .= "$AGENTsec|$Ctally_to_print|$stmt\n";} diff --git a/www/vicidial/AST_admin_template_maker.php b/www/vicidial/AST_admin_template_maker.php index 20b3babf..fa48d308 100644 --- a/www/vicidial/AST_admin_template_maker.php +++ b/www/vicidial/AST_admin_template_maker.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell,Joe Johnson LICENSE: AGPLv2 # # CHANGES # 120402-2132 - First Build @@ -19,6 +19,7 @@ # 180927-0633 - Fix for deleted template function in alternate language, issue #1127 # 210312-1700 - Added layout editing functionality # 220222-1100 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # require("dbconnect_mysqli.php"); @@ -107,6 +108,7 @@ $submit_template = preg_replace("/\<|\>|\'|\"|\\\\|;/", '', $submit_template); $submit_edited_template = preg_replace("/\<|\>|\'|\"|\\\\|;/", '', $submit_edited_template); $file_format = preg_replace("/\<|\>|\'|\"|\\\\|;/",'',$file_format); $file_delimiter = preg_replace("/\<|\>|\'|\"|\\\\|;/",'',$file_delimiter); +if (!is_array($template_statuses)) {$template_statuses=array();} # Variables filtered further down in the code # $template_statuses diff --git a/www/vicidial/AST_agentDIDstats.php b/www/vicidial/AST_agentDIDstats.php index e90de827..e33888df 100644 --- a/www/vicidial/AST_agentDIDstats.php +++ b/www/vicidial/AST_agentDIDstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -11,6 +11,7 @@ # 191013-0836 - Fixes for PHP7 # 220303-1422 - Added allow_web_debug system setting # 230526-1740 - Patch for user_group bug, related to Issue #1346 +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -48,7 +49,7 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if ($file_download>0) {$DB="";} diff --git a/www/vicidial/AST_agent_days_detail.php b/www/vicidial/AST_agent_days_detail.php index 56da33b3..ebf3b20a 100644 --- a/www/vicidial/AST_agent_days_detail.php +++ b/www/vicidial/AST_agent_days_detail.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -36,6 +36,7 @@ # 191013-0848 - Fixes for PHP7 # 220221-0946 - Added allow_web_debug system setting # 230526-1740 - Patch for user_group bug, related to Issue #1346 +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -77,7 +78,7 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} @@ -353,7 +354,7 @@ while ($i < $user_groups_to_print) #if ( (preg_match("/--ALL--/",$group_string) ) or ($group_ct < 1) ) # { $user_group_SQL = "and user_group IN('".implode("', '", $user_groups)."')"; - $user_group_SQL_val = "and vicidial_agent_log.user_group IN('".implode("', '", $user_groups)."')"; + $user_group_SQL_val = "and ".$vicidial_agent_log_table.".user_group IN('".implode("', '", $user_groups)."')"; $user_group_IN_clause="user_group in ('".implode("', '", $user_groups)."')"; # } #else diff --git a/www/vicidial/AST_agent_days_time.php b/www/vicidial/AST_agent_days_time.php index 51d9e155..949a6007 100644 --- a/www/vicidial/AST_agent_days_time.php +++ b/www/vicidial/AST_agent_days_time.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -14,6 +14,7 @@ # 220303-1510 - Added allow_web_debug system setting # 230526-1740 - Patch for user_group bug, related to Issue #1346 # 231114-1703 - Fix for issue #1490 +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -56,7 +57,7 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} diff --git a/www/vicidial/AST_agent_inbound_status.php b/www/vicidial/AST_agent_inbound_status.php index e7fd26cb..ff7985cb 100644 --- a/www/vicidial/AST_agent_inbound_status.php +++ b/www/vicidial/AST_agent_inbound_status.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -9,6 +9,7 @@ # 191013-0841 - Fixes for PHP7 # 220303-1503 - Added allow_web_debug system setting # 230526-1740 - Patch for user_group bug, related to Issue #1346 +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -53,8 +54,8 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} diff --git a/www/vicidial/AST_agent_performance_detail.php b/www/vicidial/AST_agent_performance_detail.php index f4e0a66c..0952530d 100644 --- a/www/vicidial/AST_agent_performance_detail.php +++ b/www/vicidial/AST_agent_performance_detail.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -67,6 +67,7 @@ # 191030-1530 - Query fixes # 200421-1411 - user_group bug fix # 220303-1458 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -125,9 +126,9 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} -if (!isset($users)) {$users = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} +if (!is_array($users)) {$users = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (!isset($query_time)) {$query_time = "00:00:00";} diff --git a/www/vicidial/AST_agent_performance_detail_SALES.php b/www/vicidial/AST_agent_performance_detail_SALES.php index c6f1d393..e0964769 100644 --- a/www/vicidial/AST_agent_performance_detail_SALES.php +++ b/www/vicidial/AST_agent_performance_detail_SALES.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -42,6 +42,7 @@ # 150516-1309 - Fixed Javascript element problem, Issue #857 # 170409-1535 - Added IP List validation code # 220303-1439 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -84,9 +85,9 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} -if (!isset($users)) {$users = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} +if (!is_array($users)) {$users = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} @@ -1044,9 +1045,6 @@ while ($n < $j) } ### END loop through each status ### -$TOTcalls = sprintf("%7s", $TOTcalls); -$TOT_AGENTS = sprintf("%-4s", $m); - if ($TOTtotTALK < 1) {$TOTavgTALK = '0';} else {$TOTavgTALK = ($TOTtotTALK / $TOTcalls);} if ($TOTtotDISPO < 1) {$TOTavgDISPO = '0';} @@ -1103,12 +1101,14 @@ while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1 while(strlen($TOTavgCUSTOMER_MS)>6) {$TOTavgCUSTOMER_MS = substr("$TOTavgCUSTOMER_MS", 0, -1);} $grand_total_hours=($TOTtime/3600); -$STOTsales_per_call=sprintf("%.2f", (100*($Sgrand_total_sales/$TOTcalls)))." %"; -$STOTsales_per_hour=sprintf("%.2f", ($Sgrand_total_sales/$grand_total_hours)); +$STOTsales_per_call=sprintf("%.2f", (100*(MathZDC($Sgrand_total_sales, $TOTcalls))))." %"; +$STOTsales_per_hour=sprintf("%.2f", (MathZDC($Sgrand_total_sales, $grand_total_hours))); $STOTsales_per_call=sprintf("%13s", $STOTsales_per_call); $STOTsales_per_hour=sprintf("%14s", $STOTsales_per_hour); $Sgrand_total_sales=sprintf("%11s", $Sgrand_total_sales); +$TOTcalls = sprintf("%7s", $TOTcalls); +$TOT_AGENTS = sprintf("%-4s", $m); $ASCII_text.="+-----------------+----------+----------------------+----------------------+---------------+----------------+-------------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; $ASCII_text.="| TOTALS AGENTS:$TOT_AGENTS | $STOTsales_per_call | $STOTsales_per_hour | $Sgrand_total_sales | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$TOTtotDEAD_MS| $TOTavgDEAD_MS |$TOTtotCUSTOMER_MS| $TOTavgCUSTOMER_MS |$SUMstatusesHTML\n"; diff --git a/www/vicidial/AST_agent_performance_detail_mobile.php b/www/vicidial/AST_agent_performance_detail_mobile.php index 2f39ab7d..0676b003 100644 --- a/www/vicidial/AST_agent_performance_detail_mobile.php +++ b/www/vicidial/AST_agent_performance_detail_mobile.php @@ -1,12 +1,13 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # # 200318-1122 - First build, based upon AST_agent_performance_detail.php # 220303-0812 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -65,9 +66,9 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} -if (!isset($users)) {$users = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} +if (!is_array($users)) {$users = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (!isset($query_time)) {$query_time = "00:00:00";} diff --git a/www/vicidial/AST_agent_status_detail.php b/www/vicidial/AST_agent_status_detail.php index a5515edb..bdfc2ad5 100644 --- a/www/vicidial/AST_agent_status_detail.php +++ b/www/vicidial/AST_agent_status_detail.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -39,6 +39,7 @@ # 191013-0904 - Fixes for PHP7 # 200605-1100 - user_group bug fix # 220303-1433 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -83,8 +84,8 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} @@ -531,6 +532,7 @@ else } $query_date_BEGIN = "$query_date $time_BEGIN"; $query_date_END = "$end_date $time_END"; + if (!is_array($sub_statusesARY)) {$sub_statusesARY=array();} if ($file_download < 1) { diff --git a/www/vicidial/AST_agent_time_detail.php b/www/vicidial/AST_agent_time_detail.php index 37725705..889b13f8 100644 --- a/www/vicidial/AST_agent_time_detail.php +++ b/www/vicidial/AST_agent_time_detail.php @@ -4,7 +4,7 @@ # Pulls time stats per agent selectable by campaign or user group # should be most accurate agent stats of all of the reports # -# Copyright (C) 2023 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # 90522-0723 - First build @@ -60,6 +60,7 @@ # 211115-1513 - Fix for case-mismatch on pause code statuses for multi-campaign selects # 220303-1427 - Added allow_web_debug system setting # 230526-1740 - Patch for user_group bug, related to Issue #1346 +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -112,8 +113,8 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} diff --git a/www/vicidial/AST_agent_time_sheet.php b/www/vicidial/AST_agent_time_sheet.php index b6a28854..d4ca121a 100644 --- a/www/vicidial/AST_agent_time_sheet.php +++ b/www/vicidial/AST_agent_time_sheet.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -32,6 +32,7 @@ # 220811-1440 - Modified for date ranges instead of single-day # 220822-1728 - Changed total login time calculation to work for multi-day ranges # 221005-1647 - Added JS calendar functionality for date fields +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -418,13 +419,13 @@ $subcamp_color = '#C6C6C6'; #require("admin_header.php"); -$MAIN.="
".$did." - ".$did_pattern_info["$did"]."$value
"._QXZ("TOTAL")."$int_name "._QXZ("seconds").":".$sum."$delta  ".sprintf("%.1f", ((100*$sum)/$answered_inbound_calls))." %".sprintf("%.1f", ((100*$sum)/$total_inbound_calls))." %".sprintf("%.1f", (MathZDC((100*$sum), $answered_inbound_calls)))." %".sprintf("%.1f", (MathZDC((100*$sum), $total_inbound_calls)))." %
\n"; +$MAIN.="\n"; +$MAIN.="
\n"; $MAIN.=_QXZ("Agent Time Sheet for").": $user\n"; $MAIN.="
\n"; $MAIN.="
    \n"; $MAIN.=""; -$MAIN.=""; +$MAIN.=""; $MAIN.="\n"; -$MAIN.=""; +$MAIN.=""; $MAIN.=""; -$MAIN.="\n"; +$MAIN.="\n"; @@ -482,14 +483,16 @@ $HTML_text.="\n"; if ($archives_available=="Y") { - $MAIN.="\n"; + $MAIN.="\n"; } -$MAIN.="
"._QXZ("Date").":
"._QXZ("Date").":"; $MAIN.="\n"; $MAIN.=""._QXZ("To").":"._QXZ("To").":"; $MAIN.="\n"; $MAIN.="
"._QXZ("User ID").":
"._QXZ("User ID").":
"._QXZ("Search archived data")."
"._QXZ("Search archived data")."
"; -$MAIN.="

\n"; - +$MAIN.="

"; $MAIN.="\n"; -$MAIN.="\n\n"; +$MAIN.="
"; +$MAIN.="
\n"; + +$MAIN.="\n\n"; $MAIN.="
\n";
 
@@ -619,8 +622,10 @@ $CSV_text1.=$CSV_login;
 ##### vicidial_timeclock log records for user #####
 
 $total_login_time=0;
-$SQday_ARY =	explode('-',$query_date_BEGIN);
-$EQday_ARY =	explode('-',$end_date_END);
+$query_date_BEGIN_ary=explode(" ", $query_date_BEGIN);
+$end_date_END_ary=explode(" ", $end_date_END);
+$SQday_ARY =	explode('-',$query_date_BEGIN_ary[0]);
+$EQday_ARY =	explode('-',$end_date_END_ary[0]);
 $SQepoch = mktime(0, 0, 0, $SQday_ARY[1], $SQday_ARY[2], $SQday_ARY[0]);
 $EQepoch = mktime(23, 59, 59, $EQday_ARY[1], $EQday_ARY[2], $EQday_ARY[0]);
 
diff --git a/www/vicidial/AST_agent_timeclock_detail.php b/www/vicidial/AST_agent_timeclock_detail.php
index 04cb2a29..8b6a6a5f 100644
--- a/www/vicidial/AST_agent_timeclock_detail.php
+++ b/www/vicidial/AST_agent_timeclock_detail.php
@@ -3,7 +3,7 @@
 # 
 # Pulls all timeclock records for an agent
 #
-# Copyright (C) 2022  Matt Florell     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 # 90602-2244 - First build
@@ -30,6 +30,7 @@
 # 171012-2015 - Fixed javascript/apache errors with graphs
 # 191013-0833 - Fixes for PHP7
 # 220227-0927 - Added allow_web_debug system setting
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -68,8 +69,8 @@ $MT[0]='';
 $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
-if (!isset($group)) {$group = array();}
-if (!isset($user_group)) {$user_group = array();}
+if (!is_array($group)) {$group = array();}
+if (!is_array($user_group)) {$user_group = array();}
 if (!isset($query_date)) {$query_date = "$NOW_DATE 00:00:00";}
 if (!isset($end_date)) {$end_date = "$NOW_DATE 23:59:59";}
 if (strlen($shift)<2) {$shift='ALL';}
diff --git a/www/vicidial/AST_campaign_status_list_report.php b/www/vicidial/AST_campaign_status_list_report.php
index b5990f08..db9de0f8 100644
--- a/www/vicidial/AST_campaign_status_list_report.php
+++ b/www/vicidial/AST_campaign_status_list_report.php
@@ -4,7 +4,7 @@
 # This report is designed to show the breakdown by list_id of the calls and 
 # their statuses for all lists within a campaign for a set time period
 #
-# Copyright (C) 2022  Joe Johnson, Matt Florell     LICENSE: AGPLv2
+# Copyright (C) 2024  Joe Johnson, Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 #
@@ -30,6 +30,7 @@
 # 180807-1204 - Fixed log query issue
 # 191013-0832 - Fixes for PHP7
 # 220303-0812 - Added allow_web_debug system setting
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -66,7 +67,7 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
 
 $report_name="Campaign Status List Report";
 $NOW_DATE = date("Y-m-d");
-if (!isset($group)) {$group=array();}
+if (!is_array($group)) {$group=array();}
 if (!isset($query_date_D)) {$query_date_D=$NOW_DATE;}
 if (!isset($end_date_D)) {$end_date_D=$NOW_DATE;}
 if (!isset($query_date_T)) {$query_date_T="00:00:00";}
diff --git a/www/vicidial/AST_carrier_log_report.php b/www/vicidial/AST_carrier_log_report.php
index a37ff71d..a4c837d6 100644
--- a/www/vicidial/AST_carrier_log_report.php
+++ b/www/vicidial/AST_carrier_log_report.php
@@ -1,7 +1,7 @@
     LICENSE: AGPLv2
+# Copyright (C) 2024  Joe Johnson, Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 # 120210-2202 - First build
@@ -18,6 +18,7 @@
 # 191013-0815 - Fixes for PHP7
 # 220303-0925 - Added allow_web_debug system setting
 # 220812-0952 - Added User Group report permissions checking
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -57,7 +58,7 @@ if (isset($_GET["report_display_type"]))			{$report_display_type=$_GET["report_d
 $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
 
 $NOW_DATE = date("Y-m-d");
-if (!isset($server_ip)) {$server_ip = array();}
+if (!is_array($server_ip)) {$server_ip = array();}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (strlen($query_date_D) < 6) {$query_date_D = "00:00:00";}
 if (strlen($query_date_T) < 6) {$query_date_T = "23:59:59";}
diff --git a/www/vicidial/AST_chat_log_report.php b/www/vicidial/AST_chat_log_report.php
index 16b7dae7..43f8bd7c 100644
--- a/www/vicidial/AST_chat_log_report.php
+++ b/www/vicidial/AST_chat_log_report.php
@@ -1,7 +1,7 @@
 , Joe Johnson     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell , Joe Johnson     LICENSE: AGPLv2
 #
 # This is the report page where you can view report information of any of the dialer's chats.  The web page will 
 # display the information about the chat, including the start time and participants, and will also provide links 
@@ -15,6 +15,7 @@
 # 170409-1550 - Added IP List validation code
 # 191013-0857 - Fixes for PHP7
 # 220303-0909 - Added allow_web_debug system setting
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -71,10 +72,10 @@ $MT[0]='';
 $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
-if (!isset($group)) {$group = array();}
-if (!isset($inbound_group)) {$inbound_group = array();}
-if (!isset($user_group)) {$user_group = array();}
-if (!isset($users)) {$users = array();}
+if (!is_array($group)) {$group = array();}
+if (!is_array($inbound_group)) {$inbound_group = array();}
+if (!is_array($user_group)) {$user_group = array();}
+if (!is_array($users)) {$users = array();}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (!isset($end_date)) {$end_date = $NOW_DATE;}
 if (strlen($shift)<2) {$shift='ALL';}
diff --git a/www/vicidial/AST_dial_log_report.php b/www/vicidial/AST_dial_log_report.php
index dcab820f..0bf5f088 100644
--- a/www/vicidial/AST_dial_log_report.php
+++ b/www/vicidial/AST_dial_log_report.php
@@ -1,7 +1,7 @@
     LICENSE: AGPLv2
+# Copyright (C) 2024  Joe Johnson, Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 # 130709-1346 - First build
@@ -16,6 +16,7 @@
 # 210129-1010 - Added archive search option, issue #1222
 # 220303-0812 - Added allow_web_debug system setting
 # 220812-0953 - Added User Group report permissions checking
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -156,8 +157,8 @@ $NOW_DATE = date("Y-m-d");
 if (strlen($query_date_D) < 6) {$query_date_D = "00:00:00";}
 if (strlen($query_date_T) < 6) {$query_date_T = "23:59:59";}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
-if (!isset($server_ip)) {$server_ip = array();}
-if (!isset($sip_hangup_cause)) {$sip_hangup_cause = array();}
+if (!is_array($server_ip)) {$server_ip = array();}
+if (!is_array($sip_hangup_cause)) {$sip_hangup_cause = array();}
 
 #############################################
 ##### START SYSTEM_SETTINGS LOOKUP #####
diff --git a/www/vicidial/AST_dialer_inventory_report.php b/www/vicidial/AST_dialer_inventory_report.php
index 0671ecac..f1d27dd6 100644
--- a/www/vicidial/AST_dialer_inventory_report.php
+++ b/www/vicidial/AST_dialer_inventory_report.php
@@ -1,7 +1,7 @@
     LICENSE: AGPLv2
+# Copyright (C) 2024  Joe Johnson     LICENSE: AGPLv2
 #                     Matt Florell 
 #
 # NOTES:
@@ -27,6 +27,7 @@
 # 170829-0040 - Added screen color settings
 # 191013-0845 - Fixes for PHP7
 # 220303-0803 - Added allow_web_debug system setting
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -71,7 +72,7 @@ $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $time_start = microtime(true);
 $STARTtime = date("U");
-if (!isset($group)) {$group = array();}
+if (!is_array($group)) {$group = array();}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (!isset($end_date)) {$end_date = $NOW_DATE;}
 
diff --git a/www/vicidial/AST_email_log_report.php b/www/vicidial/AST_email_log_report.php
index bf9d7889..b2b60435 100644
--- a/www/vicidial/AST_email_log_report.php
+++ b/www/vicidial/AST_email_log_report.php
@@ -1,7 +1,7 @@
     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell     LICENSE: AGPLv2
 #
 # report of emails handled by the system
 # 
@@ -22,12 +22,13 @@
 # 170829-0040 - Added screen color settings
 # 191013-0823 - Fixes for PHP7
 # 220303-0223 - Added allow_web_debug system setting
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
 
-$version = '2.14-14';
-$build = '220303-0223';
+$version = '2.14-15';
+$build = '240801-1130';
 
 header ("Content-type: text/html; charset=utf-8");
 
@@ -64,7 +65,7 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
 $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
-if (!isset($group)) {$group = array();}
+if (!is_array($group)) {$group = array();}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (!isset($end_date)) {$end_date = $NOW_DATE;}
 
diff --git a/www/vicidial/AST_hangup_cause_report.php b/www/vicidial/AST_hangup_cause_report.php
index 38d75dac..7cda4f93 100644
--- a/www/vicidial/AST_hangup_cause_report.php
+++ b/www/vicidial/AST_hangup_cause_report.php
@@ -1,7 +1,7 @@
     LICENSE: AGPLv2
+# Copyright (C) 2024  Joe Johnson, Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 # 120331-2301 - First build
@@ -21,6 +21,7 @@
 # 201218-1700 - Modified to include caller ID in results
 # 220302-1813 - Added allow_web_debug system setting
 # 220812-0940 - Added User Group report permissions checking
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -69,10 +70,10 @@ $START_TIME=date("U");
 $NOW_DATE = date("Y-m-d");
 if (strlen($query_date_D) < 6) {$query_date_D = "00:00:00";}
 if (strlen($query_date_T) < 6) {$query_date_T = "23:59:59";}
-if (!isset($server_ip)) {$server_ip = array();}
-if (!isset($hangup_cause)) {$hangup_cause = array();}
-if (!isset($dial_status)) {$dial_status = array();}
-if (!isset($sip_hangup_cause)) {$sip_hangup_cause = array();}
+if (!is_array($server_ip)) {$server_ip = array();}
+if (!is_array($hangup_cause)) {$hangup_cause = array();}
+if (!is_array($dial_status)) {$dial_status = array();}
+if (!is_array($sip_hangup_cause)) {$sip_hangup_cause = array();}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 
 #############################################
diff --git a/www/vicidial/AST_inbound_daily_report.php b/www/vicidial/AST_inbound_daily_report.php
index 9b97e400..31d2e3d8 100644
--- a/www/vicidial/AST_inbound_daily_report.php
+++ b/www/vicidial/AST_inbound_daily_report.php
@@ -1,7 +1,7 @@
     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 #
@@ -36,6 +36,7 @@
 # 200701-1500 - Added option to exclude after-hours from abandons, list ID filtering
 # 220302-1803 - Added allow_web_debug system setting
 # 230526-1740 - Patch for user_group bug, related to Issue #1346
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -88,8 +89,8 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
 $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
-if (!isset($group)) {$group = array();}
-if (!isset($list_ids)) {$list_ids = array(); $all_lists_selected="selected";}
+if (!is_array($group)) {$group = array();}
+if (!is_array($list_ids)) {$list_ids = array(); $all_lists_selected="selected";}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (!isset($end_date)) {$end_date = $NOW_DATE;}
 if (strlen($shift)<2) {$shift='ALL';}
@@ -1592,7 +1593,7 @@ else
 				}
 			}
 
-		if (!isset($totAGENTSdate[$d])) {$totAGENTSdate[$d]=array();}
+		if (!is_array($totAGENTSdate[$d])) {$totAGENTSdate[$d]=array();}
 		$totAGENTSdayCOUNT=count($totAGENTSdate[$d]);
 		$totAGENTSday=sprintf("%8s", count($totAGENTSdate[$d]));
 
diff --git a/www/vicidial/AST_inbound_forecasting.php b/www/vicidial/AST_inbound_forecasting.php
index f3296e14..e3506288 100644
--- a/www/vicidial/AST_inbound_forecasting.php
+++ b/www/vicidial/AST_inbound_forecasting.php
@@ -1,7 +1,7 @@
 , Joe Johnson     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell , Joe Johnson     LICENSE: AGPLv2
 #
 # CHANGES
 #
@@ -15,6 +15,7 @@
 # 210823-0948 - Fix for security issue, added NONE option for campaigns
 # 220301-2219 - Added allow_web_debug system setting
 # 230526-1740 - Patch for user_group bug, related to Issue #1346
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -105,11 +106,12 @@ $MT[0]='';
 $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
-if (!isset($group)) {$group = array();}
-if (!isset($campaign)) {$campaign = array();}
+if (!is_array($group)) {$group = array();}
+if (!is_array($campaign)) {$campaign = array();}
 if (!isset($drop_percent)) {$drop_percent = '3';}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (!isset($end_date)) {$end_date = $NOW_DATE;}
+if (!isset($target_pqueue)) {$target_pqueue=0;}
 if (strlen($shift)<2) {$shift='ALL';}
 
 $report_name = 'Inbound Forecasting Report';
diff --git a/www/vicidial/AST_performance_comparison_report.php b/www/vicidial/AST_performance_comparison_report.php
index 5dd19320..b143ccf6 100644
--- a/www/vicidial/AST_performance_comparison_report.php
+++ b/www/vicidial/AST_performance_comparison_report.php
@@ -1,7 +1,7 @@
 , Joe Johnson , Joe Johnson     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell     LICENSE: AGPLv2
 #
 # Report for QC activity within VICIdial
 #
@@ -9,6 +9,7 @@
 # 210306-1556 - First Build
 # 210827-1818 - Fix for security issue
 # 220302-0927 - Added allow_web_debug system setting
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $admin_version = '2.14-3';
@@ -70,12 +71,12 @@ $MT[0]='';
 $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
-if (!isset($group) || !is_array($group)) {$group = array();}
-if (!isset($users) || !is_array($users)) {$users = array();}
-if (!isset($user_groups) || !is_array($user_groups)) {$user_groups = array();}
-if (!isset($QCusers) || !is_array($QCusers)) {$QCusers = array();}
-if (!isset($QCstatuses) || !is_array($QCstatuses)) {$QCstatuses = array();}
-if (!isset($QCuser_groups) || !is_array($QCuser_groups)) {$QCuser_groups = array();}
+if (!is_array($group)) {$group = array();}
+if (!is_array($users)) {$users = array();}
+if (!is_array($user_groups)) {$user_groups = array();}
+if (!is_array($QCusers)) {$QCusers = array();}
+if (!is_array($QCstatuses)) {$QCstatuses = array();}
+if (!is_array($QCuser_groups)) {$QCuser_groups = array();}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (!isset($end_date)) {$end_date = $NOW_DATE;}
 if (!isset($query_time)) {$query_time = "00:00:00";}
diff --git a/www/vicidial/AST_recording_log_report.php b/www/vicidial/AST_recording_log_report.php
index 66c353f4..1f3b50ea 100644
--- a/www/vicidial/AST_recording_log_report.php
+++ b/www/vicidial/AST_recording_log_report.php
@@ -3,7 +3,7 @@
 #
 # This report is for viewing the a report of which users accessed which recordings
 #
-# Copyright (C) 2022  Joe Johnson, Matt Florell     LICENSE: AGPLv2
+# Copyright (C) 2024  Joe Johnson, Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 #
@@ -14,6 +14,7 @@
 # 191013-0830 - Fixes for PHP7
 # 220302-0912 - Added allow_web_debug system setting
 # 220307-2323 - Fix for display issue
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -57,8 +58,8 @@ if (isset($_GET["DB"]))					{$DB=$_GET["DB"];}
 $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
 
 $NOW_DATE = date("Y-m-d");
-if (!isset($users)) {$users=array();}
-if (!isset($user_group)) {$user_group=array();}
+if (!is_array($users)) {$users=array();}
+if (!is_array($user_group)) {$user_group=array();}
 if (!isset($access_date_D)) {$access_date_D=$NOW_DATE;}
 if (!isset($access_date_end_D)) {$access_date_end_D=$NOW_DATE;}
 if (!isset($access_date_T)) {$access_date_T="00:00:00";}
diff --git a/www/vicidial/AST_rt_monitor_log_report.php b/www/vicidial/AST_rt_monitor_log_report.php
index 6b6047b4..8f524900 100644
--- a/www/vicidial/AST_rt_monitor_log_report.php
+++ b/www/vicidial/AST_rt_monitor_log_report.php
@@ -1,7 +1,7 @@
 , Joe Johnson     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell , Joe Johnson     LICENSE: AGPLv2
 #
 # CHANGES
 #
@@ -11,6 +11,7 @@
 # 180712-1508 - Fix for rare allowed reports issue
 # 191013-0906 - Fixes for PHP7
 # 220302-0849 - Added allow_web_debug system setting
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -60,9 +61,9 @@ $MT[0]='';
 $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
-if (!isset($campaign)) {$campaign = array();}
-if (!isset($managers)) {$managers = array();}
-if (!isset($users)) {$users = array();}
+if (!is_array($campaign)) {$campaign = array();}
+if (!is_array($managers)) {$managers = array();}
+if (!is_array($users)) {$users = array();}
 if (!isset($report_display_type)) {$report_display_type = "HTML";}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (!isset($end_date)) {$end_date = $NOW_DATE;}
diff --git a/www/vicidial/AST_rt_whiteboard_rpt.php b/www/vicidial/AST_rt_whiteboard_rpt.php
index cb35846c..ce1b2d31 100644
--- a/www/vicidial/AST_rt_whiteboard_rpt.php
+++ b/www/vicidial/AST_rt_whiteboard_rpt.php
@@ -1,7 +1,7 @@
 , Joe Johnson     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell , Joe Johnson     LICENSE: AGPLv2
 #
 # Real-time report that allows users to create a customized, graphical display of various data sets
 #
@@ -13,6 +13,7 @@
 # 210827-1818 - Fix for security issue
 # 220221-1505 - Added allow_web_debug system setting
 # 220823-1327 - Fix for warnings being thrown on arrays
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -66,11 +67,11 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (!isset($end_date)) {$end_date = $NOW_DATE;}
 if (!isset($query_time)) {$query_time="08:00:00";}
 if (!isset($end_time)) {$end_time="17:00:00";}
-if (!isset($campaigns)) {$campaigns = array(); if ($DB) {echo "\$campaigns not set, making array...\n".(is_array($campaigns) ? "Yes" : "No");} } else {if ($DB) {echo "\$campaigns IS set: $campaigns\n";} }
-if (!isset($users)) {$users = array();}
-if (!isset($user_groups)) {$user_groups = array();}
-if (!isset($dids)) {$dids = array();}
-if (!isset($groups)) {$groups = array();}
+if (!is_array($campaigns)) {$campaigns = array(); if ($DB) {echo "\$campaigns not set, making array...\n".(is_array($campaigns) ? "Yes" : "No");} } else {if ($DB) {echo "\$campaigns IS set: $campaigns\n";} }
+if (!is_array($users)) {$users = array();}
+if (!is_array($user_groups)) {$user_groups = array();}
+if (!is_array($dids)) {$dids = array();}
+if (!is_array($groups)) {$groups = array();}
 if (!isset($report_display_type)) {$report_display_type = "HTML";}
 if (strlen($shift)<2) {$shift='ALL';}
 
diff --git a/www/vicidial/AST_rt_whiteboard_rpt_mobile.php b/www/vicidial/AST_rt_whiteboard_rpt_mobile.php
index 587adf42..a3a5deb9 100644
--- a/www/vicidial/AST_rt_whiteboard_rpt_mobile.php
+++ b/www/vicidial/AST_rt_whiteboard_rpt_mobile.php
@@ -1,7 +1,7 @@
 , Joe Johnson     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell , Joe Johnson     LICENSE: AGPLv2
 #
 # Mobile version of real-time report that allows users to create a customized, graphical display of various data sets
 #
@@ -9,6 +9,7 @@
 # 200309-1819 - Modifications for display formatting
 # 210827-1818 - Fix for security issue
 # 220221-1513 - Added allow_web_debug system setting
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -237,7 +238,11 @@ if ( (!preg_match('/\-\-ALL\-\-/i', $LOGadmin_viewable_call_times)) and (strlen(
 $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
-if (!isset($groups) || !is_array($groups)) {$groups = array();}
+if (!is_array($groups)) {$groups = array();}
+if (!is_array($campaigns)) {$campaigns = array();}
+if (!is_array($users)) {$users = array();}
+if (!is_array($user_groups)) {$user_groups = array();}
+if (!is_array($dids)) {$dids = array();}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (!isset($end_date)) {$end_date = $NOW_DATE;}
 
@@ -406,11 +411,6 @@ $MT[0]='';
 $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
-if (!isset($campaigns)) {$campaign = array();}
-if (!isset($users)) {$users = array();}
-if (!isset($user_groups)) {$user_groups = array();}
-if (!isset($dids)) {$dids = array();}
-if (!isset($groups)) {$groups = array();}
 if (!isset($report_display_type)) {$report_display_type = "HTML";}
 if (!isset($query_date)) {$query_date = $NOW_DATE;}
 if (!isset($end_date)) {$end_date = $NOW_DATE;}
diff --git a/www/vicidial/AST_source_vlc_status_report.php b/www/vicidial/AST_source_vlc_status_report.php
index 974bd3b3..6e8b8ae0 100644
--- a/www/vicidial/AST_source_vlc_status_report.php
+++ b/www/vicidial/AST_source_vlc_status_report.php
@@ -5,7 +5,7 @@
 # or aource_id ,user's choice, of the calls and their statuses for all lists 
 # within a campaign for a set time period
 #
-# Copyright (C) 2022  Joe Johnson, Matt Florell     LICENSE: AGPLv2
+# Copyright (C) 2024  Joe Johnson, Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 #
@@ -14,6 +14,7 @@
 # 180507-2315 - Added new help display
 # 191013-0834 - Fixes for PHP7
 # 220302-0835 - Added allow_web_debug system setting
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -53,7 +54,7 @@ if (isset($_GET["search_archived_data"]))			{$search_archived_data=$_GET["search
 $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
 
 $NOW_DATE = date("Y-m-d");
-if (!isset($group)) {$group=array();}
+if (!is_array($group)) {$group=array();}
 if (!isset($query_date_D)) {$query_date_D=$NOW_DATE;}
 if (!isset($end_date_D)) {$end_date_D=$NOW_DATE;}
 if (!isset($query_date_T)) {$query_date_T="00:00:00";}
diff --git a/www/vicidial/AST_team_performance_detail.php b/www/vicidial/AST_team_performance_detail.php
index 41d198b3..d3b053b3 100644
--- a/www/vicidial/AST_team_performance_detail.php
+++ b/www/vicidial/AST_team_performance_detail.php
@@ -6,7 +6,7 @@
 # QC statuses of QCFAIL, QCCANC and sales are defined by the Sale=Y status
 # flags being set on those statuses.
 #
-# Copyright (C) 2023  Joe Johnson, Matt Florell     LICENSE: AGPLv2
+# Copyright (C) 2024  Joe Johnson, Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 #
@@ -37,6 +37,7 @@
 # 210222-1508 - Added option to show all users
 # 220301-2155 - Added allow_web_debug system setting
 # 230407-1039 - Added include_sales_in_TPD_report option
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $startMS = microtime();
@@ -81,9 +82,10 @@ $MT[0]='';
 $NOW_DATE = date("Y-m-d");
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
-if (!isset($group)) {$group = array();}
-if (!isset($user_group)) {$user_group = array();}
-if (!isset($call_statuses)) {$call_statuses = array();}
+if (!is_array($group)) {$group = array();}
+if (!is_array($user_group)) {$user_group = array();}
+if (!is_array($call_status)) {$call_status = array();}
+if (!is_array($call_statuses)) {$call_statuses = array();}
 if (!isset($query_date_D)) {$query_date_D=$NOW_DATE;}
 if (!isset($end_date_D)) {$end_date_D=$NOW_DATE;}
 if (!isset($query_date_T)) {$query_date_T="00:00:00";}
diff --git a/www/vicidial/AST_timeonVDADall.php b/www/vicidial/AST_timeonVDADall.php
index 62581dd5..22717001 100644
--- a/www/vicidial/AST_timeonVDADall.php
+++ b/www/vicidial/AST_timeonVDADall.php
@@ -1,7 +1,7 @@
     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell     LICENSE: AGPLv2
 #
 # live real-time stats for the VICIDIAL Auto-Dialer all servers
 #
@@ -132,6 +132,7 @@
 # 230421-1636 - Added RS_UGlatencyRESTRICT options.php setting
 # 230811-1530 - Added realtime monitoring display information
 # 231115-1656 - Added RS_no_DEAD_status and RS_hide_CUST_info options.php settings
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 $version = '2.14-117';
@@ -329,9 +330,9 @@ if (strlen($report_display_type)<2) {$report_display_type = $SSreport_default_fo
 if (!isset($DB))			{$DB=0;}
 if (!isset($RR))			{$RR=40;}
 if (!isset($group))			{$group='ALL-ACTIVE';}
-if (!isset($groups))		{$groups=array();}
-if (!isset($user_group_filter))		{$user_group_filter=array();}
-if (!isset($ingroup_filter))		{$ingroup_filter=array();}
+if (!is_array($groups))		{$groups=array();}
+if (!is_array($user_group_filter))		{$user_group_filter=array();}
+if (!is_array($ingroup_filter))		{$ingroup_filter=array();}
 if (!isset($usergroup))		{$usergroup='';}
 if (!isset($UGdisplay))		{$UGdisplay=0;}	# 0=no, 1=yes
 if (!isset($UidORname))		{$UidORname=1;}	# 0=id, 1=name
diff --git a/www/vicidial/AST_timeonVDADallSUMMARY_mobile.php b/www/vicidial/AST_timeonVDADallSUMMARY_mobile.php
index ca70a5d7..b87e4cff 100644
--- a/www/vicidial/AST_timeonVDADallSUMMARY_mobile.php
+++ b/www/vicidial/AST_timeonVDADallSUMMARY_mobile.php
@@ -1,7 +1,7 @@
 , Joe Johnson     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell , Joe Johnson     LICENSE: AGPLv2
 #
 # Mobile version of summary report for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers
 #
@@ -12,6 +12,7 @@
 # 190129-1258 - First release
 # 200414-2000 - Minor display modifications, auto-selecting refresh rate onload
 # 220301-2036 - Added allow_web_debug system setting
+# 240801-1130 - Code updates for PHP8 compatibility
 #
 
 require("dbconnect_mysqli.php");
@@ -45,7 +46,7 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
 $NOW_TIME = date("Y-m-d H:i:s");
 $STARTtime = date("U");
 if (!isset($browser_dimension))	{$browser_dimension=800;}
-if (!isset($types))			{$types='LIST ALL CAMPAIGNS';}
+if (!is_array($types))			{$types=array('LIST ALL CAMPAIGNS');}
 $cell_dimension=floor($browser_dimension/10);
 
 $report_name = 'Real-Time Campaign Summary';
diff --git a/www/vicidial/AST_timeonVDADall_mobile.php b/www/vicidial/AST_timeonVDADall_mobile.php
index 48d6653d..d33f94b1 100644
--- a/www/vicidial/AST_timeonVDADall_mobile.php
+++ b/www/vicidial/AST_timeonVDADall_mobile.php
@@ -1,7 +1,7 @@
     LICENSE: AGPLv2
+# Copyright (C) 2024  Matt Florell     LICENSE: AGPLv2
 #
 # live real-time stats for the VICIDIAL Auto-Dialer all servers
 #
@@ -10,10 +10,11 @@
 # CHANGELOG:
 # 200318-1124 - First build, based upon AST_timeonVDADall.php
 # 220221-1536 - Added allow_web_debug system setting
+# 240801-1137 - Code updates for PHP8 compatibility
 #
 
-$version = '2.14-2';
-$build = '220221-1536';
+$version = '2.14-3';
+$build = '240801-1137';
 
 header ("Content-type: text/html; charset=utf-8");
 
@@ -154,9 +155,9 @@ if (file_exists('options.php'))
 if (!isset($DB))			{$DB=0;}
 if (!isset($RR))			{$RR=40;}
 if (!isset($group))			{$group='ALL-ACTIVE';}
-if (!isset($groups))		{$groups=array();}
-if (!isset($user_group_filter))		{$user_group_filter=array();}
-if (!isset($ingroup_filter))		{$ingroup_filter=array();}
+if (!is_array($groups))		{$groups=array();}
+if (!is_array($user_group_filter))		{$user_group_filter=array();}
+if (!is_array($ingroup_filter))		{$ingroup_filter=array();}
 if (!isset($usergroup))		{$usergroup='';}
 if (!isset($UGdisplay))		{$UGdisplay=0;}	# 0=no, 1=yes
 if (!isset($UidORname))		{$UidORname=1;}	# 0=id, 1=name
@@ -693,19 +694,19 @@ $NFB = '';
 $NFE = '';
 $F=''; $FG=''; $B=''; $BG='';
 
-$select_list = "\n";
 	echo "
"._QXZ("Select Campaigns").":
"; +$select_list = ""; $select_list .= ""; $select_list .= "
"._QXZ("Select Campaigns").":
"; $select_list .= ""; -$select_list .= "
"._QXZ("(To select more than 1 campaign, hold down the Ctrl key and click)").""; +$select_list .= "
"._QXZ("(To select more than 1 campaign, hold down the Ctrl key and click)").""; $select_list .= "

"._QXZ("Select User Groups").":
"; $select_list .= ""; @@ -739,36 +740,36 @@ while ($o < $ingroups_to_print) $select_list .= ""; $select_list .= "
"; -$select_list .= ""._QXZ("Close Panel")."

"; +$select_list .= ""._QXZ("Close Panel")."

"; $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= ""; @@ -794,12 +795,12 @@ if ($UGdisplay > 0) $select_list .= ""; @@ -807,30 +808,30 @@ if ($UGdisplay > 0) $select_list .= ""; $select_list .= ""; $select_list .= ""; @@ -850,10 +851,10 @@ if ($presets_enabled > 0) { $select_list .= ""; @@ -861,10 +862,10 @@ if ($presets_enabled > 0) $select_list .= ""; @@ -892,14 +893,14 @@ $select_list .= ">"._QXZ("WALL_4").""; $select_list .= ""; $select_list .= "
"; $select_list .= _QXZ("Inbound").":
"; $select_list .= _QXZ("Monitor").":
"; $select_list .= _QXZ("Phone").": "; -$select_list .= ""; +$select_list .= ""; $select_list .= "
 
"; $select_list .= _QXZ("Select User Group").": "; $select_list .= "
"; $select_list .= _QXZ("Dialable Leads Alert").":
"; $select_list .= _QXZ("Show Drop In-Group Row").":
"; $select_list .= _QXZ("Show Carrier Stats").":
"; $select_list .= _QXZ("Show Presets Stats").":
"; $select_list .= _QXZ("Agent Time Stats").":

"; -$select_list .= ""; -$select_list .= "         "; +$select_list .= ""; +$select_list .= "         "; $select_list .= "
"; -$select_list .= "   "; +$select_list .= "   "; $select_list .= ""; -$select_list .= ""._QXZ("VERSION").": $version   "._QXZ("BUILD").": $build"; +$select_list .= ""._QXZ("VERSION").": $version   "._QXZ("BUILD").": $build"; $select_list .= "
"; $open_list = '
'._QXZ("Choose Report Display Options").'
'; @@ -1183,6 +1184,7 @@ else .Hfr3 {color: black; background-color: #FF6666; font-family: HELVETICA; font-size: 18; font-weight: bold;} .Hfr4 {color: white; background-color: #FF0000; font-family: HELVETICA; font-size: 18; font-weight: bold;} + .realtime_settings_table {width: 50vw; max-width: 600px; } LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # CHANGES # 130620-0806 - First build @@ -15,6 +15,7 @@ # 220301-1951 - Added allow_web_debug system setting # 220812-0931 - Added User Group report permissions checking # 230310-1051 - Added more missing url types +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -59,7 +60,7 @@ $NOW_DATE = date("Y-m-d"); if (strlen($query_date_D) < 6) {$query_date_D = "00:00:00";} if (strlen($query_date_T) < 6) {$query_date_T = "23:59:59";} if (!isset($query_date)) {$query_date = $NOW_DATE;} -if (!isset($url_type)) {$url_type = array();} +if (!is_array($url_type)) {$url_type = array();} ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### diff --git a/www/vicidial/AST_user_group_hourly_detail.php b/www/vicidial/AST_user_group_hourly_detail.php index 47ba4a52..41f25a8a 100644 --- a/www/vicidial/AST_user_group_hourly_detail.php +++ b/www/vicidial/AST_user_group_hourly_detail.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Joseph Johnson LICENSE: AGPLv2 # # Gives hourly count of distinct agents per user group, with totals. # For single days only @@ -15,6 +15,7 @@ # 191013-0855 - Fixes for PHP7 # 220221-0932 - Added allow_web_debug system setting # 230526-1740 - Patch for user_group bug, related to Issue #1346 +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -62,8 +63,8 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($start_hour)) {$start_hour = date("H");} if (!isset($end_hour)) {$end_hour = date("H");} diff --git a/www/vicidial/AST_user_group_hourly_detail_v2.php b/www/vicidial/AST_user_group_hourly_detail_v2.php index 181f117c..c64e73c9 100644 --- a/www/vicidial/AST_user_group_hourly_detail_v2.php +++ b/www/vicidial/AST_user_group_hourly_detail_v2.php @@ -1,7 +1,7 @@ +# Copyright (C) 2024 Liz Tejada # Joseph Johnson # Matt Florell # @@ -20,6 +20,7 @@ # 191013-0816 - Fixes for PHP7 # 220301-1940 - Added allow_web_debug system setting # 230526-1740 - Patch for user_group bug, related to Issue #1346 +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -68,8 +69,8 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($start_hour)) {$start_hour = date("H");} if (!isset($end_hour)) {$end_hour = date("H");} @@ -509,7 +510,8 @@ if ($SUBMIT && $query_date && $start_hour && $end_hour) { $UserGroups=array_unique($UserGroups); $hour_array=array_unique($hour_array); - $total_stmt="select user_group, count(distinct user) as ct from ".$vicidial_agent_log_table." where event_time>='$query_date $start_hour:00:00' and event_time<='$query_date $end_hour:59:59' $group_SQL $user_group_SQL group by user_group order by user_group,2"; + $total_stmt="select user_group, count(distinct user) as ct from ".$vicidial_agent_log_table." log where event_time>='$query_date $start_hour:00:00' and event_time<='$query_date $end_hour:59:59' $group_SQL $user_group_SQL group by user_group order by user_group,2"; + if ($DB) {$ASCII_text.="* ".$total_stmt."\n";} $total_rslt=mysql_to_mysqli($total_stmt, $link); if ($DB) {$ASCII_text.="* ".$total_stmt."\n";} $total_array=array(); @@ -517,7 +519,7 @@ if ($SUBMIT && $query_date && $start_hour && $end_hour) { $total_array[$total_row["user_group"]]+=$total_row["ct"]; } - $grand_total_stmt="select distinct user from ".$vicidial_agent_log_table." where event_time>='$query_date $start_hour:00:00' and event_time<='$query_date $end_hour:59:59' $group_SQL $user_group_SQL"; + $grand_total_stmt="select distinct user from ".$vicidial_agent_log_table." log where event_time>='$query_date $start_hour:00:00' and event_time<='$query_date $end_hour:59:59' $group_SQL $user_group_SQL"; $grand_total_rslt=mysql_to_mysqli($grand_total_stmt, $link); $grand_total=mysqli_num_rows($grand_total_rslt); @@ -539,16 +541,17 @@ if ($SUBMIT && $query_date && $start_hour && $end_hour) { foreach($UserGroups as $Ugroup){ foreach($hour_array as $hour){ - //echo "group-->". $data[0]." hour-->".$data[1]." agent-->".$data[2]."
"; + # echo "group-->". $data[0]." hour-->".$data[1]." agent-->".$data[2]."
"; $a=$allData[$Ugroup][$hour]; + if (is_array($a)) {$count_a=count($a);} else {$count_a=0;} if(isset($maxUserByUserGroup[$Ugroup])){ - if(count($a)>$maxUserByUserGroup[$Ugroup]){ - $maxUserByUserGroup[$Ugroup]=count($a); + if($count_a>$maxUserByUserGroup[$Ugroup]){ + $maxUserByUserGroup[$Ugroup]=$count_a; } }else{ - $maxUserByUserGroup[$Ugroup]=count($a); + $maxUserByUserGroup[$Ugroup]=$count_a; } } diff --git a/www/vicidial/AST_usergroup_login_report.php b/www/vicidial/AST_usergroup_login_report.php index 2524e559..e63b7c5b 100644 --- a/www/vicidial/AST_usergroup_login_report.php +++ b/www/vicidial/AST_usergroup_login_report.php @@ -4,7 +4,7 @@ # This User-Group based report runs some very intensive SQL queries, so it is # not recommended to run this on long time periods. # -# Copyright (C) 2023 Joe Johnson, Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -26,6 +26,7 @@ # 191013-0822 - Fixes for PHP7 # 220301-1656 - Added allow_web_debug system setting # 230526-1740 - Patch for user_group bug, related to Issue #1346 +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -56,7 +57,7 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($user_group)) {$user_group = array();} +if (!is_array($user_group)) {$user_group = array();} $report_name = 'User Group Login Report'; $db_source = 'M'; diff --git a/www/vicidial/AST_webserver_url_report.php b/www/vicidial/AST_webserver_url_report.php index df5fd03f..9ba2de34 100644 --- a/www/vicidial/AST_webserver_url_report.php +++ b/www/vicidial/AST_webserver_url_report.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # CHANGES # 140225-0229 - First build @@ -13,6 +13,7 @@ # 191013-0907 - Fixes for PHP7 # 220301-1616 - Added allow_web_debug system setting # 220812-0927 - Added User Group report permissions checking +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -58,8 +59,8 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $NOW_DATE = date("Y-m-d"); if (strlen($query_date_D) < 6) {$query_date_D = "00:00:00";} if (strlen($query_date_T) < 6) {$query_date_T = "23:59:59";} -if (!isset($webserver)) {$webserver = array();} -if (!isset($url)) {$url = array();} +if (!is_array($webserver)) {$webserver = array();} +if (!is_array($url)) {$url = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} diff --git a/www/vicidial/Erlang_report.php b/www/vicidial/Erlang_report.php index 27b21bb1..375872c8 100644 --- a/www/vicidial/Erlang_report.php +++ b/www/vicidial/Erlang_report.php @@ -1,7 +1,7 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGES # @@ -15,6 +15,7 @@ # 191013-0820 - Fixes for PHP7 # 220301-0937 - Added allow_web_debug system setting # 230526-1740 - Patch for user_group bug, related to Issue #1346 +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -105,8 +106,8 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($campaign)) {$campaign = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($campaign)) {$campaign = array();} if (!isset($drop_percent)) {$drop_percent = '3';} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} @@ -169,11 +170,13 @@ else } $HTML_text=""; -$actual_agents+=0; -$hourly_pay+=0; -$revenue_per_sale+=0; -$sale_chance+=0; -$retry_rate+=0; +($actual_agents ? $actual_agents+=0 : $actual_agents=0); +($hourly_pay ? $hourly_pay+=0 : $hourly_pay=0); +($revenue_per_sale ? $revenue_per_sale+=0 : $revenue_per_sale=0); +($sale_chance ? $sale_chance+=0 : $sale_chance=0); +($retry_rate ? $retry_rate+=0 : $retry_rate=0); +if (!$target_pqueue) {$target_pqueue=0;} + switch ($erlang_type) { default: diff --git a/www/vicidial/KHOMP_admin.php b/www/vicidial/KHOMP_admin.php index 0a2bbf49..cede0efb 100644 --- a/www/vicidial/KHOMP_admin.php +++ b/www/vicidial/KHOMP_admin.php @@ -1,12 +1,13 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # Interface for defining KHOMP codes for the dialer # # 200210-1604 - First build # 220223-1109 - Added allow_web_debug system setting +# 240801-1130 - Bug fixes # $startMS = microtime(); @@ -110,19 +111,20 @@ $browser = getenv("HTTP_USER_AGENT"); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,allow_chats,enable_languages,language_method,default_language,allow_web_debug FROM system_settings;"; +$stmt = "SELECT use_non_latin,allow_chats,enable_languages,language_method,default_language,allow_web_debug,outbound_autodial_active FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); #if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) { $row=mysqli_fetch_row($rslt); - $non_latin = $row[0]; - $SSallow_chats = $row[1]; - $SSenable_languages = $row[2]; - $SSlanguage_method = $row[3]; - $SSdefault_language = $row[4]; - $SSallow_web_debug = $row[5]; + $non_latin = $row[0]; + $SSallow_chats = $row[1]; + $SSenable_languages = $row[2]; + $SSlanguage_method = $row[3]; + $SSdefault_language = $row[4]; + $SSallow_web_debug = $row[5]; + $SSoutbound_autodial_active = $row[6]; } if ($SSallow_web_debug < 1) {$DB=0;} $VUselected_language = $SSdefault_language; @@ -232,11 +234,13 @@ if ($submit_khomp=="UPDATE") } } + if (!$link) echo "No DB link."; + $update_khomp_string=trim(preg_replace('/\//', "\/", $update_khomp_string)); $stmt="select * from vicidial_settings_containers where container_id='KHOMPSTATUSMAP'"; $rslt=mysql_to_mysqli($stmt, $link); - while($row=mysqli_fetch_row($rslt)) + while($row=mysqli_fetch_array($rslt)) { $container_entry=$row[4]; $khomps_array=explode("\n", $container_entry); @@ -263,9 +267,9 @@ if ($submit_khomp=="UPDATE") $SQL_log = "$update_stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); $SQL_log = addslashes($SQL_log); - $stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='KHOMP', event_type='UPDATE', record_id='$PN[$p]', event_code='ADMIN UPDATE KHOMP CODE', event_sql=\"$SQL_log\", event_notes='';"; + $log_stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='KHOMP', event_type='UPDATE', record_id='$PN[$p]', event_code='ADMIN UPDATE KHOMP CODE', event_sql=\"$SQL_log\", event_notes='';"; if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_to_mysqli($stmt, $link); + $log_rslt=mysql_to_mysqli($log_stmt, $link); } else { @@ -328,9 +332,9 @@ else if ($submit_khomp=="ADD") $SQL_log = "$update_stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); $SQL_log = addslashes($SQL_log); - $stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='KHOMP', event_type='ADD', record_id='$PN[$p]', event_code='ADMIN ADD KHOMP CODE', event_sql=\"$SQL_log\", event_notes='';"; + $log_stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='KHOMP', event_type='ADD', record_id='$PN[$p]', event_code='ADMIN ADD KHOMP CODE', event_sql=\"$SQL_log\", event_notes='';"; if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_to_mysqli($stmt, $link); + $log_rslt=mysql_to_mysqli($log_stmt, $link); } else { diff --git a/www/vicidial/NANPA_running_processes.php b/www/vicidial/NANPA_running_processes.php index f510e1fa..7e907cca 100644 --- a/www/vicidial/NANPA_running_processes.php +++ b/www/vicidial/NANPA_running_processes.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # This script shows running NANPA filter batch proccesses # @@ -13,10 +13,11 @@ # 170409-1537 - Added IP List validation code # 170822-2230 - Added screen color settings # 220222-1917 - Added allow_web_debug system setting +# 240801-1136 - Code updates for PHP8 compatibility # -$version = '2.14-6'; -$build = '220222-1917'; +$version = '2.14-7'; +$build = '240801-1136'; $startMS = microtime(); require("dbconnect_mysqli.php"); @@ -197,6 +198,7 @@ if ($agent_screen_colors != 'default') } } +if(!is_array($output_codes_to_display)) {$output_codes_to_display=array();} $oc_ct=count($output_codes_to_display); $oc_SQL="'',"; diff --git a/www/vicidial/adminCORS.php b/www/vicidial/adminCORS.php index 424de851..1066a618 100644 --- a/www/vicidial/adminCORS.php +++ b/www/vicidial/adminCORS.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CORS settings coming from the options.php script (the first 3 variables must be set for these features to be active) # $CORS_allowed_origin = ''; # if multiple origins allowed, separate them by a pipe (also allows PHP preg syntax) @@ -20,15 +20,33 @@ # # CHANGELOG # 210618-0938 - First Build +# 240801-1138 - Code updates for PHP8 compatibility +# 240805-2103 - Added PHP_error_reporting_OVERRIDE options # +$PHP_error_reporting_OVERRIDE=0; +if (file_exists('options.php')) + { + require('options.php'); + } +if ($PHP_error_reporting_OVERRIDE > 0) + { + $php_err_suppression_value=32767; # E_ALL + $php_err_suppression_value-=($PHP_error_reporting_HIDE_ERRORS ? 1 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_WARNINGS ? 2 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_PARSES ? 4 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_NOTICES ? 8 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_DEPRECATIONS ? 8192 : 0); + error_reporting($php_err_suppression_value); + } + $NOW_TIME = date("Y-m-d H:i:s"); if (strlen($php_script) < 1) {$donothing=1;} else { - $CORS_origin = $_SERVER['HTTP_ORIGIN']; # The client browser origin server + $CORS_origin = "$_SERVER[HTTP_ORIGIN]"; # The client browser origin server - treated as string for stripos command $CORS_method = isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']) ? $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] : $_SERVER['REQUEST_METHOD']; # Either the requested HTTP method or the current one $CORS_affected_scripts = " $CORS_affected_scripts "; # surround with spaces for preg match below @@ -116,4 +134,4 @@ else } } -?> \ No newline at end of file +?> diff --git a/www/vicidial/admin_NANPA_updater.php b/www/vicidial/admin_NANPA_updater.php index 9c0a7f51..d16fe693 100644 --- a/www/vicidial/admin_NANPA_updater.php +++ b/www/vicidial/admin_NANPA_updater.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # This script is designed to launch NANPA filter batch proccesses through the # triggering process @@ -18,10 +18,11 @@ # 180503-2015 - Added new help display # 191013-0814 - Fixes for PHP7 # 220222-1753 - Added allow_web_debug system setting +# 240801-1138 - Code updates for PHP8 compatibility # -$version = '2.14-9'; -$build = '220222-1753'; +$version = '2.14-10'; +$build = '240801-1138'; $startMS = microtime(); require("dbconnect_mysqli.php"); @@ -214,7 +215,7 @@ if ($delete_trigger_id) $delete_rslt=mysql_to_mysqli($delete_stmt, $link); } -if (!isset($lists)) {$lists=array();} +if (!is_array($lists)) {$lists=array();} $list_ct=count($lists); if ($submit_form=="SUBMIT" && $list_ct>0 && (strlen($vl_field_update)>0 || strlen($cellphone_list_id)>0 || strlen($landline_list_id)>0 || strlen($invalid_list_id)>0) ) { @@ -348,6 +349,7 @@ function StartRefresh() { rInt=window.setInterval(function() {RefreshNANPA("")}, 10000); } function RefreshNANPA(spanURL) { + if (!document.getElementById("running_processes")) {return false;} var xmlhttp=false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); @@ -420,7 +422,7 @@ echo "\n"; echo ""; echo "\n"; -$ADMIN=$PHP_SELF; +# $ADMIN=$PHP_SELF; $short_header=1; # $NWB = "   # 231207-1446 - Fix for web_loader_phone_strip duplicate check, issue #1498, also changed format to "Custom layout" default # 240320-1034 - Added misssing input variable filtering +# 240801-1132 - Code updates for PHP8 compatibility # -$version = '2.14-81'; -$build = '240320-1034'; +$version = '2.14-82'; +$build = '240801-1132'; require("dbconnect_mysqli.php"); require("functions.php"); @@ -301,6 +302,11 @@ if (is_array($dedupe_statuses)) } } } +else + { + $dedupe_statuses=array(); + } + if (strlen($dedupe_statuses_override)>0) { @@ -1045,9 +1051,9 @@ if ($SSenable_international_dncs) ##### BEGIN custom fields submission ##### if ($OK_to_process) { - print ""; + print ""; flush(); - $total=0; $good=0; $bad=0; $dup=0; $post=0; $moved=0; $Tline=1; $phone_list=''; + $total=0; $good=0; $bad=0; $dup=0; $inv=0; $post=0; $moved=0; $Tline=1; $phone_list=''; $file=fopen("$lead_file", "r"); if ($webroot_writable > 0) @@ -1067,7 +1073,7 @@ if ($OK_to_process) $file=fopen("$lead_file", "r"); print "
"._QXZ("Processing file")."... (s-1)\n"; - if (count($dedupe_statuses)>0) + if (is_array($dedupe_statuses) && count($dedupe_statuses)>0) { $statuses_clause=" and status in ("; $status_dedupe_str=""; @@ -1549,7 +1555,7 @@ if ($OK_to_process) if (($leadfile) && ($LF_path)) { - $total=0; $good=0; $bad=0; $dup=0; $post=0; $moved=0; $Tline=1; $phone_list=''; + $total=0; $good=0; $bad=0; $dup=0; $inv=0; $post=0; $moved=0; $Tline=1; $phone_list=''; ### LOG INSERTION Admin Log Table ### $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LISTS', event_type='LOAD', record_id='$list_id_override', event_code='ADMIN LOAD LIST', event_sql='', event_notes='File Name: $leadfile_name, DEBUG: dedupe_statuses:$dedupe_statuses[0]| dedupe_statuses_override:$dedupe_statuses_override| dupcheck:$dupcheck | status mismatch action: $status_mismatch_action| lead_file:$lead_file| list_id_override:$list_id_override| phone_code_override:$phone_code_override| postalgmt:$postalgmt| template_id:$template_id| usacan_check:$usacan_check| dnc_country_scrub:$international_dnc_scrub| state_conversion:$state_conversion| web_loader_phone_length:$web_loader_phone_length| web_loader_phone_strip:$SSweb_loader_phone_strip|';"; @@ -1626,7 +1632,7 @@ if (($leadfile) && ($LF_path)) } } - print ""; + print ""; flush(); $delim_set=0; @@ -1679,7 +1685,7 @@ if (($leadfile) && ($LF_path)) { flush(); $file=fopen("$lead_file", "r"); - $total=0; $good=0; $bad=0; $dup=0; $post=0; $moved=0; $Tline=1; $phone_list=''; + $total=0; $good=0; $bad=0; $dup=0; $inv=0; $post=0; $moved=0; $Tline=1; $phone_list=''; print "
"._QXZ("Processing")." $delim_name "._QXZ("file using template")." $template_id... ($tab_count|$pipe_count) (s-2)\n"; if (strlen($list_id_override)>0) { @@ -1961,56 +1967,61 @@ if (($leadfile) && ($LF_path)) #$rslt=mysql_to_mysqli($custom_SQL_query, $link); #$affected_rows = mysqli_affected_rows($link); - $custom_ins_stmt="INSERT INTO $custom_table(lead_id"; - $custom_SQL_values=""; - for ($q=0; $q0) { - if (strlen($custom_fields_ary[$q])>0) + $custom_ins_stmt="INSERT INTO $custom_table(lead_id"; + $custom_SQL_values=""; + for ($q=0; $q 0) ) + if (strlen($custom_fields_ary[$q])>0) { - $field_encrypt='N'; - $stmt = "SELECT field_encrypt from vicidial_lists_fields where list_id='$list_id' and field_label='$fieldno_ary[0]' limit 1;"; - if ($DB>0) {echo "DEBUG: cf_encrypt query - $stmt\n";} - $rslt=mysql_to_mysqli($stmt, $link); - $sc_recs = mysqli_num_rows($rslt); - if ($sc_recs > 0) - { - $row=mysqli_fetch_row($rslt); - $field_encrypt = $row[0]; - } - if ($field_encrypt == 'Y') - { - $field_enc=$MT; - $field_value = $custom_fields_row[$$varname]; - $field_value = base64_encode($field_value); - exec("../agc/aes.pl --encrypt --text=$field_value", $field_enc); - $field_enc_ct = count($field_enc); - $k=0; - $field_enc_all=''; - while ($field_enc_ct > $k) - { - $field_enc_all .= $field_enc[$k]; - $k++; - } - $custom_fields_row[$$varname] = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); - } - } + $fieldno_ary=explode(",", $custom_fields_ary[$q]); + $varname=$fieldno_ary[0]."_field"; + $$varname=$fieldno_ary[1]; + $custom_ins_stmt.=",$fieldno_ary[0]"; - $custom_SQL_values.=",\"".$custom_fields_row[$$varname]."\""; - } + if ( (preg_match("/cf_encrypt/",$SSactive_modules)) and (strlen($custom_fields_row[$$varname]) > 0) ) + { + $field_encrypt='N'; + $stmt = "SELECT field_encrypt from vicidial_lists_fields where list_id='$list_id' and field_label='$fieldno_ary[0]' limit 1;"; + if ($DB>0) {echo "DEBUG: cf_encrypt query - $stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $sc_recs = mysqli_num_rows($rslt); + if ($sc_recs > 0) + { + $row=mysqli_fetch_row($rslt); + $field_encrypt = $row[0]; + } + if ($field_encrypt == 'Y') + { + $field_enc=$MT; + $field_value = $custom_fields_row[$$varname]; + $field_value = base64_encode($field_value); + exec("../agc/aes.pl --encrypt --text=$field_value", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + $field_enc_all=''; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $custom_fields_row[$$varname] = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + } + } + + $custom_SQL_values.=",\"".$custom_fields_row[$$varname]."\""; + } + } + $custom_ins_stmt.=") VALUES('$lead_id'$custom_SQL_values)"; + $custom_rslt=mysql_to_mysqli($custom_ins_stmt, $link); + $affected_rows = mysqli_affected_rows($link); + echo "\n"; + if ( ($webroot_writable > 0) and ($DB>0) ) + {fwrite($stmt_file, $custom_ins_stmt."\r\n");} } - $custom_ins_stmt.=") VALUES('$lead_id'$custom_SQL_values)"; - $custom_rslt=mysql_to_mysqli($custom_ins_stmt, $link); - $affected_rows = mysqli_affected_rows($link); - echo "\n"; - if ( ($webroot_writable > 0) and ($DB>0) ) - {fwrite($stmt_file, $custom_ins_stmt."\r\n");} /* } else @@ -2113,7 +2124,7 @@ if (($leadfile) && ($LF_path)) ##### BEGIN process standard file layout ##### if ($file_layout=="standard") { - print ""; + print ""; flush(); @@ -2167,7 +2178,7 @@ if (($leadfile) && ($LF_path)) { flush(); $file=fopen("$lead_file", "r"); - $total=0; $good=0; $bad=0; $dup=0; $post=0; $moved=0; $Tline=1; $phone_list=''; + $total=0; $good=0; $bad=0; $dup=0; $inv=0; $post=0; $moved=0; $Tline=1; $phone_list=''; print "
"._QXZ("Processing")." $delim_name "._QXZ("file")."... ($tab_count|$pipe_count) (s-3)\n"; if (count($dedupe_statuses)>0) { @@ -2531,7 +2542,7 @@ if (($leadfile) && ($LF_path)) ##### BEGIN field chooser ##### else if ($file_layout=="custom") { - print "
"; + print "
"; flush(); print "\r\n"; print " \r\n"; @@ -2752,7 +2763,7 @@ if (($leadfile) && ($LF_path)) print " \r\n"; print "
\r\n"; - print ""; + print ""; } ##### END field chooser ##### diff --git a/www/vicidial/admin_listloader_fourth_gen.php b/www/vicidial/admin_listloader_fourth_gen.php index 4e59878c..f5755e8f 100644 --- a/www/vicidial/admin_listloader_fourth_gen.php +++ b/www/vicidial/admin_listloader_fourth_gen.php @@ -82,10 +82,11 @@ # 220222-1002 - Added allow_web_debug system setting # 231207-1445 - Fix for web_loader_phone_strip duplicate check, issue #1498 # 240320-1033 - Added misssing input variable filtering +# 240801-1131 - Code updates for PHP8 compatibility # -$version = '2.14-80'; -$build = '240320-1033'; +$version = '2.14-81'; +$build = '240801-1131'; require("dbconnect_mysqli.php"); require("functions.php"); @@ -297,6 +298,11 @@ if (is_array($dedupe_statuses)) } } } +else + { + $dedupe_statuses=array(); + } + if (strlen($dedupe_statuses_override)>0) { @@ -997,9 +1003,9 @@ if ($SSenable_international_dncs) ##### BEGIN custom fields submission ##### if ($OK_to_process) { - print ""; + print ""; flush(); - $total=0; $good=0; $bad=0; $dup=0; $post=0; $moved=0; $phone_list=''; + $total=0; $good=0; $bad=0; $dup=0; $inv=0; $post=0; $moved=0; $phone_list=''; $file=fopen("$lead_file", "r"); if ($webroot_writable > 0) @@ -1019,7 +1025,7 @@ if ($OK_to_process) $file=fopen("$lead_file", "r"); print "
"._QXZ("Processing file")."...\n"; - if (count($dedupe_statuses)>0) + if (is_array($dedupe_statuses) && count($dedupe_statuses)>0) { $statuses_clause=" and status in ("; $status_dedupe_str=""; @@ -1757,7 +1763,7 @@ if ($OK_to_process) if (($leadfile) && ($LF_path)) { - $total=0; $good=0; $bad=0; $dup=0; $post=0; $moved=0; $phone_list=''; + $total=0; $good=0; $bad=0; $dup=0; $inv=0; $post=0; $moved=0; $phone_list=''; ### LOG INSERTION Admin Log Table ### $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LISTS', event_type='LOAD', record_id='$list_id_override', event_code='ADMIN LOAD LIST', event_sql='', event_notes='File Name: $leadfile_name, DEBUG: dedupe_statuses:$dedupe_statuses[0]| dedupe_statuses_override:$dedupe_statuses_override| dupcheck:$dupcheck | status mismatch action: $status_mismatch_action| lead_file:$lead_file| list_id_override:$list_id_override| phone_code_override:$phone_code_override| postalgmt:$postalgmt| template_id:$template_id| usacan_check:$usacan_check| dnc_country_scrub:$international_dnc_scrub| state_conversion:$state_conversion| web_loader_phone_length:$web_loader_phone_length| web_loader_phone_strip:$SSweb_loader_phone_strip|';"; @@ -1834,7 +1840,7 @@ if (($leadfile) && ($LF_path)) } } - print ""; + print ""; flush(); $delim_set=0; @@ -1887,7 +1893,7 @@ if (($leadfile) && ($LF_path)) { flush(); $file=fopen("$lead_file", "r"); - $total=0; $good=0; $bad=0; $dup=0; $post=0; $moved=0; $phone_list=''; + $total=0; $good=0; $bad=0; $dup=0; $inv=0; $post=0; $moved=0; $phone_list=''; print "
"._QXZ("Processing")." $delim_name "._QXZ("file using template")." $template_id... ($tab_count|$pipe_count)\n"; if (strlen($list_id_override)>0) { @@ -2424,57 +2430,62 @@ if (($leadfile) && ($LF_path)) #$rslt=mysql_to_mysqli($custom_SQL_query, $link); #$affected_rows = mysqli_affected_rows($link); - $custom_ins_stmt="INSERT INTO $custom_table(lead_id"; - $custom_SQL_values=""; - for ($q=0; $q0) { - if (strlen($custom_fields_ary[$q])>0) + $custom_ins_stmt="INSERT INTO $custom_table(lead_id"; + $custom_SQL_values=""; + for ($q=0; $q 0) ) + if (strlen($custom_fields_ary[$q])>0) { - $field_encrypt='N'; - $stmt = "SELECT field_encrypt from vicidial_lists_fields where list_id='$list_id' and field_label='$fieldno_ary[0]' limit 1;"; - if ($DB>0) {echo "DEBUG: cf_encrypt query - $stmt\n";} - $rslt=mysql_to_mysqli($stmt, $link); - $sc_recs = mysqli_num_rows($rslt); - if ($sc_recs > 0) - { - $row=mysqli_fetch_row($rslt); - $field_encrypt = $row[0]; - } - if ($field_encrypt == 'Y') - { - $field_enc=$MT; - $field_value = $custom_fields_row[$$varname]; - $field_value = base64_encode($field_value); - exec("../agc/aes.pl --encrypt --text=$field_value", $field_enc); - $field_enc_ct = count($field_enc); - $k=0; - $field_enc_all=''; - while ($field_enc_ct > $k) - { - $field_enc_all .= $field_enc[$k]; - $k++; - } - $custom_fields_row[$$varname] = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); - } - } + $fieldno_ary=explode(",", $custom_fields_ary[$q]); + $varname=$fieldno_ary[0]."_field"; + $$varname=$fieldno_ary[1]; + $custom_ins_stmt.=",$fieldno_ary[0]"; - $custom_SQL_values.=",\"".$custom_fields_row[$$varname]."\""; - } + if ( (preg_match("/cf_encrypt/",$SSactive_modules)) and (strlen($custom_fields_row[$$varname]) > 0) ) + { + $field_encrypt='N'; + $stmt = "SELECT field_encrypt from vicidial_lists_fields where list_id='$list_id' and field_label='$fieldno_ary[0]' limit 1;"; + if ($DB>0) {echo "DEBUG: cf_encrypt query - $stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $sc_recs = mysqli_num_rows($rslt); + if ($sc_recs > 0) + { + $row=mysqli_fetch_row($rslt); + $field_encrypt = $row[0]; + } + if ($field_encrypt == 'Y') + { + $field_enc=$MT; + $field_value = $custom_fields_row[$$varname]; + $field_value = base64_encode($field_value); + exec("../agc/aes.pl --encrypt --text=$field_value", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + $field_enc_all=''; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $custom_fields_row[$$varname] = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + } + } + + $custom_SQL_values.=",\"".$custom_fields_row[$$varname]."\""; + } + } + $custom_ins_stmt.=") VALUES('$lead_id'$custom_SQL_values)"; + $custom_rslt=mysql_to_mysqli($custom_ins_stmt, $link); + $affected_rows = mysqli_affected_rows($link); + echo "\n"; + if ( ($webroot_writable > 0) and ($DB>0) ) + {fwrite($stmt_file, $custom_ins_stmt."\r\n");} } - $custom_ins_stmt.=") VALUES('$lead_id'$custom_SQL_values)"; - $custom_rslt=mysql_to_mysqli($custom_ins_stmt, $link); - $affected_rows = mysqli_affected_rows($link); - echo "\n"; - if ( ($webroot_writable > 0) and ($DB>0) ) - {fwrite($stmt_file, $custom_ins_stmt."\r\n");} -/* +/* } else { @@ -2574,7 +2585,7 @@ if (($leadfile) && ($LF_path)) ##### BEGIN process standard file layout ##### if ($file_layout=="standard") { - print ""; + print ""; flush(); @@ -2628,7 +2639,7 @@ if (($leadfile) && ($LF_path)) { flush(); $file=fopen("$lead_file", "r"); - $total=0; $good=0; $bad=0; $dup=0; $post=0; $moved=0; $phone_list=''; + $total=0; $good=0; $bad=0; $dup=0; $inv=0; $post=0; $moved=0; $phone_list=''; print "
"._QXZ("Processing")." $delim_name "._QXZ("file")."... ($tab_count|$pipe_count)\n"; if (count($dedupe_statuses)>0) { @@ -3246,7 +3257,7 @@ if (($leadfile) && ($LF_path)) ##### BEGIN field chooser ##### else if ($file_layout=="custom") { - print "
"; + print "
"; flush(); print "\r\n"; print " \r\n"; @@ -3462,7 +3473,7 @@ if (($leadfile) && ($LF_path)) print " \r\n"; print "
\r\n"; - print ""; + print ""; } ##### END field chooser ##### diff --git a/www/vicidial/agent_sales_report_mobile.php b/www/vicidial/agent_sales_report_mobile.php index 24ab1ec5..4490644d 100644 --- a/www/vicidial/agent_sales_report_mobile.php +++ b/www/vicidial/agent_sales_report_mobile.php @@ -1,13 +1,14 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # Streamlined report for displaying sale-only statistics in a format easily readable on a mobile device # # CHANGELOG: # 200309-1819 - First Build # 220303-1515 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -54,8 +55,8 @@ $MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} if (!isset($query_date_D)) {$query_date_D=$NOW_DATE;} if (!isset($query_date_T)) {$query_date_T="00:00:00";} if (!isset($refresh_rate)) {$refresh_rate="1000000";} @@ -411,7 +412,7 @@ if ($SUBMIT==_QXZ("SUBMIT") || $SUBMIT==_QXZ("REFRESH")) { $campaign_status_rslt=mysql_to_mysqli($campaign_status_stmt, $link); $campaign_sales=array(); while ($campaign_status_row=mysqli_fetch_row($campaign_status_rslt)) { - if (!isset($campaign_sales["$campaign_status_row[0]"])) {$campaign_sales["$campaign_status_row[0]"]=array();} + if (!is_array($campaign_sales["$campaign_status_row[0]"])) {$campaign_sales["$campaign_status_row[0]"]=array();} array_push($campaign_sales["$campaign_status_row[0]"], "$campaign_status_row[1]"); } diff --git a/www/vicidial/agent_timeoff_interface.php b/www/vicidial/agent_timeoff_interface.php index d4c3e475..72c1b2c3 100644 --- a/www/vicidial/agent_timeoff_interface.php +++ b/www/vicidial/agent_timeoff_interface.php @@ -6,6 +6,7 @@ # Admin utility for applying hours off for agents, to be used in reports # # 240415-1730 - First build +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -97,6 +98,7 @@ $download_month=preg_replace("/[^-0-9]/",'',$download_month); $update_month=preg_replace("/[^-0-9]/",'',$update_month); $new_month=preg_replace("/[^-0-9]/",'',$new_month); $rpt_month=preg_replace("/[^-0-9]/",'',$rpt_month); +if(!is_array($to_types)) {$to_types=array();} if ($non_latin < 1) { @@ -1029,7 +1031,7 @@ if (!$display_all_agents || $display_all_agents==0) echo "
\n"; echo "
\n"; - echo "\n"; + echo "\n"; echo "\t\n"; echo "\t\t\n"; echo "\n"; diff --git a/www/vicidial/call_report_export.php b/www/vicidial/call_report_export.php index 1f74ea64..d4c8e149 100644 --- a/www/vicidial/call_report_export.php +++ b/www/vicidial/call_report_export.php @@ -5,7 +5,7 @@ # and/or vicidial_closer_log information by status, list_id and date range. # downloads to a flat text file that is tab delimited # -# Copyright (C) 2023 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -65,6 +65,7 @@ # 220301-1603 - Added allow_web_debug system setting # 230622-1652 - Added filtering by time (hours), and option for single user exports. # 230623-1025 - Added sort_dir sort direction +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -132,11 +133,11 @@ $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $FILE_TIME = date("Ymd-His"); $STARTtime = date("U"); -if (!isset($campaign)) {$campaign = array();} -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} -if (!isset($list_id)) {$list_id = array();} -if (!isset($status)) {$status = array();} +if (!is_array($campaign)) {$campaign = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} +if (!is_array($list_id)) {$list_id = array();} +if (!is_array($status)) {$status = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (!isset($query_hour)) {$query_hour = "00";} diff --git a/www/vicidial/call_report_export_carrier.php b/www/vicidial/call_report_export_carrier.php index 4bb02380..49eed762 100644 --- a/www/vicidial/call_report_export_carrier.php +++ b/www/vicidial/call_report_export_carrier.php @@ -6,7 +6,7 @@ # downloads to a flat text file that is tab delimited. This version also # attempts to link carrier and dial log entries to those calls. # -# Copyright (C) 2022 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -22,6 +22,7 @@ # 190926-0927 - Fixes for PHP7 # 210911-1908 - Fix for --ALL-- selection user-group permission issue # 220301-1551 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -79,11 +80,11 @@ $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $FILE_TIME = date("Ymd-His"); $STARTtime = date("U"); -if (!isset($campaign)) {$campaign = array();} -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$user_group = array();} -if (!isset($list_id)) {$list_id = array();} -if (!isset($status)) {$status = array();} +if (!is_array($campaign)) {$campaign = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} +if (!is_array($list_id)) {$list_id = array();} +if (!is_array($status)) {$status = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} diff --git a/www/vicidial/callbacks_bulk_move.php b/www/vicidial/callbacks_bulk_move.php index 8bdc9af8..62c01ae5 100644 --- a/www/vicidial/callbacks_bulk_move.php +++ b/www/vicidial/callbacks_bulk_move.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # 150218-0923 - First build based on callbacks_bulk_change.php @@ -12,6 +12,7 @@ # 191013-0853 - Fixes for PHP7 # 220224-1656 - Added allow_web_debug system setting # 231129-1404 - 'SQL/x' variable bug fix +# 240801-1130 - Code updates for PHP8 compatibility # require("dbconnect_mysqli.php"); @@ -126,8 +127,12 @@ else $StarTtimE = date("U"); $TODAY = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); -if (!isset($group)) {$group=array();} -if (!isset($users)) {$users=array();} +if (!is_array($group)) {$group=array();} +if (!is_array($users)) {$users=array();} +if (!is_array($cb_users)) {$cb_users=array();} +if (!is_array($cb_user_groups)) {$cb_user_groups=array();} +if (!is_array($cb_lists)) {$cb_lists=array();} +if (!is_array($cb_groups)) {$cb_groups=array();} $ip = getenv("REMOTE_ADDR"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); @@ -702,6 +707,7 @@ if ($SUBMIT && $new_list_id && ($new_status || $revert_status)) # else # {} + $groupsSQL=preg_replace('/ in \(\)/', ' in (\'\')', $groupsSQL); $callback_dispo_stmt="SELECT distinct status from vicidial_statuses where scheduled_callback='Y' UNION SELECT distinct status from vicidial_campaign_statuses where scheduled_callback='Y' ".preg_replace("/vc\./", "", $groupsSQL); if ($DB) {echo $callback_dispo_stmt."
";} $callback_dispo_rslt=mysql_to_mysqli($callback_dispo_stmt, $link); @@ -878,6 +884,8 @@ else if ($SUBMIT && $new_list_id && ($new_status || $revert_status) && (count($ $callback_stmt="SELECT * from vicidial_callbacks vc, vicidial_list vl where $purge_clause and vc.lead_id=vl.lead_id $usersSQL $user_groupsSQL $listsSQL $groupsSQL $daySQL"; $purge_stmt="SELECT vc.status, vl.status from vicidial_callbacks vc, vicidial_list vl where $purge_clause and vc.lead_id=vl.lead_id $usersSQL $user_groupsSQL $listsSQL $groupsSQL $daySQL"; + $purge_stmt=preg_replace('/ in \(\)/', ' in (\'\')', $purge_stmt); + if ($DB) {echo $purge_stmt."
";} $purge_rslt=mysql_to_mysqli($purge_stmt, $link); $purge_ct=mysqli_num_rows($purge_rslt); $purge_called_ct=0; @@ -888,6 +896,7 @@ else if ($SUBMIT && $new_list_id && ($new_status || $revert_status) && (count($ if ($purge_row[0]=="ACTIVE" || ($purge_row[0]=="LIVE" && in_array("$purge_row[1]", $cb_dispos))) {$purge_uncalled_ct++;} } } + $callback_stmt=preg_replace('/ in \(\)/', ' in (\'\')', $callback_stmt); $callback_rslt=mysql_to_mysqli($callback_stmt, $link); $callback_ct=mysqli_num_rows($callback_rslt); if ($DB) {echo $callback_stmt."
";} diff --git a/www/vicidial/callbacks_export.php b/www/vicidial/callbacks_export.php index 51148f33..5b5e16c3 100644 --- a/www/vicidial/callbacks_export.php +++ b/www/vicidial/callbacks_export.php @@ -1,13 +1,14 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGES # 200622-1615 - First build # 220228-2126 - Added allow_web_debug system setting # 220713-1748 - Added user & count to output/modified SQL # 220812-1000 - Added User Group report permissions checking +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -39,7 +40,7 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $StarTtimE = date("U"); $TODAY = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); -if (!isset($cb_groups)) {$cb_groups=array();} +if (!is_array($cb_groups)) {$cb_groups=array();} if (!isset($query_date)) {$query_date = $TODAY;} if (!isset($end_date)) {$end_date = $TODAY;} $ip = getenv("REMOTE_ADDR"); @@ -317,6 +318,7 @@ if ($SUBMIT) } $groupsSQL=preg_replace('/,$/', '', $groupsSQL); $groupsSQL.=") "; + if (!$groupsQS) {$groupsSQL="";} } else { diff --git a/www/vicidial/called_counts_multilist_report.php b/www/vicidial/called_counts_multilist_report.php index 1e513f80..c0ffd2d6 100644 --- a/www/vicidial/called_counts_multilist_report.php +++ b/www/vicidial/called_counts_multilist_report.php @@ -1,7 +1,7 @@ , Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson , Matt Florell LICENSE: AGPLv2 # # This is a report designed for showing called counts similar to the results # at the bottom of each list detail screen, but for multiple lists and using @@ -20,6 +20,7 @@ # 180508-0115 - Added new help display # 191013-0840 - Fixes for PHP7 # 220228-2108 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -64,8 +65,8 @@ $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($list_ids)) {$list_ids = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($list_ids)) {$list_ids = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} @@ -722,6 +723,7 @@ if (strlen($QUERY_STRING) > 5) $first_row=1; $all_called_first=1000; $all_called_last=0; + $status=array(); $count_statuses=array(); $count_called=array(); $count_count=array(); diff --git a/www/vicidial/callerID_log_report.php b/www/vicidial/callerID_log_report.php index 4401fa9b..a94d0685 100644 --- a/www/vicidial/callerID_log_report.php +++ b/www/vicidial/callerID_log_report.php @@ -5,7 +5,7 @@ # Created to find problematic caller IDs, which can be found if bad outbound calls are dispositioned # particular statuses # -# Copyright (C) 2022 Matt Florell , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGES # @@ -13,6 +13,7 @@ # 200120-1430 - Added total calls, percentage of calls matched, default CID notation # 201111-1630 - Translation issue fix, Issue #1231 # 220228-2053 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -56,8 +57,8 @@ $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $FILE_TIME = date("Ymd-His"); $STARTtime = date("U"); -if (!isset($campaign)) {$campaign = array();} -if (!isset($status)) {$status = array();} +if (!is_array($campaign)) {$campaign = array();} +if (!is_array($status)) {$status = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (!isset($query_time)) {$query_time = "00:00:00";} diff --git a/www/vicidial/campaign_summary_mobile_report.php b/www/vicidial/campaign_summary_mobile_report.php index a231a64c..309fe409 100644 --- a/www/vicidial/campaign_summary_mobile_report.php +++ b/www/vicidial/campaign_summary_mobile_report.php @@ -1,7 +1,7 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # Back-end PHP script that generates text output to be interpreted by AST_timeonVDADallSUMMARY_mobile.php # @@ -11,6 +11,7 @@ # # 181212-2329 - Initial build # 220301-1015 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # require("dbconnect_mysqli.php"); @@ -72,6 +73,7 @@ $adastats = preg_replace('/[^-_0-9a-zA-Z]/', '', $adastats); $file_download = preg_replace('/[^-_0-9a-zA-Z]/', '', $file_download); $submit = preg_replace('/[^-_0-9a-zA-Z]/', '', $submit); $SUBMIT = preg_replace('/[^-_0-9a-zA-Z]/', '', $SUBMIT); +if(!is_array($types)) {$types=array();} # Variables filtered further down in the code # $types @@ -217,7 +219,7 @@ if (count($types)<2) { else if (in_array('AUTO-DIAL ONLY', $types)) {$campaign_typeSQL="and dial_method IN('RATIO','ADAPT_HARD_LIMIT','ADAPT_TAPERED','ADAPT_AVERAGE')";} else if (in_array('MANUAL ONLY', $types)) {$campaign_typeSQL="and dial_method IN('MANUAL','INBOUND_MAN')";} else if (in_array('INBOUND ONLY', $types)) {$campaign_typeSQL="and campaign_allow_inbound='Y'";} - else {$campaign_typeSQL="and campaign_id IN(".$typesSQL.")";} + else if ($typesSQL) {$campaign_typeSQL="and campaign_id IN(".$typesSQL.")";} } else { if (!in_array('LIST ALL CAMPAIGNS', $types)) { $campaign_typeSQL='and ('; diff --git a/www/vicidial/closer.php b/www/vicidial/closer.php index bb61884d..cbc941e8 100644 --- a/www/vicidial/closer.php +++ b/www/vicidial/closer.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # the purpose of this script and webpage is to allow for remote or local users of the system to log in and grab phone calls that are coming inbound into the Asterisk server and being put in the parked_channels table while they hear a soundfile for a limited amount of time before being forwarded on to either a set extension or a voicemail box. This gives remote or local agents a way to grab calls without tying up their phone lines all day. The agent sees the refreshing screen of calls on park and when they want to take one they just click on it, and a small window opens that will allow them to grab the call and/or look up more information on the caller through the callerID that is given(if available) # CHANGES @@ -17,6 +17,7 @@ # 141229-2041 - Added code for on-the-fly language translations display # 170409-1532 - Added IP List validation code # 220224-1629 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # require("dbconnect_mysqli.php"); @@ -230,7 +231,8 @@ require("screen_colors.php");
- LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES: # 130328-0022 - Converted ereg to preg functions @@ -15,8 +15,26 @@ # 150313-0913 - Added ExpectedDBSchema conf file value # 150626-2120 - Modified mysqli_error() to mysqli_connect_error() where appropriate # 160325-1434 - Changes for sidebar update +# 240801-1130 - Code updates for PHP8 compatibility +# 240805-2103 - Added PHP_error_reporting_OVERRIDE options # +$PHP_error_reporting_OVERRIDE=0; +if (file_exists('options.php')) + { + require('options.php'); + } +if ($PHP_error_reporting_OVERRIDE > 0) + { + $php_err_suppression_value=32767; # E_ALL + $php_err_suppression_value-=($PHP_error_reporting_HIDE_ERRORS ? 1 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_WARNINGS ? 2 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_PARSES ? 4 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_NOTICES ? 8 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_DEPRECATIONS ? 8192 : 0); + error_reporting($php_err_suppression_value); + } + if ( file_exists("/etc/astguiclient.conf") ) { $DBCagc = file("/etc/astguiclient.conf"); diff --git a/www/vicidial/fcstats_detail.php b/www/vicidial/fcstats_detail.php index 80231147..b775d5e0 100644 --- a/www/vicidial/fcstats_detail.php +++ b/www/vicidial/fcstats_detail.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -45,6 +45,7 @@ # 191013-0851 - Fixes for PHP7 # 220228-1955 - Added allow_web_debug system setting # 230621-1434 - Fixed download bug, added option to see unanswered transfers +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -93,10 +94,10 @@ $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); $HTML_text=''; -if (!isset($user_group)) {$user_group = array();} -if (!isset($campaign)) {$campaign = array();} -if (!isset($users)) {$users = array();} -if (!isset($group)) {$group = array();} +if (!is_array($user_group)) {$user_group = array();} +if (!is_array($campaign)) {$campaign = array();} +if (!is_array($users)) {$users = array();} +if (!is_array($group)) {$group = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $query_date;} if (strlen($shift)<2) {$shift='ALL';} @@ -733,6 +734,9 @@ if ($campaign_ct>0 || $user_group_ct>0 || $user_ct>0) { $summary_user_closer_log_SQL = "and ".$vicidial_closer_log_table.".user IN($total_user_SQL)"; } +$complete_xfer_log=array(); +$complete_fronter_stats=array(); +$complete_closer_stats=array(); #### LOG SECTION if ($campaign_ct>0 || $user_group_ct>0 || $user_ct>0) { diff --git a/www/vicidial/functions.php b/www/vicidial/functions.php index 868a89f9..a540eda9 100644 --- a/www/vicidial/functions.php +++ b/www/vicidial/functions.php @@ -42,8 +42,26 @@ # 220921-1209 - Added more failed login logging in user_authorization function # 231119-1445 - Added user_authorization for HCI page users # 240401-1459 - Added check for vicidial_pending_ar entries in user_authorization +# 240801-1130 - Code updates for PHP8 compatibility +# 240805-2103 - Added PHP_error_reporting_OVERRIDE options # +$PHP_error_reporting_OVERRIDE=0; +if (file_exists('options.php')) + { + require('options.php'); + } +if ($PHP_error_reporting_OVERRIDE > 0) + { + $php_err_suppression_value=32767; # E_ALL + $php_err_suppression_value-=($PHP_error_reporting_HIDE_ERRORS ? 1 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_WARNINGS ? 2 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_PARSES ? 4 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_NOTICES ? 8 : 0); + $php_err_suppression_value-=($PHP_error_reporting_HIDE_DEPRECATIONS ? 8192 : 0); + error_reporting($php_err_suppression_value); + } + ##### BEGIN validate user login credentials, check for failed lock out ##### function user_authorization($user,$pass,$user_option,$user_update,$api_call) { diff --git a/www/vicidial/group_hourly_stats.php b/www/vicidial/group_hourly_stats.php index 2818c1ad..37c67b4e 100644 --- a/www/vicidial/group_hourly_stats.php +++ b/www/vicidial/group_hourly_stats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -22,6 +22,7 @@ # 170409-1539 - Added IP List validation code # 220303-1547 - Added allow_web_debug system setting # 220812-0958 - Added User Group report permissions checking +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -351,7 +352,7 @@ echo "
ADD TIMEOFF DATA:
\n"; echo "
\n"; -echo ""._QXZ("TSR HOUR COUNTS").": $group | $status | $date_with_hour | $date_no_hour\n"; +echo ""._QXZ("TSR HOUR COUNTS").": $group | $status | $date_with_hour | $date_no_hour\n"; echo "
\n"; echo "\n"; @@ -384,13 +385,14 @@ echo "
"._QXZ("TSR")." "._QXZ("ID")."   $status   "._QXZ("TOTAL CALLS")."   $status "._QXZ("DAY")."    
"._QXZ("TSR")." "._Q } -echo "
\n"; +echo "
\n"; echo "

\n"; -echo "
"._QXZ("Please enter the group you want to get hourly stats for").": \n"; +echo "
"; +echo "
"; +echo ""._QXZ("Please enter the group you want to get hourly stats for").":

\n"; echo "\n"; -echo _QXZ("group").": \n"; $stmt="SELECT user_group,group_name from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group"; $rslt=mysql_to_mysqli($stmt, $link); @@ -407,9 +409,13 @@ while ($groups_to_print > $o) $o++; } echo "$groups_list
\n"; -echo _QXZ("status").":   ("._QXZ("example").": "._QXZ("XFER").")
\n"; -echo _QXZ("date with hour").":   ("._QXZ("example").": 2004-06-25 14)
\n"; +echo _QXZ("Status").":   ("._QXZ("example").": "._QXZ("XFER").")
\n"; +echo _QXZ("Date with hour").":   ("._QXZ("example").": 2004-06-25 14)

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


\n"; diff --git a/www/vicidial/lead_report_export.php b/www/vicidial/lead_report_export.php index a9b4f804..a324cb78 100644 --- a/www/vicidial/lead_report_export.php +++ b/www/vicidial/lead_report_export.php @@ -5,7 +5,7 @@ # vicidial_log and/or vicidial_closer_log information by status, list_id and # date range. downloads to a flat text file that is tab delimited # -# Copyright (C) 2023 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -37,6 +37,7 @@ # 210302-0839 - Added exclude_call_log_data option # 210911-1906 - Fix for --ALL-- selection user-group permission issue # 220228-1917 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -110,8 +111,13 @@ $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $FILE_TIME = date("Ymd-His"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($dids)) {$dids = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($dids)) {$dids = array();} +if (!is_array($campaign)) {$campaign = array();} +if (!is_array($user_group)) {$user_group = array();} +if (!is_array($list_id)) {$list_id = array();} +if (!is_array($status)) {$status = array();} +if (!is_array($vlcs)) {$vlcs = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} if (strlen($shift)<2) {$shift='ALL';} diff --git a/www/vicidial/leadloader_template_display.php b/www/vicidial/leadloader_template_display.php index 69aa9329..b0693a1e 100644 --- a/www/vicidial/leadloader_template_display.php +++ b/www/vicidial/leadloader_template_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell,Joe Johnson LICENSE: AGPLv2 # # CHANGES # 120402-2238 - First Build @@ -19,6 +19,7 @@ # 171204-1518 - Fix for custom field duplicate issue, removed link to old lead loader # 210312-1700 - Added layout editing functionality # 220222-1059 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # require("dbconnect_mysqli.php"); @@ -535,6 +536,10 @@ else $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; $row=explode($delimiter, preg_replace('/[\'\"]/i', '', $buffer)); } + else + { + $row=array(); + } echo ""; $rslt=mysql_to_mysqli("$fields_stmt", $link); diff --git a/www/vicidial/list_merge.php b/www/vicidial/list_merge.php index 568f613b..5cc3c9b0 100644 --- a/www/vicidial/list_merge.php +++ b/www/vicidial/list_merge.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell,Joseph Johnson LICENSE: AGPLv2 # # CHANGES # 161004-2240 - Initial Build @@ -11,10 +11,11 @@ # 191101-1630 - Translation patch, removed function.js # 201117-1350 - Translation bug fixed, Issue #1236 # 220227-2210 - Added allow_web_debug system setting +# 240801-1133 - Code updates for PHP8 compatibility # -$version = '2.14-4'; -$build = '220227-2210'; +$version = '2.14-5'; +$build = '240801-1133'; require("dbconnect_mysqli.php"); require("functions.php"); @@ -31,7 +32,7 @@ $submit = ""; $confirm = ""; $available_lists = ""; $start_dest_list_id = ""; -$num_leads = ""; +$num_leads = 0; if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -435,7 +436,7 @@ if ($submit == _QXZ("submit") ) $orig_count_row = mysqli_fetch_row($orig_count_rslt); $orig_count = $orig_count_row[0]; - $num_lists = ceil( $orig_count / $num_leads ); + $num_lists = ceil( MathZDC($orig_count, $num_leads) ); echo ""._QXZ("You are about to merge list(s)
  • %1s

into list ID %2s.

TOTAL LEADS TO BE MOVED: %3s",0,'',implode("
  • ", $available_lists),$destination_list_id,$orig_count)."\n"; diff --git a/www/vicidial/manager_chat_actions.php b/www/vicidial/manager_chat_actions.php index 365325d5..ac726f0c 100644 --- a/www/vicidial/manager_chat_actions.php +++ b/www/vicidial/manager_chat_actions.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # Contains PHP actions for manager_chat_interface.php - works with vicidial_chat.js # @@ -14,6 +14,7 @@ # 161217-0821 - Added chat-type to allow for multi-user internal chat sessions # 170409-1550 - Added IP List validation code # 220223-0934 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $admin_version = '2.14-8'; @@ -71,6 +72,7 @@ $VUselected_language = $SSdefault_language; $action = preg_replace("/[^-_0-9a-zA-Z]/", "",$action); $manager_chat_id = preg_replace("/[^-_0-9a-zA-Z]/", "",$manager_chat_id); $chat_sub_id = preg_replace("/[^-_0-9a-zA-Z]/", "",$chat_sub_id); +if (!is_array($chat_sub_ids)) {$chat_sub_ids=array();} $reload_chat_span = preg_replace("/[^-_0-9a-zA-Z]/", "",$reload_chat_span); ### Variables filtered further down in the code diff --git a/www/vicidial/manager_chat_interface.php b/www/vicidial/manager_chat_interface.php index 05351931..0787f1a5 100644 --- a/www/vicidial/manager_chat_interface.php +++ b/www/vicidial/manager_chat_interface.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # This page is for managers (level 8 or higher) to chat with live agents # @@ -17,6 +17,7 @@ # 180508-2215 - Added new help display # 210114-1338 - Fixed user group permission bug, Issue #1240 # 220223-0933 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $admin_version = '2.14-11'; @@ -119,6 +120,9 @@ $manager_chat_id = preg_replace("/[^-_0-9a-zA-Z]/", "",$manager_chat_id); $allow_replies = preg_replace("/[^-_0-9a-zA-Z]/", "",$allow_replies); $end_all_chats = preg_replace("/[^-_0-9a-zA-Z]/", "",$end_all_chats); $submit_chat = preg_replace("/[^- \.\_0-9a-zA-Z]/", "",$submit_chat); +if (!is_array($available_chat_agents)) {$available_chat_agents=array();} +if (!is_array($available_chat_groups)) {$available_chat_groups=array();} +if (!is_array($available_chat_campaigns)) {$available_chat_campaigns=array();} ### Variables filtered further down in the code # $available_chat_agents diff --git a/www/vicidial/medialog_inventory_report.php b/www/vicidial/medialog_inventory_report.php index 530e9041..e34753b0 100644 --- a/www/vicidial/medialog_inventory_report.php +++ b/www/vicidial/medialog_inventory_report.php @@ -1,7 +1,7 @@ , Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Joe Johnson , Matt Florell LICENSE: AGPLv2 # # This is a report designed for showing custom statistics based on client # requirements. This is not a standard VICIdial report. @@ -14,6 +14,7 @@ # 180508-2315 - Added new help display # 220228-1715 - Added allow_web_debug system setting # 220812-0932 - Added User Group report permissions checking +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -324,8 +325,8 @@ if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); -if (!isset($group)) {$group = array();} -if (!isset($list_ids)) {$list_ids = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($list_ids)) {$list_ids = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} @@ -846,9 +847,9 @@ if (count($list_ids) > 0 && count($group) > 0) $CSV_text.="\"Total\",\"$total\",\"\",\"\",\"1 - 5\",\"6 - 10\",\"10 - 15\",\"> 15\"\n"; $CSV_text.="\"Falsche Tel.\",\"$afc_counts[0]\",\"".sprintf("%.2f", (100*($afc_counts[0]/$total)))." %\",\"\",\"$afc_counts[1]\",\"$afc_counts[2]\",\"$afc_counts[3]\",\"$afc_counts[4]\"\n"; - $CSV_text.="\"Nixi\",\"$nixi_counts[0]\",\"".sprintf("%.2f", (100*($nixi_counts[0]/($nixi_counts[0]+$no_counts[0]+$sales_counts[0]))))." %\",\"\",\"$nixi_counts[1]\",\"$nixi_counts[2]\",\"$nixi_counts[3]\",\"$nixi_counts[4]\"\n"; + $CSV_text.="\"Nixi\",\"$nixi_counts[0]\",\"".sprintf("%.2f", (100*(MathZDC($nixi_counts[0], ($nixi_counts[0]+$no_counts[0]+$sales_counts[0])))))." %\",\"\",\"$nixi_counts[1]\",\"$nixi_counts[2]\",\"$nixi_counts[3]\",\"$nixi_counts[4]\"\n"; $CSV_text.="\"No\",\"$no_counts[0]\",\"\",\"\",\"$no_counts[1]\",\"$no_counts[2]\",\"$no_counts[3]\",\"$no_counts[4]\"\n"; - $CSV_text.="\"Sales\",\"$sales_counts[0]\",\"".sprintf("%.2f", (100*($sales_counts[0]/($nixi_counts[0]+$no_counts[0]+$sales_counts[0]))))." %\",\"\",\"$sales_counts[1]\",\"$sales_counts[2]\",\"$sales_counts[3]\",\"$sales_counts[4]\"\n"; + $CSV_text.="\"Sales\",\"$sales_counts[0]\",\"".sprintf("%.2f", (100*(MathZDC($sales_counts[0], ($nixi_counts[0]+$no_counts[0]+$sales_counts[0])))))." %\",\"\",\"$sales_counts[1]\",\"$sales_counts[2]\",\"$sales_counts[3]\",\"$sales_counts[4]\"\n"; $head ="+------------------+---------+---------+---+---------+---------+---------+---------+\n"; @@ -856,10 +857,10 @@ if (count($list_ids) > 0 && count($group) > 0) $MAIN.="| | Count | % | | Kontaktstatus |\n"; $MAIN.=$head; $MAIN.="| Total | ".sprintf("%7s", $total)." | | | 1 - 5 | 6 - 10 | 10 - 15 | > 15 |\n"; - $MAIN.="| Falsche Tel. | ".sprintf("%7s", $afc_counts[0])." | ".sprintf("%6s", sprintf("%.2f", (100*($afc_counts[0]/$total))))."% | | ".sprintf("%7s", $afc_counts[1])." | ".sprintf("%7s", $afc_counts[2])." | ".sprintf("%7s", $afc_counts[3])." | ".sprintf("%7s", $afc_counts[4])." |\n"; - $MAIN.="| Nixi | ".sprintf("%7s", $nixi_counts[0])." | ".sprintf("%6s", sprintf("%.2f", (100*($nixi_counts[0]/($nixi_counts[0]+$no_counts[0]+$sales_counts[0])))))."% | | ".sprintf("%7s", $nixi_counts[1])." | ".sprintf("%7s", $nixi_counts[2])." | ".sprintf("%7s", $nixi_counts[3])." | ".sprintf("%7s", $nixi_counts[4])." |\n"; + $MAIN.="| Falsche Tel. | ".sprintf("%7s", $afc_counts[0])." | ".sprintf("%6s", sprintf("%.2f", (100*(MathZDC($afc_counts[0],$total)))))."% | | ".sprintf("%7s", $afc_counts[1])." | ".sprintf("%7s", $afc_counts[2])." | ".sprintf("%7s", $afc_counts[3])." | ".sprintf("%7s", $afc_counts[4])." |\n"; + $MAIN.="| Nixi | ".sprintf("%7s", $nixi_counts[0])." | ".sprintf("%6s", sprintf("%.2f", (100*(MathZDC($nixi_counts[0],($nixi_counts[0]+$no_counts[0]+$sales_counts[0]))))))."% | | ".sprintf("%7s", $nixi_counts[1])." | ".sprintf("%7s", $nixi_counts[2])." | ".sprintf("%7s", $nixi_counts[3])." | ".sprintf("%7s", $nixi_counts[4])." |\n"; $MAIN.="| No | ".sprintf("%7s", $no_counts[0])." | ".sprintf("%7s", " ")." | | ".sprintf("%7s", $no_counts[1])." | ".sprintf("%7s", $no_counts[2])." | ".sprintf("%7s", $no_counts[3])." | ".sprintf("%7s", $no_counts[4])." |\n"; # Check percentage output here - $MAIN.="| Sales | ".sprintf("%7s", $sales_counts[0])." | ".sprintf("%6s", sprintf("%.2f", (100*($sales_counts[0]/($nixi_counts[0]+$no_counts[0]+$sales_counts[0])))))."% | | ".sprintf("%7s", $sales_counts[1])." | ".sprintf("%7s", $sales_counts[2])." | ".sprintf("%7s", $sales_counts[3])." | ".sprintf("%7s", $sales_counts[4])." |\n"; + $MAIN.="| Sales | ".sprintf("%7s", $sales_counts[0])." | ".sprintf("%6s", sprintf("%.2f", (100*(MathZDC($sales_counts[0],($nixi_counts[0]+$no_counts[0]+$sales_counts[0]))))))."% | | ".sprintf("%7s", $sales_counts[1])." | ".sprintf("%7s", $sales_counts[2])." | ".sprintf("%7s", $sales_counts[3])." | ".sprintf("%7s", $sales_counts[4])." |\n"; $MAIN.=$head; diff --git a/www/vicidial/nanpa_type.php b/www/vicidial/nanpa_type.php index 997deb98..27ef5df7 100644 --- a/www/vicidial/nanpa_type.php +++ b/www/vicidial/nanpa_type.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # This script is designed to work with the NANPA exchange(NPA-NXX-X) data and # the wireless-to-wired and wired-to-wireless number portability data from @@ -32,10 +32,11 @@ # 170409-1531 - Added IP List validation code # 210618-1012 - Added CORS support # 220222-1917 - Added allow_web_debug system setting +# 240801-1135 - Code updates for PHP8 compatibility # -$version = '2.14-5'; -$build = '220222-1917'; +$version = '2.14-6'; +$build = '240801-1135'; $php_script='nanpa_type.php'; $startMS = microtime(); @@ -93,8 +94,6 @@ else $pass = preg_replace('/[^-_0-9\p{L}]/u', '', $pass); } - - ################################################################################ ### version - show version, date, time and time zone information for the API ################################################################################ diff --git a/www/vicidial/options-example.php b/www/vicidial/options-example.php index 293697b2..52ba43fd 100644 --- a/www/vicidial/options-example.php +++ b/www/vicidial/options-example.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # rename this file to options.php for the settings here to go into effect # @@ -39,6 +39,7 @@ # 230421-1645 - Added RS_UGlatencyRESTRICT option # 230926-0849 - Added camp_lead_order_random option # 231115-1642 - Added vm_view_messages_link, RS_no_DEAD_status and RS_hide_CUST_info options +# 240802-1250 - Added options to customize PHP error reporting # # used by the realtime_report.php script @@ -97,6 +98,15 @@ $RS_UGlatencyRESTRICT = ''; # this can restrict the "LATENCY" features to only b $RS_AGENTstatusTALLY = ''; # : If set, will look at the number of calls statused by the agent in this status for today # WARNING!!! Using the above option may cause system lag issues, USE WITH CAUTION! +# If this option is set to 1, then the error_reporting in php.ini will be ignored and settings below will be used for this directory +$PHP_error_reporting_OVERRIDE = 0; + # PHP error reporting options, set to 1 to keep the type of error from being displayed, either on-screen or to the error logs. +$PHP_error_reporting_HIDE_ERRORS = 0; # STRONGLY advise leaving this value alone, but you do you. +$PHP_error_reporting_HIDE_WARNINGS = 0; +$PHP_error_reporting_HIDE_PARSES = 0; +$PHP_error_reporting_HIDE_NOTICES = 0; +$PHP_error_reporting_HIDE_DEPRECATIONS= 0; + # used by agent reports $user_case = 0; # 1=upper-case, 2-lower-case, 0-no-case-change diff --git a/www/vicidial/realtime_report.php b/www/vicidial/realtime_report.php index 9e2ca838..5fa902fb 100644 --- a/www/vicidial/realtime_report.php +++ b/www/vicidial/realtime_report.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # live real-time stats for the VICIDIAL Auto-Dialer all servers # @@ -62,6 +62,7 @@ # 230421-1625 - Added RS_UGlatencyRESTRICT options.php setting # 230811-1530 - Added monitoring display information # 231115-1646 - Added RS_no_DEAD_status and RS_hide_CUST_info options.php settings +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -340,10 +341,11 @@ $ingroup_detail=''; # $report_display_type='LIMITED'; # $ingroup_filter=array('_STAY','TEST_IN2','TEST_IN3'); +if (!is_array($groups)) {$groups=array();} if ( (strlen($group)>1) and (strlen($groups[0])<1) ) {$groups[0] = $group;} else {$group = $groups[0];} -if (!isset($user_group_filter)) {$user_group_filter=array();} -if (!isset($ingroup_filter)) {$ingroup_filter=array();} +if (!is_array($user_group_filter)) {$user_group_filter=array();} +if (!is_array($ingroup_filter)) {$ingroup_filter=array();} $NOW_TIME = date("Y-m-d H:i:s"); $NOW_DAY = date("Y-m-d"); diff --git a/www/vicidial/realtime_report_mobile.php b/www/vicidial/realtime_report_mobile.php index 9fbd55ad..c61ffcb4 100644 --- a/www/vicidial/realtime_report_mobile.php +++ b/www/vicidial/realtime_report_mobile.php @@ -1,7 +1,7 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # streamlined mobile version of live real-time stats for the VICIDIAL Auto-Dialer all servers # @@ -16,12 +16,13 @@ # 200309-1819 - Modifications for display formatting # 210827-1818 - Fix for security issue # 220221-1522 - Added allow_web_debug system setting +# 240801-1134 - Code updates for PHP8 compatibility # $startMS = microtime(); -$version = '2.14-4'; -$build = '220221-1522'; +$version = '2.14-5'; +$build = '240801-1134'; header ("Content-type: text/html; charset=utf-8"); @@ -269,6 +270,9 @@ else $PHP_AUTH_USER = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_PW); } +if (!is_array($groups)) {$groups=array();} +if (!is_array($user_group_filter)) {$user_group_filter=array();} +if (!isset($ALLINGROUPstats)) {$ALLINGROUPstats=0;} $RR = preg_replace('/[^0-9]/', '', $RR); $inbound = preg_replace('/[^-_0-9a-zA-Z]/', '', $inbound); $group = preg_replace('/[^-_0-9a-zA-Z]/', '', $group); @@ -287,7 +291,7 @@ $PHONEdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHONEdisplay); $CUSTPHONEdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $CUSTPHONEdisplay); $NOLEADSalert = preg_replace('/[^-_0-9a-zA-Z]/', '', $NOLEADSalert); $DROPINGROUPstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $DROPINGROUPstats); -$ALLINGROUPstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $ALLINGROUPstats); +$ALLINGROUPstats = preg_replace('/[^0-9]/', '', $ALLINGROUPstats); $with_inbound = preg_replace('/[^-_0-9a-zA-Z]/', '', $with_inbound); $monitor_active = preg_replace('/[^-_0-9a-zA-Z]/', '', $monitor_active); $monitor_phone = preg_replace('/[^-_0-9a-zA-Z]/', '', $monitor_phone); diff --git a/www/vicidial/sph_report.php b/www/vicidial/sph_report.php index e1952883..6a028ecf 100644 --- a/www/vicidial/sph_report.php +++ b/www/vicidial/sph_report.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -18,6 +18,7 @@ # 170409-1534 - Added IP List validation code # 220227-1936 - Added allow_web_debug system setting # 220812-0935 - Added User Group report permissions checking +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -62,9 +63,9 @@ $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} -if (!isset($campaign)) {$campaign = array();} -if (!isset($group)) {$group = array();} -if (!isset($user_group)) {$group = array();} +if (!is_array($campaign)) {$campaign = array();} +if (!is_array($group)) {$group = array();} +if (!is_array($user_group)) {$group = array();} if (strlen($shift)<2) {$shift='ALL';} if (strlen($role)<2) {$role='ALL';} if (strlen($order)<2) {$order='sales_down';} diff --git a/www/vicidial/timeclock_report.php b/www/vicidial/timeclock_report.php index f959f943..de00e6d2 100644 --- a/www/vicidial/timeclock_report.php +++ b/www/vicidial/timeclock_report.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -33,6 +33,7 @@ # 171012-2015 - Fixed javascript/apache errors with graphs # 191013-0827 - Fixes for PHP7 # 220226-1716 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # $startMS = microtime(); @@ -79,7 +80,7 @@ if (strlen($shift)<2) {$shift='ALL';} if (strlen($order)<2) {$order='hours_down';} if ( (!isset($query_date)) or (strlen($query_date) < 10) ) {$query_date = $TODAY;} if ( (!isset($end_date)) or (strlen($end_date) < 10) ) {$end_date = $TODAY;} -if (!isset($user_group)) {$user_group = array();} +if (!is_array($user_group)) {$user_group = array();} $report_name = 'User Timeclock Report'; $db_source = 'M'; diff --git a/www/vicidial/vdremote.php b/www/vicidial/vdremote.php index 50e3f1ff..86bbbcf5 100644 --- a/www/vicidial/vdremote.php +++ b/www/vicidial/vdremote.php @@ -4,7 +4,7 @@ # make sure you have added a user to the vicidial_users MySQL table with at # least user_level 4 to access this page the first time # -# Copyright (C) 2022 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell LICENSE: AGPLv2 # # Changes # 50307-1721 - First version @@ -24,6 +24,7 @@ # 210618-1001 - Added CORS support # 220224-0820 - Added allow_web_debug system setting # 221006-1454 - Added missing input variable, issue #1383 +# 240801-1130 - Code updates for PHP8 compatibility # $version = '2.14-16'; @@ -267,7 +268,7 @@ if (strlen($ADD)>4) } ##### get inbound groups listing for checkboxes - if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + if ( (($ADD==31111) or ($ADD==31111)) and (!is_array($groups)) ) { $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysqli_real_escape_string($link, $remote_agent_id) . "';"; $rslt=mysql_to_mysqli($stmt, $link); diff --git a/www/vicidial/whiteboard_reports.php b/www/vicidial/whiteboard_reports.php index 636d80e4..9c324e3c 100644 --- a/www/vicidial/whiteboard_reports.php +++ b/www/vicidial/whiteboard_reports.php @@ -1,7 +1,7 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2024 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # A PHP file that is for generating the stats that are displayed in the whiteboard report. Returns values. # @@ -10,6 +10,7 @@ # 200427-2225 - Added use of slave database, if activated, fixes Issue #1207 # 210823-0948 - Fix for security issue # 220221-1452 - Added allow_web_debug system setting +# 240801-1130 - Code updates for PHP8 compatibility # require("dbconnect_mysqli.php"); @@ -67,6 +68,12 @@ if (!$query_time) {$query_time="08:00:00";} if (!$end_date) {$end_date=date("Y-m-d");} if (!$end_time) {$end_time=date("H:i:00");} +if (!is_array($campaigns)) {$campaigns=array();} +if (!is_array($users)) {$users=array();} +if (!is_array($groups)) {$groups=array();} +if (!is_array($user_groups)) {$user_groups=array();} +if (!is_array($status_flags)) {$status_flags=array();} +if (!is_array($dids)) {$dids=array();} $report_name="Real-Time Whiteboard Report"; @@ -201,12 +208,12 @@ $exc_status_SQL=" and status not in ('".implode("','", $exclude_statuses)."') "; if (preg_match("/status_performance/", $rpt_type)) { - if (!$campaigns || in_array("--ALL--", $campaigns)) { + if (!is_array($campaigns) || in_array("--ALL--", $campaigns)) { $campaign_id_SQL=""; } else { $campaign_id_SQL=" and campaign_id in ('".implode("','", $campaigns)."')"; } - if (!$groups || in_array("--ALL--", $groups)) { + if (!is_array($groups) || in_array("--ALL--", $groups)) { if ($campaign_id_SQL=="") { $group_SQL=""; } else { @@ -224,12 +231,12 @@ if (preg_match("/status_performance/", $rpt_type)) { } else { $group_SQL=" and campaign_id in ('".implode("','", $groups)."')"; } - if (!$users || in_array("--ALL--", $users)) { + if (!is_array($users) || in_array("--ALL--", $users)) { $user_SQL=""; } else { $user_SQL=" and user in ('".implode("','", $users)."')"; } - if (!$status_flags || in_array("--ALL--", $status_flags)) { + if (!is_array($status_flags) || in_array("--ALL--", $status_flags)) { $status_SQL=""; } else { $flag_SQL=""; @@ -312,13 +319,14 @@ if (preg_match("/status_performance/", $rpt_type)) { $sales_ary[$key2] = $row2['sales']; $dead_ary[$key2] = $row2['dead']; } - - array_multisort($status_ary, SORT_ASC, $counts_ary, SORT_ASC, $sales_ary, SORT_ASC, $dead_ary, SORT_ASC, $kstatus_counts); if (count($status_counts)==0) { $rpt_string=_QXZ("REPORT RETURNED NO RESULTS"); } else { # while(list($key, $val)=each($status_counts)) { + + array_multisort($status_ary, SORT_ASC, $counts_ary, SORT_ASC, $sales_ary, SORT_ASC, $dead_ary, SORT_ASC, $kstatus_counts); + foreach ($kstatus_counts as $row) { $key=$row['status']; $val0=$row['counts']; @@ -341,27 +349,27 @@ if (preg_match("/status_performance/", $rpt_type)) { if (preg_match("/(agent|team)_performance/", $rpt_type)) { - if (!$campaigns || in_array("--ALL--", $campaigns)) { + if (!is_array($campaigns) || in_array("--ALL--", $campaigns)) { $campaign_id_SQL=""; } else { $campaign_id_SQL=" and campaign_id in ('".implode("','", $campaigns)."')"; } - if (!$users || in_array("--ALL--", $users)) { + if (!is_array($users) || in_array("--ALL--", $users)) { $user_SQL=""; } else { $user_SQL=" and user in ('".implode("','", $users)."')"; } - if (!$groups || in_array("--ALL--", $groups)) { + if (!is_array($groups) || in_array("--ALL--", $groups)) { $group_SQL=""; } else { $group_SQL=" and campaign_id in ('".implode("','", $groups)."')"; } - if (!$user_groups || in_array("--ALL--", $user_groups)) { + if (!is_array($user_groups) || in_array("--ALL--", $user_groups)) { $user_group_SQL=""; } else { $user_group_SQL=" and user_group in ('".implode("','", $user_groups)."')"; } - if (!$status_flags || in_array("--ALL--", $status_flags)) { + if (!is_array($status_flags) || in_array("--ALL--", $status_flags)) { $status_SQL=""; } else { $flag_SQL=""; @@ -469,12 +477,12 @@ if (preg_match("/floor_performance/", $rpt_type)) { $start_epoch+=60; } - if (in_array("--ALL--", $campaigns)) { + if (!is_array($campaigns) || in_array("--ALL--", $campaigns)) { $campaign_id_SQL=""; } else { $campaign_id_SQL=" and vicidial_agent_log.campaign_id in ('".implode("','", $campaigns)."')"; } - if (!$status_flags || in_array("--ALL--", $status_flags)) { + if (!is_array($status_flags) || in_array("--ALL--", $status_flags)) { $status_SQL=""; } else { $flag_SQL=""; @@ -549,29 +557,29 @@ if (preg_match("/floor_performance/", $rpt_type)) { } if (preg_match("/(did|ingroup)_performance/", $rpt_type)) { - if (!$campaigns || in_array("--ALL--", $campaigns)) { + if (!is_array($campaigns) || in_array("--ALL--", $campaigns)) { $campaign_id_SQL=""; } else { $campaign_id_SQL=" and campaign_id in ('".implode("','", $campaigns)."')"; } - if (!$groups || in_array("--ALL--", $groups)) { + if (!is_array($groups) || in_array("--ALL--", $groups)) { $group_SQL=""; $ingroup_SQL=""; } else { $group_SQL=" and campaign_id in ('".implode("','", $groups)."')"; $ingroup_SQL=" and group_id in ('".implode("','", $groups)."')"; } - if (!$user_groups || in_array("--ALL--", $user_groups)) { + if (!is_array($user_groups) || in_array("--ALL--", $user_groups)) { $user_group_SQL=""; } else { $user_group_SQL=" and user_group in ('".implode("','", $user_groups)."')"; } - if (!$dids || in_array("--ALL--", $dids)) { + if (!is_array($dids) || in_array("--ALL--", $dids)) { $did_SQL=""; } else { $did_SQL=" and vid.did_id in ('".implode("','", $dids)."')"; } - if (!$status_flags || in_array("--ALL--", $status_flags)) { + if (!is_array($status_flags) || in_array("--ALL--", $status_flags)) { $status_SQL=""; } else { $flag_SQL=""; @@ -688,12 +696,12 @@ if (preg_match("/(did|ingroup)_performance/", $rpt_type)) { if ($rpt_type=="floor_performance_hourly") { $rpt_string=""; - if (in_array("--ALL--", $campaigns)) { + if (!is_array($campaigns) || in_array("--ALL--", $campaigns)) { $campaign_id_SQL=""; } else { $campaign_id_SQL=" and vicidial_agent_log.campaign_id in ('".implode("','", $campaigns)."')"; } - if (!$status_flags || in_array("--ALL--", $status_flags)) { + if (!is_array($status_flags) || in_array("--ALL--", $status_flags)) { $status_SQL=""; } else { $flag_SQL="";