LICENSE: AGPLv2 # # live real-time stats for the VICIDIAL Auto-Dialer all servers # # Rewritten from AST_timeonVDADall.php report to be AJAX and javascript instead # of link-driven # # * Requires AST_timeonVDADall.php for AJAX-derived stats information # # CHANGELOG: # 101216-1355 - First Build # 101218-1520 - Small time reload bug fix and formatting fixes # 110111-1557 - Added options.php options, minor bug fixes # 110113-1736 - Small fix # 110303-2124 - Added agent on-hook phone indication and RING status and color # 110316-2216 - Added Agent, Carrier and Preset options.php settings # 110516-2128 - IE fix # 110526-1807 - Added webphone_auto_answer option # 120223-1917 - Added multi-user-group options # 121129-2131 - Fixed Choose link position # 130414-0247 - Added report logging # 130610-0944 - Finalized changing of all ereg instances to preg # 130616-2237 - Added filtering of input to prevent SQL injection attacks and new user auth # 130901-0858 - Changed to mysqli PHP functions # 140108-0722 - Added webserver and hostname to report logging # 140624-1423 - Added droppedOFtotal options.php option # 141001-2200 - Finalized adding QXZ translation to all admin files # 141230-0032 - Added code for on-the-fly language translations display # 150307-0823 - Fixes for QXZ # 150804-0953 - Added WHISPER option agent monitoring # 160227-1157 - Added INGROUPcolorOVERRIDE option # 160327-1258 - Added report_display_type option and several design changes # 160406-1852 - Added WALL options for report_display_type # 160413-2003 - Added WALL_4 option # 160803-1902 - Fixed issue with ERROR in campaign/ingroup name # 170318-0942 - Added websocket variable for embedded webphone # 170321-1145 - Added pause code time limits colors # 170409-1557 - Added IP List validation code # 180330-1344 - Added fix for WebRTC webphone microphone permissions # 181128-1040 - Added external_web_socket_url option # 190302-1927 - Added variable-length header icon tables # 190414-1106 - Made admin and summary report links conditional, RS_logoutLINK options.php option # 190420-1729 - Added RS_ListenBarge options.php setting # 190513-1711 - Added ingroup filter # 190525-2205 - Added rust color definition # 190927-1758 - Fixed PHP7 array issue # 200401-1930 - Added option to show more customer info to level 9 users # 200428-1002 - Added RS_report_default_format options.php setting # 200506-1633 - Added RS_CUSTINFOminUL options.php setting # 200815-0928 - Added agent-paused 10 & 15 minute indicators # 201107-2254 - Added optional display of parked calls stats, inbound SLA and LIMITED report type # 210314-2039 - Added DID Description for inbound calls # 211216-0846 - Added new User Group options # 220217-2046 - Added input variable filters # 220221-1514 - Added allow_web_debug system setting # 221105-0826 - Added webphone_settings to webphone launch data, issue #1385 # 230308-0215 - Added option to show customer phone code # 230421-0106 - Added AGENTlatency display # 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 # 260420-1441 - More code updates for PHP8 compatibility, fix for INB CALLS # $startMS = microtime(); $version = '2.14-49'; $build = '260420-1441'; header ("Content-type: text/html; charset=utf-8"); require("dbconnect_mysqli.php"); require("functions.php"); $PHP_AUTH_USER=(array_key_exists('PHP_AUTH_USER', $_SERVER) ? $_SERVER['PHP_AUTH_USER'] : ""); $PHP_AUTH_PW=(array_key_exists('PHP_AUTH_PW', $_SERVER) ? $_SERVER['PHP_AUTH_PW'] : ""); $PHP_SELF=$_SERVER['PHP_SELF']; $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); # if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} # elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} if (isset($_GET["RR"])) {$RR=$_GET["RR"];} elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} if (isset($_GET["inbound"])) {$inbound=$_GET["inbound"];} elseif (isset($_POST["inbound"])) {$inbound=$_POST["inbound"];} else {$inbound="";} if (isset($_GET["group"])) {$group=$_GET["group"];} elseif (isset($_POST["group"])) {$group=$_POST["group"];} if (isset($_GET["groups"])) {$groups=$_GET["groups"];} elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} else {$groups="";} if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} if (isset($_GET["user_group_filter"])) {$user_group_filter=$_GET["user_group_filter"];} elseif (isset($_POST["user_group_filter"])) {$user_group_filter=$_POST["user_group_filter"];} else {$user_group_filter="";} if (isset($_GET["ingroup_filter"])) {$ingroup_filter=$_GET["ingroup_filter"];} elseif (isset($_POST["ingroup_filter"])) {$ingroup_filter=$_POST["ingroup_filter"];} else {$ingroup_filter="";} if (isset($_GET["inbound_calls_filter"])) {$inbound_calls_filter=$_GET["inbound_calls_filter"];} elseif (isset($_POST["inbound_calls_filter"])) {$inbound_calls_filter=$_POST["inbound_calls_filter"];} else {$inbound_calls_filter="";} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} else {$adastats="";} # if (isset($_GET["submit"])) {$submit=$_GET["submit"];} # elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} # if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} # elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} else {$SIPmonitorLINK="";} if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} else {$IAXmonitorLINK="";} if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} if (isset($_GET["CALLSdisplay"])) {$CALLSdisplay=$_GET["CALLSdisplay"];} elseif (isset($_POST["CALLSdisplay"])) {$CALLSdisplay=$_POST["CALLSdisplay"];} if (isset($_GET["PHONEdisplay"])) {$PHONEdisplay=$_GET["PHONEdisplay"];} elseif (isset($_POST["PHONEdisplay"])) {$PHONEdisplay=$_POST["PHONEdisplay"];} if (isset($_GET["MONITORdisplay"])) {$MONITORdisplay=$_GET["MONITORdisplay"];} elseif (isset($_POST["MONITORdisplay"])) {$MONITORdisplay=$_POST["MONITORdisplay"];} if (isset($_GET["CUSTPHONEdisplay"])) {$CUSTPHONEdisplay=$_GET["CUSTPHONEdisplay"];} elseif (isset($_POST["CUSTPHONEdisplay"])) {$CUSTPHONEdisplay=$_POST["CUSTPHONEdisplay"];} if (isset($_GET["CUSTINFOdisplay"])) {$CUSTINFOdisplay=$_GET["CUSTINFOdisplay"];} elseif (isset($_POST["CUSTINFOdisplay"])) {$CUSTINFOdisplay=$_POST["CUSTINFOdisplay"];} if (isset($_GET["NOLEADSalert"])) {$NOLEADSalert=$_GET["NOLEADSalert"];} elseif (isset($_POST["NOLEADSalert"])) {$NOLEADSalert=$_POST["NOLEADSalert"];} else {$NOLEADSalert="";} if (isset($_GET["DROPINGROUPstats"])) {$DROPINGROUPstats=$_GET["DROPINGROUPstats"];} elseif (isset($_POST["DROPINGROUPstats"])) {$DROPINGROUPstats=$_POST["DROPINGROUPstats"];} else {$DROPINGROUPstats="";} if (isset($_GET["ALLINGROUPstats"])) {$ALLINGROUPstats=$_GET["ALLINGROUPstats"];} elseif (isset($_POST["ALLINGROUPstats"])) {$ALLINGROUPstats=$_POST["ALLINGROUPstats"];} else {$ALLINGROUPstats="";} if (isset($_GET["with_inbound"])) {$with_inbound=$_GET["with_inbound"];} elseif (isset($_POST["with_inbound"])) {$with_inbound=$_POST["with_inbound"];} if (isset($_GET["monitor_active"])) {$monitor_active=$_GET["monitor_active"];} elseif (isset($_POST["monitor_active"])) {$monitor_active=$_POST["monitor_active"];} else {$monitor_active="";} if (isset($_GET["monitor_phone"])) {$monitor_phone=$_GET["monitor_phone"];} elseif (isset($_POST["monitor_phone"])) {$monitor_phone=$_POST["monitor_phone"];} else {$monitor_phone="";} if (isset($_GET["CARRIERstats"])) {$CARRIERstats=$_GET["CARRIERstats"];} elseif (isset($_POST["CARRIERstats"])) {$CARRIERstats=$_POST["CARRIERstats"];} if (isset($_GET["ShowCustPhoneCode"])) {$ShowCustPhoneCode=$_GET["ShowCustPhoneCode"];} elseif (isset($_POST["ShowCustPhoneCode"])) {$ShowCustPhoneCode=$_POST["ShowCustPhoneCode"];} if (isset($_GET["PRESETstats"])) {$PRESETstats=$_GET["PRESETstats"];} elseif (isset($_POST["PRESETstats"])) {$PRESETstats=$_POST["PRESETstats"];} if (isset($_GET["AGENTtimeSTATS"])) {$AGENTtimeSTATS=$_GET["AGENTtimeSTATS"];} elseif (isset($_POST["AGENTtimeSTATS"])) {$AGENTtimeSTATS=$_POST["AGENTtimeSTATS"];} if (isset($_GET["AGENTlatency"])) {$AGENTlatency=$_GET["AGENTlatency"];} elseif (isset($_POST["AGENTlatency"])) {$AGENTlatency=$_POST["AGENTlatency"];} if (isset($_GET["INGROUPcolorOVERRIDE"])) {$INGROUPcolorOVERRIDE=$_GET["INGROUPcolorOVERRIDE"];} elseif (isset($_POST["INGROUPcolorOVERRIDE"])) {$INGROUPcolorOVERRIDE=$_POST["INGROUPcolorOVERRIDE"];} else {$INGROUPcolorOVERRIDE="";} if (isset($_GET["droppedOFtotal"])) {$droppedOFtotal=$_GET["droppedOFtotal"];} elseif (isset($_POST["droppedOFtotal"])) {$droppedOFtotal=$_POST["droppedOFtotal"];} if (isset($_GET["report_display_type"])) {$report_display_type=$_GET["report_display_type"];} elseif (isset($_POST["report_display_type"])) {$report_display_type=$_POST["report_display_type"];} else {$report_display_type="";} if (isset($_GET["parkSTATS"])) {$parkSTATS=$_GET["parkSTATS"];} elseif (isset($_POST["parkSTATS"])) {$parkSTATS=$_POST["parkSTATS"];} if (isset($_GET["SLAinSTATS"])) {$SLAinSTATS=$_GET["SLAinSTATS"];} elseif (isset($_POST["SLAinSTATS"])) {$SLAinSTATS=$_POST["SLAinSTATS"];} $report_name = 'Real-Time Main Report'; $db_source = 'M'; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,agent_whisper_enabled,report_default_format,enable_pause_code_limits,allow_web_debug 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]; $outbound_autodial_active = $row[1]; $slave_db_server = $row[2]; $reports_use_slave_db = $row[3]; $SSenable_languages = $row[4]; $SSlanguage_method = $row[5]; $agent_whisper_enabled = $row[6]; $SSreport_default_format = $row[7]; $SSenable_pause_code_limits = $row[8]; $SSallow_web_debug = $row[9]; } if ($SSallow_web_debug < 1 || !isset($DB)) {$DB=0;} $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); ##### END SETTINGS LOOKUP ##### ########################################### $webphone_width = '460'; $webphone_height = '500'; $webphone_left = '600'; $webphone_top = '27'; $webphone_bufw = '250'; $webphone_bufh = '1'; $webphone_pad = '10'; $webphone_clpos = "
  "._QXZ("webphone")." -"; $RS_ListenBarge = 'MONITOR|BARGE|WHISPER'; $RS_no_DEAD_status=0; $RS_hide_CUST_info=0; if (file_exists('options.php')) { require('options.php'); } if (!isset($RS_report_default_format)) {$RS_report_default_format="";} if (strlen($RS_report_default_format) > 3) {$SSreport_default_format = $RS_report_default_format;} if (strlen($report_display_type)<2) {$report_display_type = $SSreport_default_format;} if (!isset($mobile_device)) {$mobile_device="";} if (!isset($DB)) { if (!isset($RS_DB)) {$DB=0;} else {$DB = $RS_DB;} } if (!isset($RR)) { if (!isset($RS_RR)) {$RR=40;} else {$RR = $RS_RR;} } if (!isset($group)) { if (!isset($RS_group)) {$group='ALL-ACTIVE';} else {$group = $RS_group;} } if (!isset($usergroup)) { if (!isset($RS_usergroup)) {$usergroup='';} else {$usergroup = $RS_usergroup;} } if (!isset($UGdisplay)) { if (!isset($RS_UGdisplay)) {$UGdisplay=0;} else {$UGdisplay = $RS_UGdisplay;} } if (!isset($UidORname)) { if (!isset($RS_UidORname)) {$UidORname=1;} else {$UidORname = $RS_UidORname;} } if (!isset($orderby)) { if (!isset($RS_orderby)) {$orderby='timeup';} else {$orderby = $RS_orderby;} } if (!isset($SERVdisplay)) { if (!isset($RS_SERVdisplay)) {$SERVdisplay=0;} else {$SERVdisplay = $RS_SERVdisplay;} } if (!isset($CALLSdisplay)) { if (!isset($RS_CALLSdisplay)) {$CALLSdisplay=1;} else {$CALLSdisplay = $RS_CALLSdisplay;} } if (!isset($PHONEdisplay)) { if (!isset($RS_PHONEdisplay)) {$PHONEdisplay=0;} else {$PHONEdisplay = $RS_PHONEdisplay;} } if (!isset($MONITORdisplay)) { if (!isset($RS_MONITORdisplay)) {$MONITORdisplay=0;} else {$MONITORdisplay = $RS_MONITORdisplay;} } if (!isset($CUSTPHONEdisplay)) { if (!isset($RS_CUSTPHONEdisplay)) {$CUSTPHONEdisplay=0;} else {$CUSTPHONEdisplay = $RS_CUSTPHONEdisplay;} } if (!isset($CUSTINFOdisplay)) { if (!isset($RS_CUSTINFOdisplay)) {$CUSTINFOdisplay=0;} else {$CUSTINFOdisplay = $RS_CUSTINFOdisplay;} } if (isset($RS_CUSTINFOminUL)) { $CUSTINFOminUL = $RS_CUSTINFOminUL; } else {$CUSTINFOminUL = 9;} if (!isset($PAUSEcodes)) { if (!isset($RS_PAUSEcodes)) {$PAUSEcodes='N';} else {$PAUSEcodes = $RS_PAUSEcodes;} } if (!isset($with_inbound)) { if (!isset($RS_with_inbound)) { if ($outbound_autodial_active > 0) {$with_inbound='Y';} # N=no, Y=yes, O=only else {$with_inbound='O';} # N=no, Y=yes, O=only } else {$with_inbound = $RS_with_inbound;} } if (!isset($ShowCustPhoneCode)) { if (!isset($RS_ShowCustPhoneCode)) {$ShowCustPhoneCode='0';} else {$ShowCustPhoneCode = $RS_ShowCustPhoneCode;} } if (!isset($CARRIERstats)) { if (!isset($RS_CARRIERstats)) {$CARRIERstats='0';} else {$CARRIERstats = $RS_CARRIERstats;} } if (!isset($PRESETstats)) { if (!isset($RS_PRESETstats)) {$PRESETstats='0';} else {$PRESETstats = $RS_PRESETstats;} } if (!isset($AGENTtimeSTATS)) { if (!isset($RS_AGENTtimeSTATS)) {$AGENTtimeSTATS='0';} else {$AGENTtimeSTATS = $RS_AGENTtimeSTATS;} } if (!isset($AGENTlatency)) { if (!isset($RS_AGENTlatency)) {$AGENTlatency='0';} else {$AGENTlatency = $RS_AGENTlatency;} } if (!isset($parkSTATS)) { if (!isset($RS_parkSTATS)) {$parkSTATS='0';} else {$parkSTATS = $RS_parkSTATS;} } if (!isset($SLAinSTATS)) { if (!isset($RS_SLAinSTATS)) {$SLAinSTATS='0';} else {$SLAinSTATS = $RS_SLAinSTATS;} } if (!isset($droppedOFtotal)) { if (!isset($RS_droppedOFtotal)) {$droppedOFtotal='0';} else {$droppedOFtotal = $RS_droppedOFtotal;} } $ingroup_detail=''; ### Force hard-coded variables # $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 (!is_array($user_group_filter)) {$user_group_filter=array();} if (!is_array($ingroup_filter)) {$ingroup_filter=array();} if (!is_array($inbound_calls_filter)) {$inbound_calls_filter=array();} if (!isset($is_webphone)) {$is_webphone='N';} $NOW_TIME = date("Y-m-d H:i:s"); $NOW_DAY = date("Y-m-d"); $NOW_HOUR = date("H:i:s"); $STARTtime = date("U"); $epochONEminuteAGO = ($STARTtime - 60); $timeONEminuteAGO = date("Y-m-d H:i:s",$epochONEminuteAGO); $epochFIVEminutesAGO = ($STARTtime - 300); $timeFIVEminutesAGO = date("Y-m-d H:i:s",$epochFIVEminutesAGO); $epochFIFTEENminutesAGO = ($STARTtime - 900); $timeFIFTEENminutesAGO = date("Y-m-d H:i:s",$epochFIFTEENminutesAGO); $epochONEhourAGO = ($STARTtime - 3600); $timeONEhourAGO = date("Y-m-d H:i:s",$epochONEhourAGO); $epochSIXhoursAGO = ($STARTtime - 21600); $timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); $epochTWENTYFOURhoursAGO = ($STARTtime - 86400); $timeTWENTYFOURhoursAGO = date("Y-m-d H:i:s",$epochTWENTYFOURhoursAGO); $webphone_content=''; if ($non_latin < 1) { $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 { $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); } $RR = preg_replace('/[^0-9]/', '', $RR); $inbound = preg_replace('/[^-_0-9a-zA-Z]/', '', $inbound); $group = preg_replace('/[^-_0-9a-zA-Z]/', '', $group); $groups[0] = preg_replace('/[^-_0-9a-zA-Z]/', '', $groups[0]); $usergroup = preg_replace('/[^-_0-9a-zA-Z]/', '', $usergroup); $DB = preg_replace('/[^0-9]/', '', $DB); $adastats = preg_replace('/[^-_0-9a-zA-Z]/', '', $adastats); $SIPmonitorLINK = preg_replace('/[^-_0-9a-zA-Z]/', '', $SIPmonitorLINK); $IAXmonitorLINK = preg_replace('/[^-_0-9a-zA-Z]/', '', $IAXmonitorLINK); $UGdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $UGdisplay); $UidORname = preg_replace('/[^-_0-9a-zA-Z]/', '', $UidORname); $orderby = preg_replace('/[^-_0-9a-zA-Z]/', '', $orderby); $SERVdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $SERVdisplay); $CALLSdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $CALLSdisplay); $PHONEdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHONEdisplay); $MONITORdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $MONITORdisplay); $CUSTPHONEdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $CUSTPHONEdisplay); $CUSTINFOdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $CUSTINFOdisplay); if ($CUSTINFOdisplay==1) {$CUSTPHONEdisplay=0;} # only one of these should be on at one time if ($CUSTPHONEdisplay==1) {$CUSTINFOdisplay=0;} # only one of these should be on at one time $NOLEADSalert = preg_replace('/[^-_0-9a-zA-Z]/', '', $NOLEADSalert); $DROPINGROUPstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $DROPINGROUPstats); $ALLINGROUPstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $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); $ShowCustPhoneCode = preg_replace('/[^-_0-9a-zA-Z]/', '', $ShowCustPhoneCode); $CARRIERstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $CARRIERstats); $PRESETstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $PRESETstats); $AGENTtimeSTATS = preg_replace('/[^-_0-9a-zA-Z]/', '', $AGENTtimeSTATS); $AGENTlatency = preg_replace('/[^-_0-9a-zA-Z]/', '', $AGENTlatency); $parkSTATS = preg_replace('/[^-_0-9a-zA-Z]/', '', $parkSTATS); $SLAinSTATS = preg_replace('/[^-_0-9a-zA-Z]/', '', $SLAinSTATS); $INGROUPcolorOVERRIDE = preg_replace('/[^-_0-9a-zA-Z]/', '', $INGROUPcolorOVERRIDE); $droppedOFtotal = preg_replace('/[^-_0-9a-zA-Z]/', '', $droppedOFtotal); $report_display_type = preg_replace('/[^-_0-9a-zA-Z]/', '', $report_display_type); $mobile_device = preg_replace('/[^-_0-9a-zA-Z]/', '', $mobile_device); # $RTajax = preg_replace('/[^-_0-9a-zA-Z]/', '', $RTajax); # $RTpass = preg_replace('/[^-_0-9a-zA-Z]/', '', $RTpass); # $RTuser = preg_replace('/[^-_0-9a-zA-Z]/', '', $RTuser); # $server_ip = preg_replace('/[^-\._0-9a-zA-Z]/', '', $server_ip); # $SUBMIT = preg_replace('/[^-_0-9a-zA-Z]/', '', $SUBMIT); # $submit = preg_replace('/[^-_0-9a-zA-Z]/', '', $submit); # Variables filtered further down in the code # $user_group_filter # $ingroup_filter $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',1,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 |$groups[0]|', 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("/$report_name/",$reports_use_slave_db)) ) { mysqli_close($link); $use_slave_server=1; $db_source = 'S'; require("dbconnect_mysqli.php"); echo "\n"; } if ($auth) { $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,callcard_admin,force_change_password,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,modify_contacts,modify_same_user_level from vicidial_users where user='$PHP_AUTH_USER';"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGfull_name =$row[3]; $LOGuser_level =$row[4]; $LOGuser_group =$row[5]; $LOGdelete_users =$row[8]; $LOGdelete_user_groups =$row[9]; $LOGdelete_lists =$row[10]; $LOGdelete_campaigns =$row[11]; $LOGdelete_ingroups =$row[12]; $LOGdelete_remote_agents =$row[13]; $LOGload_leads =$row[14]; $LOGcampaign_detail =$row[15]; $LOGast_admin_access =$row[16]; $LOGast_delete_phones =$row[17]; $LOGdelete_scripts =$row[18]; $LOGdelete_filters =$row[29]; $LOGalter_agent_interface =$row[30]; $LOGdelete_call_times =$row[32]; $LOGmodify_call_times =$row[33]; $LOGmodify_users =$row[34]; $LOGmodify_campaigns =$row[35]; $LOGmodify_lists =$row[36]; $LOGmodify_scripts =$row[37]; $LOGmodify_filters =$row[38]; $LOGmodify_ingroups =$row[39]; $LOGmodify_usergroups =$row[40]; $LOGmodify_remoteagents =$row[41]; $LOGmodify_servers =$row[42]; $LOGview_reports =$row[43]; $LOGmodify_dids =$row[56]; $LOGdelete_dids =$row[57]; $LOGmanager_shift_enforcement_override=$row[61]; $LOGexport_reports =$row[64]; $LOGdelete_from_dnc =$row[65]; $LOGcallcard_admin =$row[70]; $LOGforce_change_password =$row[71]; $LOGmodify_shifts =$row[72]; $LOGmodify_phones =$row[73]; $LOGmodify_carriers =$row[74]; $LOGmodify_labels =$row[75]; $LOGmodify_statuses =$row[76]; $LOGmodify_voicemail =$row[77]; $LOGmodify_audiostore =$row[78]; $LOGmodify_moh =$row[79]; $LOGmodify_tts =$row[80]; $LOGmodify_contacts =$row[81]; $LOGmodify_same_user_level =$row[82]; $stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times,reports_header_override,admin_home_url from vicidial_user_groups where user_group='$LOGuser_group';"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGallowed_campaigns = $row[0]; $LOGallowed_reports = $row[1]; $LOGadmin_viewable_groups = $row[2]; $LOGadmin_viewable_call_times = $row[3]; $LOGreports_header_override = $row[4]; $LOGadmin_home_url = $row[5]; if (strlen($LOGadmin_home_url) > 5) {$SSadmin_home_url = $LOGadmin_home_url;} $LOGadmin_viewable_groupsSQL=''; $valLOGadmin_viewable_groupsSQL=''; $vmLOGadmin_viewable_groupsSQL=''; $rawLOGadmin_viewable_groupsSQL=''; $whereLOGadmin_viewable_groupsSQL=''; if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGadmin_viewable_groups) > 3) ) { $rawLOGadmin_viewable_groupsSQL = preg_replace("/ \-/",'',$LOGadmin_viewable_groups); $rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL); $LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; $whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; $valLOGadmin_viewable_groupsSQL = "and val.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; $vmLOGadmin_viewable_groupsSQL = "and vm.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; } else {$admin_viewable_groupsALL=1;} $RS_UGlatencyALLOWED=0; if (isset($RS_UGlatencyRESTRICT) && strlen($RS_UGlatencyRESTRICT) > 0) { $latencyUGary = preg_split('/\|/',$RS_UGlatencyRESTRICT); foreach( $latencyUGary as $lineUGR ) { if ($lineUGR == $LOGuser_group) {$RS_UGlatencyALLOWED++;} } } else {$RS_UGlatencyALLOWED=1;} } # and (preg_match("/MONITOR|BARGE|HIJACK|WHISPER/",$monitor_active) ) ) if ( (!isset($monitor_phone)) or (strlen($monitor_phone)<1) ) { $stmt="select phone_login from vicidial_users where user='$PHP_AUTH_USER';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysqli_fetch_row($rslt); $monitor_phone = $row[0]; } $stmt="SELECT realtime_block_user_info,user_group from vicidial_users where user='$PHP_AUTH_USER';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $realtime_block_user_info = $row[0]; $LOGuser_group = $row[1]; $stmt="SELECT allowed_campaigns,allowed_reports,webphone_url_override,webphone_dialpad_override,webphone_systemkey_override,allowed_custom_reports from vicidial_user_groups where user_group='$LOGuser_group';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGallowed_campaigns = $row[0]; $LOGallowed_reports = "$row[1]$row[5]"; $webphone_url = $row[2]; $webphone_dialpad_override = $row[3]; $system_key = $row[4]; if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) { Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); Header("HTTP/1.0 401 Unauthorized"); echo _QXZ("You are not allowed to view this report").": |$PHP_AUTH_USER|$report_name|"._QXZ("$report_name")."|\n"; exit; } $SUMMARYauth=1; if ( (!preg_match("/Real-Time Campaign Summary/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) {$SUMMARYauth=0;} $LOGallowed_campaignsSQL=''; $whereLOGallowed_campaignsSQL=''; if ( (!preg_match("/ALL-/",$LOGallowed_campaigns)) ) { $rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns); $rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL); $LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')"; $whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')"; } $regexLOGallowed_campaigns = " $LOGallowed_campaigns "; $allactivecampaigns=''; $stmt="select campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $groups_to_print = mysqli_num_rows($rslt); $LISTgroups=array(); $LISTnames=array(); $i=0; $LISTgroups[$i]='ALL-ACTIVE'; $LISTnames[$i]='All active campaigns'; $i++; $groups_to_print++; while ($i < $groups_to_print) { $row=mysqli_fetch_row($rslt); $LISTgroups[$i] =$row[0]; $LISTnames[$i] =$row[1]; $allactivecampaigns .= "'$LISTgroups[$i]',"; $i++; } $allactivecampaigns .= "''"; $i=0; $group_string='|'; $group_SQL=""; $groupQS=""; $group_ct = count($groups); while($i < $group_ct) { $groups[$i] = preg_replace('/[^-_0-9\p{L}]/u', '', $groups[$i]); if ( (preg_match("/ $groups[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/ALL-/",$LOGallowed_campaigns)) ) { $group_string .= "$groups[$i]|"; $group_SQL .= "'$groups[$i]',"; $groupQS .= "&groups[]=$groups[$i]"; } $i++; } $group_SQL = preg_replace('/,$/i', '',$group_SQL); $i=0; $user_group_string='|'; $user_group_SQL=""; $usergroupQS=""; $user_group_ct = count($user_group_filter); while($i < $user_group_ct) { $user_group_filter[$i] = preg_replace('/[^-_0-9\p{L}]/u', '', $user_group_filter[$i]); # if ( (preg_match("/ $user_group_filter[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/ALL-/",$LOGallowed_campaigns)) ) # { $user_group_string .= "$user_group_filter[$i]|"; $user_group_SQL .= "'$user_group_filter[$i]',"; $usergroupQS .= "&user_group_filter[]=$user_group_filter[$i]"; # } $i++; } $user_group_SQL = preg_replace('/,$/i', '',$user_group_SQL); $i=0; $ingroup_string='|'; $ingroup_SQL=""; $ingroupQS=""; $ingroup_ct = count($ingroup_filter); while($i < $ingroup_ct) { $ingroup_filter[$i] = preg_replace('/[^-_0-9\p{L}]/u', '', $ingroup_filter[$i]); $ingroup_string .= "$ingroup_filter[$i]|"; $ingroup_SQL .= "'$ingroup_filter[$i]',"; $ingroupQS .= "&ingroup_filter[]=$ingroup_filter[$i]"; $i++; } $ingroup_SQL = preg_replace('/,$/i', '',$ingroup_SQL); $i=0; $inbound_calls_string='|'; $inbound_calls_SQL=""; $inbcallQS=""; $inbound_calls_ct = count($inbound_calls_filter); while($i < $inbound_calls_ct) { $inbound_calls_filter[$i] = preg_replace('/[^-_0-9\p{L}]/u', '', $inbound_calls_filter[$i]); $inbound_calls_string .= "$inbound_calls_filter[$i]|"; $inbound_calls_SQL .= "'$inbound_calls_filter[$i]',"; $inbcallQS .= "&inbound_calls_filter[]=$inbound_calls_filter[$i]"; $i++; } $inbound_calls_SQL = preg_replace('/,$/i', '',$inbound_calls_SQL); ### if no campaigns selected, display all if ( ($group_ct < 1) or (strlen($group_string) < 2) ) { $groups[0] = 'ALL-ACTIVE'; $group_string = '|ALL-ACTIVE|'; $group = 'ALL-ACTIVE'; $groupQS .= "&groups[]=ALL-ACTIVE"; } ### if no user groups selected, display all $user_group_none=0; if ( ($user_group_ct < 1) or (strlen($user_group_string) < 2) ) { $user_group_filter[0] = 'ALL-GROUPS'; $user_group_string = '|ALL-GROUPS|'; $usergroupQS .= "&user_group_filter[]=ALL-GROUPS"; $user_group_none=1; } ### if no ingroups selected, display all $ingroup_none=0; if ( ($ingroup_ct < 1) or (strlen($ingroup_string) < 2) ) { $ingroup_filter[0] = 'ALL-INGROUPS'; $ingroup_string = '|ALL-INGROUPS|'; $ingroupQS .= "&ingroup_filter[]=ALL-INGROUPS"; $ingroup_none=1; } ### if no call count ingroups selected, display all $inbound_calls_none=0; if ( ($inbound_calls_ct < 1) or (strlen($inbound_calls_string) < 2) ) { $inbound_calls_filter[0] = 'ALL-INGROUPS'; $inbound_calls_string = '|ALL-INGROUPS|'; $inbcallQS .= "&inbound_calls_filter[]=ALL-INGROUPS"; $inbound_calls_none=1; } if ( (preg_match('/\s\-\-NONE\-\-\s/',$group_string) ) or ($group_ct < 1) ) { $all_active = 0; $group_SQL = "''"; $group_SQLand = "and FALSE"; $group_SQLwhere = "where FALSE"; } elseif ( preg_match('/ALL\-ACTIVE/i',$group_string) ) { $all_active = 1; $group_SQL = $allactivecampaigns; $group_SQLand = "and campaign_id IN($allactivecampaigns)"; $group_SQLwhere = "where campaign_id IN($allactivecampaigns)"; } else { $all_active = 0; $group_SQLand = "and campaign_id IN($group_SQL)"; $group_SQLwhere = "where campaign_id IN($group_SQL)"; } if ( (preg_match('/\s\-\-NONE\-\-\s/',$user_group_string) ) or ($user_group_ct < 1) ) { $all_active_groups = 0; $user_group_SQL = "''"; # $user_group_SQLand = "and FALSE"; # $user_group_SQLwhere = "where FALSE"; } elseif ( preg_match('/ALL\-GROUPS/i',$user_group_string) ) { $all_active_groups = 1; # $user_group_SQL = ''; $user_group_SQL = "'$rawLOGadmin_viewable_groupsSQL'"; # $group_SQLand = "and campaign_id IN($allactivecampaigns)"; # $group_SQLwhere = "where campaign_id IN($allactivecampaigns)"; } else { $all_active_groups = 0; # $user_group_SQLand = "and user_group IN($user_group_SQL)"; # $user_group_SQLwhere = "where user_group IN($user_group_SQL)"; } if ( (preg_match('/\s\-\-NONE\-\-\s/',$ingroup_string) ) or ($ingroup_ct < 1) ) { $all_active_ingroups = 0; $ingroup_SQL = "''"; } elseif ( preg_match('/ALL\-INGROUPS/i',$ingroup_string) ) { $all_active_ingroups = 1; $ingroup_SQL = "'$rawLOGadmin_viewable_groupsSQL'"; } else { $all_active_ingroups = 0; } if ( (preg_match('/\s\-\-NONE\-\-\s/',$inbound_calls_string) ) or ($inbound_calls_ct < 1) ) { $all_active_inbound_calls = 0; $inbound_calls_SQL = "''"; } elseif ( preg_match('/ALL\-INGROUPS/i',$inbound_calls_string) ) { $all_active_inbound_calls = 1; $inbound_calls_SQL = "'$rawLOGadmin_viewable_groupsSQL'"; } $stmt="select user_group, group_name from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;"; $rslt=mysql_to_mysqli($stmt, $link); if (!isset($DB)) {$DB=0;} if ($DB) {echo "$stmt\n";} $usergroups_to_print = mysqli_num_rows($rslt); $i=0; $usergroups=array(); $usergroupnames=array(); $usergroups[$i]='ALL-GROUPS'; $usergroupnames[$i] = "All user groups"; $i++; $usergroups_to_print++; while ($i < $usergroups_to_print) { $row=mysqli_fetch_row($rslt); $usergroups[$i] =$row[0]; $usergroupnames[$i] =$row[1]; $i++; } $stmt="select group_id,group_name from vicidial_inbound_groups $whereLOGadmin_viewable_groupsSQL order by group_id;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $ingroups_to_print = mysqli_num_rows($rslt); $i=0; $LISTingroups=array(); $LISTingroup_names=array(); $LISTingroups[$i]='ALL-INGROUPS'; $LISTingroup_names[$i]="All in-groups"; $i++; $ingroups_to_print++; $ingroups_string='|'; while ($i < $ingroups_to_print) { $row=mysqli_fetch_row($rslt); $LISTingroups[$i] = $row[0]; $LISTingroup_names[$i] = $row[1]; $ingroups_string .= "$LISTingroups[$i]|"; $i++; } require("screen_colors.php"); if (!isset($RR)) {$RR=4;} $NFB = ''; $NFE = ''; $F=''; $FG=''; $B=''; $BG=''; $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("Select User Groups").":
"; $select_list .= ""; $select_list .= "

"._QXZ("Select In-Groups").":
"; $select_list .= ""; $select_list .= "

"._QXZ("In-Groups for inbound call count").":
"; $select_list .= ""; $select_list .= "
"; $select_list .= ""._QXZ("Close Panel")."

"; $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= ""; if ($UGdisplay > 0) { $select_list .= ""; } $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= ""; ## find if any selected campaigns have presets enabled $presets_enabled=0; $stmt="select count(*) from vicidial_campaigns where enable_xfer_presets='ENABLED' $group_SQLand;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$OUToutput .= "$stmt\n";} $presets_enabled_count = mysqli_num_rows($rslt); if ($presets_enabled_count > 0) { $row=mysqli_fetch_row($rslt); $presets_enabled = $row[0]; } if ($presets_enabled > 0) { $select_list .= ""; } else { $select_list .= ""; } $select_list .= ""; $select_list .= ""; } $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= "
"; $select_list .= _QXZ("Screen Refresh Rate").":
"; $select_list .= _QXZ("Inbound").":
"; $select_list .= _QXZ("Monitor").": "; $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("Inbound SLA Stats").":
"; $select_list .= _QXZ("Show Cust. Phone Code").":
"; $select_list .= _QXZ("Show Carrier Stats").":
"; $select_list .= _QXZ("Show Presets Stats").":
"; $select_list .= _QXZ("Agent Time Stats").":
"; if ($RS_UGlatencyALLOWED > 0) { $select_list .= _QXZ("Agent Latency").":
"; $select_list .= _QXZ("Parked Call Stats").":
"; $select_list .= _QXZ("In-group color override").":
"; $select_list .= _QXZ("Display as").":

"; $select_list .= ""; $select_list .= "         "; $select_list .= "
"; $select_list .= "   "; $select_list .= ""; $select_list .= ""._QXZ("VERSION").": $version   "._QXZ("BUILD").": $build"; $select_list .= "
"; $open_list = '
'._QXZ("Choose Report Display Options").'
'; ##### BEGIN code for embedded webphone for monitoring ##### if (strlen($monitor_phone)>1) { $stmt="SELECT extension,dialplan_number,server_ip,login,pass,protocol,conf_secret,is_webphone,use_external_server_ip,codecs_list,webphone_dialpad,outbound_cid,webphone_auto_answer,webphone_settings from phones where login='$monitor_phone' and active = 'Y';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $Mph_ct = mysqli_num_rows($rslt); if ($Mph_ct > 0) { $row=mysqli_fetch_row($rslt); $extension = $row[0]; $dialplan_number = $row[1]; $webphone_server_ip = $row[2]; $login = $row[3]; $pass = $row[4]; $protocol = $row[5]; $conf_secret = $row[6]; $is_webphone = $row[7]; $use_external_server_ip = $row[8]; $codecs_list = $row[9]; $webphone_dialpad = $row[10]; $outbound_cid = $row[11]; $webphone_auto_answer = $row[12]; $webphone_settings = $row[13]; if ($is_webphone == 'Y') { ### build Iframe variable content for webphone here $codecs_list = preg_replace("/ /",'',$codecs_list); $codecs_list = preg_replace("/-/",'',$codecs_list); $codecs_list = preg_replace("/&/",'',$codecs_list); $stmt="SELECT asterisk_version,web_socket_url,external_web_socket_url from servers where server_ip='$webphone_server_ip' LIMIT 1;"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $asterisk_version = $row[0]; $web_socket_url = $row[1]; $external_web_socket_url = $row[2]; if ( ($use_external_server_ip=='Y') and (strlen($external_web_socket_url) > 5) ) {$web_socket_url = $external_web_socket_url;} if ($use_external_server_ip=='Y') { ##### find external_server_ip if enabled for this phone account $stmt="SELECT external_server_ip FROM servers where server_ip='$webphone_server_ip' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $exip_ct = mysqli_num_rows($rslt); if ($exip_ct > 0) { $row=mysqli_fetch_row($rslt); $webphone_server_ip = $row[0]; } } if (strlen($webphone_url) < 6) { ##### find webphone_url in system_settings and generate IFRAME code for it ##### $stmt="SELECT webphone_url FROM system_settings LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $wu_ct = mysqli_num_rows($rslt); if ($wu_ct > 0) { $row=mysqli_fetch_row($rslt); $webphone_url = $row[0]; } } if (strlen($system_key) < 1) { ##### find system_key in system_settings if populated ##### $stmt="SELECT webphone_systemkey FROM system_settings LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $wsk_ct = mysqli_num_rows($rslt); if ($wsk_ct > 0) { $row=mysqli_fetch_row($rslt); $system_key = $row[0]; } } $webphone_settings_scrubbed = ''; if (strlen($webphone_settings) > 0) { $stmt="SELECT container_entry FROM vicidial_settings_containers WHERE container_id='$webphone_settings';"; $rslt=mysql_to_mysqli($stmt, $link); if (mysqli_num_rows($rslt) > 0) { $row=mysqli_fetch_row($rslt); $webphone_settings_entry = $row[0]; ### scrub unnecessary characters from the settings container $webphone_settings_lines = preg_split('/\r\n|\r|\n/',$webphone_settings_entry); foreach( $webphone_settings_lines as $line ) { # remove comments if ( strpos($line, '#') === 0 ) { $line = substr($line, 0, strpos($line, '#')); } # remove whitespace outside double quotes $line = preg_replace('~"[^"]*"(*SKIP)(*F)|\s+~',"",$line); # remove blank lines if ($line != '') { $webphone_settings_scrubbed = $webphone_settings_scrubbed . $line . '\n'; } } } } # echo ""; if ( ($webphone_dialpad_override != 'DISABLED') and (strlen($webphone_dialpad_override) > 0) ) {$webphone_dialpad = $webphone_dialpad_override;} $webphone_options='INITIAL_LOAD'; if ($webphone_dialpad == 'Y') {$webphone_options .= "--DIALPAD_Y";} if ($webphone_dialpad == 'N') {$webphone_options .= "--DIALPAD_N";} if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} if (strlen($webphone_settings_scrubbed) > 0) {$webphone_options .= "--SETTINGS$webphone_settings_scrubbed";} if (strlen($web_socket_url) > 5) {$webphone_options .= "--WEBSOCKETURL$web_socket_url";} if ($DB > 0) {echo "";} $session_name='RTS01234561234567890'; ### base64 encode variables $b64_phone_login = base64_encode($extension); $b64_phone_pass = base64_encode($conf_secret); $b64_session_name = base64_encode($session_name); $b64_server_ip = base64_encode($webphone_server_ip); $b64_callerid = base64_encode($outbound_cid); $b64_protocol = base64_encode($protocol); $b64_codecs = base64_encode($codecs_list); $b64_options = base64_encode($webphone_options); $b64_system_key = base64_encode($system_key); $WebPhonEurl = "$webphone_url?phone_login=$b64_phone_login&phone_login=$b64_phone_login&phone_pass=$b64_phone_pass&server_ip=$b64_server_ip&callerid=$b64_callerid&protocol=$b64_protocol&codecs=$b64_codecs&options=$b64_options&system_key=$b64_system_key"; $webphone_content = ""; } } } ##### END code for embedded webphone for monitoring ##### ?> \n"; echo ""._QXZ("$report_name").": $group\n"; if (preg_match("/LIMITED/",$report_display_type)) { $short_header=1; $no_header=1; $header_selected_bold=''; $header_nonselected_bold=''; require("admin_header.php"); echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""._QXZ("RELOAD NOW").""; } else { $short_header=1; require("admin_header.php"); echo "
"; echo "\n"; echo "\n"; echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; #echo "\n"; echo ""._QXZ("$report_name")."                                                                                                   \n"; echo "\n"; echo "
\n"; echo ""._QXZ("Choose Report Display Options").""; echo "
\n"; echo "
\n"; echo "\n"; echo "
\n"; echo ""; echo "
\n"; echo "
\n"; echo "\n"; echo "
\n"; echo "$webphone_content\n$webphone_clpos\n"; echo "
\n"; echo "
\n"; echo "\n"; echo "   "; echo "\n"; echo ""._QXZ("RELOAD NOW").""; if ($LOGuser_level > 7) { if (preg_match('/ALL\-ACTIVE/i',$group_string)) {echo "       "._QXZ("MODIFY")." | \n";} else {echo "       "._QXZ("MODIFY")." | \n";} } if ($SUMMARYauth > 0) {echo ""._QXZ("SUMMARY")." \n";} if (isset($RS_logoutLINK) && $RS_logoutLINK > 0) {echo " | "._QXZ("LOGOUT")." \n";} echo "
\n"; } echo "       "._QXZ("refresh").": \n\n"; if (!preg_match("/WALL|LIMITED/",$report_display_type)) { if ($is_webphone == 'Y') {echo "       "._QXZ("webphone")." +\n\n";} else {echo "       \n\n";} if ($webphone_bufh > 10) {echo "
\n";} echo "
\n\n"; if ($adastats<2) {echo "       + "._QXZ("VIEW MORE")."";} else {echo "       - "._QXZ("VIEW LESS")."";} if ($UGdisplay>0) {echo "       "._QXZ("HIDE USER GROUP")."";} else {echo "       "._QXZ("VIEW USER GROUP")."";} if ($SERVdisplay>0) {echo "       "._QXZ("HIDE SERVER INFO")."";} else {echo "       "._QXZ("SHOW SERVER INFO")."";} if ($CALLSdisplay>0) {echo "       "._QXZ("HIDE WAITING CALLS")."";} else {echo "       "._QXZ("SHOW WAITING CALLS")."";} if ($ALLINGROUPstats>0) {echo "       "._QXZ("HIDE IN-GROUP STATS")."";} else {echo "       "._QXZ("SHOW IN-GROUP STATS")."";} if ($PHONEdisplay>0) {echo "       "._QXZ("HIDE PHONES")."";} else {echo "       "._QXZ("SHOW PHONES")."";} if ($MONITORdisplay>0) {echo "       "._QXZ("HIDE MONITORS")."";} else {echo "       "._QXZ("SHOW MONITORS")."";} if ($RS_hide_CUST_info < 1) { if ($CUSTPHONEdisplay>0) {echo "       "._QXZ("HIDE CUSTPHONES")."";} else {echo "       "._QXZ("SHOW CUSTPHONES")."";} } if ($LOGuser_level >= $CUSTINFOminUL) { if ($RS_hide_CUST_info < 1) { if ($CUSTINFOdisplay>0) {echo "       "._QXZ("HIDE CUST INFO")."";} else {echo "       "._QXZ("SHOW CUST INFO")."";} } } } #echo "
"; ##### END header formatting ##### #echo "
"; echo "\n"; if ($db_source == 'S') { mysqli_close($link); $use_slave_server=0; $db_source = 'M'; require("dbconnect_mysqli.php"); } $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); ?>
0) { echo "\n"; } ?>