Fix for slave reporting DB in several VERM scripts
git-svn-id: svn://192.168.202.10@3747 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -42,7 +42,6 @@ $SSalt_row1_background='BDFFBD';
|
|||||||
$SSalt_row2_background='99FF99';
|
$SSalt_row2_background='99FF99';
|
||||||
$SSalt_row3_background='CCFFCC';
|
$SSalt_row3_background='CCFFCC';
|
||||||
$SSbutton_color='EFEFEF';
|
$SSbutton_color='EFEFEF';
|
||||||
|
|
||||||
if ($SSadmin_screen_colors != 'default')
|
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';";
|
$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';";
|
||||||
|
|||||||
@@ -149,6 +149,15 @@ if ($SSallow_web_debug < 1) {$DB=0;}
|
|||||||
##### END SETTINGS LOOKUP #####
|
##### 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 "<!-- Using slave server $slave_db_server $db_source -->\n";
|
||||||
|
}
|
||||||
|
|
||||||
$start_date=preg_replace('/[^-0-9]/', '', $start_date);
|
$start_date=preg_replace('/[^-0-9]/', '', $start_date);
|
||||||
$start_time_hour=preg_replace('/[^0-9]/', '', $start_time_hour);
|
$start_time_hour=preg_replace('/[^0-9]/', '', $start_time_hour);
|
||||||
$start_time_min=preg_replace('/[^0-9]/', '', $start_time_min);
|
$start_time_min=preg_replace('/[^0-9]/', '', $start_time_min);
|
||||||
|
|||||||
@@ -216,6 +216,10 @@ if (mysqli_num_rows($options_rslt)>0)
|
|||||||
$ivr_survey_ingroups_voicemails["$ingroup"]=$options;
|
$ivr_survey_ingroups_voicemails["$ingroup"]=$options;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($setting_name=="caller_id_override" && $setting_value)
|
||||||
|
{$caller_id_override=$setting_value;}
|
||||||
|
|
||||||
# print "$container_entry[$q]\n";
|
# print "$container_entry[$q]\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
# CHANGELOG:
|
# CHANGELOG:
|
||||||
# 220825-1601 - First build
|
# 220825-1601 - First build
|
||||||
#
|
#
|
||||||
|
$report_name="VERM reports";
|
||||||
|
|
||||||
$startMS = microtime();
|
$startMS = microtime();
|
||||||
|
|
||||||
@@ -51,6 +52,15 @@ if ($SSallow_web_debug < 1) {$DB=0;}
|
|||||||
##### END SETTINGS LOOKUP #####
|
##### 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)
|
if ($non_latin < 1)
|
||||||
{
|
{
|
||||||
$DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
|
$DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
# CHANGELOG:
|
# CHANGELOG:
|
||||||
# 220825-1600 - First build
|
# 220825-1600 - First build
|
||||||
#
|
#
|
||||||
|
$report_name="VERM reports";
|
||||||
|
|
||||||
$startMS = microtime();
|
$startMS = microtime();
|
||||||
|
|
||||||
@@ -51,6 +52,16 @@ if ($SSallow_web_debug < 1) {$DB=0;}
|
|||||||
##### END SETTINGS LOOKUP #####
|
##### 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 "<!-- Using slave server $slave_db_server $db_source -->\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# $report_name = 'Vicidial Enhanced Reporting Module';
|
# $report_name = 'Vicidial Enhanced Reporting Module';
|
||||||
require("../$SSadmin_web_directory/screen_colors.php");
|
require("../$SSadmin_web_directory/screen_colors.php");
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
# CHANGELOG:
|
# CHANGELOG:
|
||||||
# 220825-1612 - First build
|
# 220825-1612 - First build
|
||||||
#
|
#
|
||||||
|
$subreport_name="VERM Reports";
|
||||||
|
$report_display_type="display_agent_details.php";
|
||||||
|
|
||||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
$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").". <a href=\"admin.php\">"._QXZ("Click here to log in")."</a>.\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 "<!-- Using slave server $slave_db_server $db_source -->\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (!$user || !$start_datetime || !$end_datetime) {echo "Missing information - needs a minimum of: user, start date/time, end date/time"; die;}
|
if (!$user || !$start_datetime || !$end_datetime) {echo "Missing information - needs a minimum of: user, start date/time, end date/time"; die;}
|
||||||
|
|
||||||
function RemoveEmptyArrayStrings($array)
|
function RemoveEmptyArrayStrings($array)
|
||||||
@@ -644,4 +776,24 @@ echo "</span>\n";
|
|||||||
echo "</td></tr></table>";
|
echo "</td></tr></table>";
|
||||||
# print_r($agent_sessions_array);
|
# 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);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
# 220825-1611 - First build
|
# 220825-1611 - First build
|
||||||
# 230126-1158 - Added recording log access, QXZ translation
|
# 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_USER=$_SERVER['PHP_AUTH_USER'];
|
||||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||||
@@ -51,6 +53,138 @@ if ($SSallow_web_debug < 1) {$DB=0;}
|
|||||||
##### END SETTINGS LOOKUP #####
|
##### 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").". <a href=\"admin.php\">"._QXZ("Click here to log in")."</a>.\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 "<!-- Using slave server $slave_db_server $db_source -->\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!$detail_id) {echo "Beat it."; die;}
|
if (!$detail_id) {echo "Beat it."; die;}
|
||||||
if (!$detail_span_height) {$detail_span_height="70";}
|
if (!$detail_span_height) {$detail_span_height="70";}
|
||||||
$detail_span_height-=15; # account for headers;
|
$detail_span_height-=15; # account for headers;
|
||||||
@@ -165,6 +299,27 @@ echo "</td></tr></table>";
|
|||||||
#echo "</body>";
|
#echo "</body>";
|
||||||
#echo "</html>";
|
#echo "</html>";
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
function GetCallerCode($uniqueid)
|
function GetCallerCode($uniqueid)
|
||||||
{
|
{
|
||||||
global $link, $DB;
|
global $link, $DB;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
# CHANGELOG:
|
# CHANGELOG:
|
||||||
# 220825-1610 - First build
|
# 220825-1610 - First build
|
||||||
#
|
#
|
||||||
|
$subreport_name="VERM Reports";
|
||||||
|
$report_display_type="display_outcomes_details.php";
|
||||||
|
|
||||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||||
@@ -110,6 +112,127 @@ else
|
|||||||
$sort_answered_details = preg_replace('/[^\s-_0-9\p{L}]/u','',$sort_answered_details);
|
$sort_answered_details = preg_replace('/[^\s-_0-9\p{L}]/u','',$sort_answered_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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").". <a href=\"admin.php\">"._QXZ("Click here to log in")."</a>.\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 |$start_datetime, $end_datetime, $user, $campaign_id, $users, $teams, $location, $user_group, $status_name |', 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 (!$start_datetime || !$end_datetime) {echo "Missing information - needs start date/time, end date/time"; $die=1;}
|
if (!$start_datetime || !$end_datetime) {echo "Missing information - needs start date/time, end date/time"; $die=1;}
|
||||||
|
|
||||||
function RemoveEmptyArrayStrings($array)
|
function RemoveEmptyArrayStrings($array)
|
||||||
@@ -435,7 +558,7 @@ $HTML_output.="<link rel=\"stylesheet\" href=\"calendar.css\">\n";
|
|||||||
$HTML_output.="<script language=\"JavaScript\" src=\"VERM_functions.js\"></script>\n";
|
$HTML_output.="<script language=\"JavaScript\" src=\"VERM_functions.js\"></script>\n";
|
||||||
$HTML_output.="</head>\n";
|
$HTML_output.="</head>\n";
|
||||||
$HTML_output.="<body>\n";
|
$HTML_output.="<body>\n";
|
||||||
$HTML_output.="<form action='$PHP_SELF' method='POST'>\n";
|
$HTML_output.="$slave_output<form action='$PHP_SELF' method='POST'>\n";
|
||||||
|
|
||||||
$HTML_output.="<input type='hidden' name='vicidial_queue_groups' id='vicidial_queue_groups' value='$vicidial_queue_groups'>\n";
|
$HTML_output.="<input type='hidden' name='vicidial_queue_groups' id='vicidial_queue_groups' value='$vicidial_queue_groups'>\n";
|
||||||
$HTML_output.="<input type='hidden' name='user' id='user' value='$user'>\n";
|
$HTML_output.="<input type='hidden' name='user' id='user' value='$user'>\n";
|
||||||
@@ -457,7 +580,7 @@ $HTML_output.="<td align='left'>";
|
|||||||
#$HTML_output.="<div style='position:fixed; top: -5; right: -30;'><a onClick='HideAgentDetails()'><h2 class='rpt_header'>[X]</h2></a></div>";
|
#$HTML_output.="<div style='position:fixed; top: -5; right: -30;'><a onClick='HideAgentDetails()'><h2 class='rpt_header'>[X]</h2></a></div>";
|
||||||
#$HTML_output.="<div align='left'><h2 class='rpt_header'>Agent Detail: $user</h2></div>";
|
#$HTML_output.="<div align='left'><h2 class='rpt_header'>Agent Detail: $user</h2></div>";
|
||||||
$HTML_output.="<h2 class='rpt_header'>"._QXZ("Statuses Detail").": $NWB#VERM_display_outcomes_detail$NWE</h2>";
|
$HTML_output.="<h2 class='rpt_header'>"._QXZ("Statuses Detail").": $NWB#VERM_display_outcomes_detail$NWE</h2>";
|
||||||
$HTML_output.="\n<!-- $stmt //-->\n";
|
# $HTML_output.="\n<!-- $stmt //-->\n";
|
||||||
$HTML_output.="</td>";
|
$HTML_output.="</td>";
|
||||||
$HTML_output.="<td align='right'>";
|
$HTML_output.="<td align='right'>";
|
||||||
$HTML_output.="<a onClick='HideOutcomesDetails()'><h2 class='rpt_header'>[X]</h2></a>";
|
$HTML_output.="<a onClick='HideOutcomesDetails()'><h2 class='rpt_header'>[X]</h2></a>";
|
||||||
|
|||||||
Reference in New Issue
Block a user