diff --git a/www/VERM/VERM_header.inc b/www/VERM/VERM_header.inc
index 480908b8..fccebc8b 100644
--- a/www/VERM/VERM_header.inc
+++ b/www/VERM/VERM_header.inc
@@ -42,7 +42,6 @@ $SSalt_row1_background='BDFFBD';
$SSalt_row2_background='99FF99';
$SSalt_row3_background='CCFFCC';
$SSbutton_color='EFEFEF';
-
if ($SSadmin_screen_colors != 'default')
{
$stmt = "SELECT menu_background,frame_background,std_row1_background,std_row2_background,std_row3_background,std_row4_background,std_row5_background,alt_row1_background,alt_row2_background,alt_row3_background,web_logo,button_color FROM vicidial_screen_colors where colors_id='$SSadmin_screen_colors';";
diff --git a/www/VERM/VERM_main_report_page.php b/www/VERM/VERM_main_report_page.php
index 8da25703..12eb3299 100644
--- a/www/VERM/VERM_main_report_page.php
+++ b/www/VERM/VERM_main_report_page.php
@@ -149,6 +149,15 @@ if ($SSallow_web_debug < 1) {$DB=0;}
##### END SETTINGS LOOKUP #####
###########################################
+if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
+ {
+ mysqli_close($link);
+ $use_slave_server=1;
+ $db_source = 'S';
+ require("dbconnect_mysqli.php");
+ echo "\n";
+ }
+
$start_date=preg_replace('/[^-0-9]/', '', $start_date);
$start_time_hour=preg_replace('/[^0-9]/', '', $start_time_hour);
$start_time_min=preg_replace('/[^0-9]/', '', $start_time_min);
diff --git a/www/VERM/VERM_options.php b/www/VERM/VERM_options.php
index 76ad2b4b..789de367 100644
--- a/www/VERM/VERM_options.php
+++ b/www/VERM/VERM_options.php
@@ -216,6 +216,10 @@ if (mysqli_num_rows($options_rslt)>0)
$ivr_survey_ingroups_voicemails["$ingroup"]=$options;
}
}
+
+ if ($setting_name=="caller_id_override" && $setting_value)
+ {$caller_id_override=$setting_value;}
+
# print "$container_entry[$q]\n";
}
}
diff --git a/www/VERM/VERM_wallboard_widgets.php b/www/VERM/VERM_wallboard_widgets.php
index 99ba2957..19209e2a 100644
--- a/www/VERM/VERM_wallboard_widgets.php
+++ b/www/VERM/VERM_wallboard_widgets.php
@@ -6,6 +6,7 @@
# CHANGELOG:
# 220825-1601 - First build
#
+$report_name="VERM reports";
$startMS = microtime();
@@ -51,6 +52,15 @@ if ($SSallow_web_debug < 1) {$DB=0;}
##### END SETTINGS LOOKUP #####
###########################################
+if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
+ {
+ mysqli_close($link);
+ $use_slave_server=1;
+ $db_source = 'S';
+ require("dbconnect_mysqli.php");
+ }
+
+
if ($non_latin < 1)
{
$DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
diff --git a/www/VERM/VERM_wallboards.php b/www/VERM/VERM_wallboards.php
index d54d8f52..797fd3a2 100644
--- a/www/VERM/VERM_wallboards.php
+++ b/www/VERM/VERM_wallboards.php
@@ -6,6 +6,7 @@
# CHANGELOG:
# 220825-1600 - First build
#
+$report_name="VERM reports";
$startMS = microtime();
@@ -51,6 +52,16 @@ if ($SSallow_web_debug < 1) {$DB=0;}
##### END SETTINGS LOOKUP #####
###########################################
+if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
+ {
+ mysqli_close($link);
+ $use_slave_server=1;
+ $db_source = 'S';
+ require("dbconnect_mysqli.php");
+ echo "\n";
+ }
+
+
# $report_name = 'Vicidial Enhanced Reporting Module';
require("../$SSadmin_web_directory/screen_colors.php");
diff --git a/www/VERM/display_agent_details.php b/www/VERM/display_agent_details.php
index e306f7af..0ca90ac7 100644
--- a/www/VERM/display_agent_details.php
+++ b/www/VERM/display_agent_details.php
@@ -6,6 +6,8 @@
# CHANGELOG:
# 220825-1612 - First build
#
+$subreport_name="VERM Reports";
+$report_display_type="display_agent_details.php";
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
@@ -112,6 +114,136 @@ else
}
+$stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+$sl_ct = mysqli_num_rows($rslt);
+if ($sl_ct > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $VUselected_language = $row[0];
+ }
+
+$auth=0;
+$reports_auth=0;
+$admin_auth=0;
+$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'REPORTS',0,0);
+if ( ($auth_message == 'GOOD') or ($auth_message == '2FA') )
+ {
+ $auth=1;
+ if ($auth_message == '2FA')
+ {
+ header ("Content-type: text/html; charset=utf-8");
+ echo _QXZ("Your session is expired").". "._QXZ("Click here to log in").".\n";
+ exit;
+ }
+ }
+
+if ($auth > 0)
+ {
+ $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $row=mysqli_fetch_row($rslt);
+ $admin_auth=$row[0];
+
+ $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $row=mysqli_fetch_row($rslt);
+ $reports_auth=$row[0];
+
+ if ($reports_auth < 1)
+ {
+ $VDdisplayMESSAGE = _QXZ("You are not allowed to view reports");
+ Header ("Content-type: text/html; charset=utf-8");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
+ exit;
+ }
+ if ( ($reports_auth > 0) and ($admin_auth < 1) )
+ {
+ $ADD=999999;
+ $reports_only_user=1;
+ }
+ }
+else
+ {
+ $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again");
+ if ($auth_message == 'LOCK')
+ {
+ $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes");
+ Header ("Content-type: text/html; charset=utf-8");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
+ exit;
+ }
+ if ($auth_message == 'IPBLOCK')
+ {
+ $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip";
+ Header ("Content-type: text/html; charset=utf-8");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
+ exit;
+ }
+ Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
+ Header("HTTP/1.0 401 Unauthorized");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n";
+ exit;
+ }
+
+##### BEGIN log visit to the vicidial_report_log table #####
+$LOGip = getenv("REMOTE_ADDR");
+$LOGbrowser = getenv("HTTP_USER_AGENT");
+$LOGscript_name = getenv("SCRIPT_NAME");
+$LOGserver_name = getenv("SERVER_NAME");
+$LOGserver_port = getenv("SERVER_PORT");
+$LOGrequest_uri = getenv("REQUEST_URI");
+$LOGhttp_referer = getenv("HTTP_REFERER");
+$LOGbrowser=preg_replace("/\'|\"|\\\\/","",$LOGbrowser);
+$LOGrequest_uri=preg_replace("/\'|\"|\\\\/","",$LOGrequest_uri);
+$LOGhttp_referer=preg_replace("/\'|\"|\\\\/","",$LOGhttp_referer);
+if (preg_match("/443/i",$LOGserver_port)) {$HTTPprotocol = 'https://';}
+ else {$HTTPprotocol = 'http://';}
+if (($LOGserver_port == '80') or ($LOGserver_port == '443') ) {$LOGserver_port='';}
+else {$LOGserver_port = ":$LOGserver_port";}
+$LOGfull_url = "$HTTPprotocol$LOGserver_name$LOGserver_port$LOGrequest_uri";
+
+$LOGhostname = php_uname('n');
+if (strlen($LOGhostname)<1) {$LOGhostname='X';}
+if (strlen($LOGserver_name)<1) {$LOGserver_name='X';}
+
+$stmt="SELECT webserver_id FROM vicidial_webservers where webserver='$LOGserver_name' and hostname='$LOGhostname' LIMIT 1;";
+$rslt=mysql_to_mysqli($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$webserver_id_ct = mysqli_num_rows($rslt);
+if ($webserver_id_ct > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $webserver_id = $row[0];
+ }
+else
+ {
+ ##### insert webserver entry
+ $stmt="INSERT INTO vicidial_webservers (webserver,hostname) values('$LOGserver_name','$LOGhostname');";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $affected_rows = mysqli_affected_rows($link);
+ $webserver_id = mysqli_insert_id($link);
+ }
+
+$stmt="INSERT INTO vicidial_report_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$LOGip', report_name='$report_name', browser='$LOGbrowser', referer='$LOGhttp_referer', notes='$LOGserver_name:$LOGserver_port $LOGscript_name |$user, $campaign_id, $user_group, $status, $start_datetime, $end_datetime, $file_download|', url='$LOGfull_url', webserver='$webserver_id';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+$report_log_id = mysqli_insert_id($link);
+##### END log visit to the vicidial_report_log table #####
+
+if ( (strlen($slave_db_server)>5) and (preg_match("/$subreport_name/",$reports_use_slave_db)) )
+ {
+ mysqli_close($link);
+ $use_slave_server=1;
+ $db_source = 'S';
+ require("dbconnect_mysqli.php");
+ echo "\n";
+ }
+
if (!$user || !$start_datetime || !$end_datetime) {echo "Missing information - needs a minimum of: user, start date/time, end date/time"; die;}
function RemoveEmptyArrayStrings($array)
@@ -644,4 +776,24 @@ echo "\n";
echo "";
# print_r($agent_sessions_array);
+if ($db_source == 'S')
+ {
+ mysqli_close($link);
+ $use_slave_server=0;
+ $db_source = 'M';
+ require("dbconnect_mysqli.php");
+ }
+
+$ENDtime=date("U");
+$endMS = microtime();
+$startMSary = explode(" ",$startMS);
+$endMSary = explode(" ",$endMS);
+$runS = ($endMSary[0] - $startMSary[0]);
+$runM = ($endMSary[1] - $startMSary[1]);
+$TOTALrun = ($runS + $runM);
+
+$stmt="UPDATE vicidial_report_log set run_time='$TOTALrun' where report_log_id='$report_log_id';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+
?>
diff --git a/www/VERM/display_call_details.php b/www/VERM/display_call_details.php
index 8e23fc90..a9d10c2c 100644
--- a/www/VERM/display_call_details.php
+++ b/www/VERM/display_call_details.php
@@ -7,6 +7,8 @@
# 220825-1611 - First build
# 230126-1158 - Added recording log access, QXZ translation
#
+$subreport_name="VERM Reports";
+$report_display_type="display_call_details.php";
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
@@ -51,6 +53,138 @@ if ($SSallow_web_debug < 1) {$DB=0;}
##### END SETTINGS LOOKUP #####
###########################################
+$stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+$sl_ct = mysqli_num_rows($rslt);
+if ($sl_ct > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $VUselected_language = $row[0];
+ }
+
+$auth=0;
+$reports_auth=0;
+$admin_auth=0;
+$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'REPORTS',0,0);
+if ( ($auth_message == 'GOOD') or ($auth_message == '2FA') )
+ {
+ $auth=1;
+ if ($auth_message == '2FA')
+ {
+ header ("Content-type: text/html; charset=utf-8");
+ echo _QXZ("Your session is expired").". "._QXZ("Click here to log in").".\n";
+ exit;
+ }
+ }
+
+if ($auth > 0)
+ {
+ $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $row=mysqli_fetch_row($rslt);
+ $admin_auth=$row[0];
+
+ $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $row=mysqli_fetch_row($rslt);
+ $reports_auth=$row[0];
+
+ if ($reports_auth < 1)
+ {
+ $VDdisplayMESSAGE = _QXZ("You are not allowed to view reports");
+ Header ("Content-type: text/html; charset=utf-8");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
+ exit;
+ }
+ if ( ($reports_auth > 0) and ($admin_auth < 1) )
+ {
+ $ADD=999999;
+ $reports_only_user=1;
+ }
+ }
+else
+ {
+ $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again");
+ if ($auth_message == 'LOCK')
+ {
+ $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes");
+ Header ("Content-type: text/html; charset=utf-8");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
+ exit;
+ }
+ if ($auth_message == 'IPBLOCK')
+ {
+ $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip";
+ Header ("Content-type: text/html; charset=utf-8");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
+ exit;
+ }
+ Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
+ Header("HTTP/1.0 401 Unauthorized");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n";
+ exit;
+ }
+
+##### BEGIN log visit to the vicidial_report_log table #####
+$LOGip = getenv("REMOTE_ADDR");
+$LOGbrowser = getenv("HTTP_USER_AGENT");
+$LOGscript_name = getenv("SCRIPT_NAME");
+$LOGserver_name = getenv("SERVER_NAME");
+$LOGserver_port = getenv("SERVER_PORT");
+$LOGrequest_uri = getenv("REQUEST_URI");
+$LOGhttp_referer = getenv("HTTP_REFERER");
+$LOGbrowser=preg_replace("/\'|\"|\\\\/","",$LOGbrowser);
+$LOGrequest_uri=preg_replace("/\'|\"|\\\\/","",$LOGrequest_uri);
+$LOGhttp_referer=preg_replace("/\'|\"|\\\\/","",$LOGhttp_referer);
+if (preg_match("/443/i",$LOGserver_port)) {$HTTPprotocol = 'https://';}
+ else {$HTTPprotocol = 'http://';}
+if (($LOGserver_port == '80') or ($LOGserver_port == '443') ) {$LOGserver_port='';}
+else {$LOGserver_port = ":$LOGserver_port";}
+$LOGfull_url = "$HTTPprotocol$LOGserver_name$LOGserver_port$LOGrequest_uri";
+
+$LOGhostname = php_uname('n');
+if (strlen($LOGhostname)<1) {$LOGhostname='X';}
+if (strlen($LOGserver_name)<1) {$LOGserver_name='X';}
+
+$stmt="SELECT webserver_id FROM vicidial_webservers where webserver='$LOGserver_name' and hostname='$LOGhostname' LIMIT 1;";
+$rslt=mysql_to_mysqli($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$webserver_id_ct = mysqli_num_rows($rslt);
+if ($webserver_id_ct > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $webserver_id = $row[0];
+ }
+else
+ {
+ ##### insert webserver entry
+ $stmt="INSERT INTO vicidial_webservers (webserver,hostname) values('$LOGserver_name','$LOGhostname');";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $affected_rows = mysqli_affected_rows($link);
+ $webserver_id = mysqli_insert_id($link);
+ }
+
+$stmt="INSERT INTO vicidial_report_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$LOGip', report_name='$report_name', browser='$LOGbrowser', referer='$LOGhttp_referer', notes='$LOGserver_name:$LOGserver_port $LOGscript_name |$detail_id, $closecallid, $uniqueid, $report_display_type|', url='$LOGfull_url', webserver='$webserver_id';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+$report_log_id = mysqli_insert_id($link);
+##### END log visit to the vicidial_report_log table #####
+
+if ( (strlen($slave_db_server)>5) and (preg_match("/$subreport_name/",$reports_use_slave_db)) )
+ {
+ mysqli_close($link);
+ $use_slave_server=1;
+ $db_source = 'S';
+ require("dbconnect_mysqli.php");
+ echo "\n";
+ }
+
+
+
if (!$detail_id) {echo "Beat it."; die;}
if (!$detail_span_height) {$detail_span_height="70";}
$detail_span_height-=15; # account for headers;
@@ -165,6 +299,27 @@ echo "";
#echo "