Added recording access options

git-svn-id: svn://192.168.202.10@2468 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2016-01-16 21:09:28 +00:00
parent e3752dd496
commit 195170d696
9 changed files with 914 additions and 19 deletions
+6 -2
View File
@@ -1,4 +1,4 @@
CALLER ID NAME CODES DOC Started: 2013-07-15 Updated: 2013-07-15
CALLER ID NAME CODES DOC Started: 2013-07-15 Updated: 2016-01-16
This document is meant for reference only, and it does not contain all CID name codes possible, but more will be added over time.
@@ -11,6 +11,10 @@ J - Inbound CLOSER Transfer (J7152252510000822239)
DC - 3-Way Call (DC943083W0000855319W)
S - Agent Login Call (S1307152248588600051)
LP - Park Call (LPvdcW13739432176666)
FP - Back to agent From Park (FPvdcW14529553216666)
VH - Inbound Agent Alert (VH7152252518600051)
XLvdc - Agent ReQueue Call (XLvdcW13739431946666)
RH - Recording Hangup (RH1234514529553690)
CX - Consultative Transfer (CXAR2420160116094751)
XLvdc - Agent ReQueue Call (XLvdcW13739431946666) [epoch + user...]
XBvdc - Agent blind transfer (XBvdcW14528875091001100110011001) [epoch + user...]
AGMON - Remote Agent Monitor (AGMON715224918000001)
+18 -3
View File
@@ -642,7 +642,8 @@ api_allowed_functions VARCHAR(1000) default ' ALL_FUNCTIONS ',
lead_filter_id VARCHAR(20) default 'NONE',
admin_cf_show_hidden ENUM('1','0') default '0',
agentcall_chat ENUM('1','0') default '0',
user_hide_realtime ENUM('1','0') default '0'
user_hide_realtime ENUM('1','0') default '0',
access_recordings ENUM('0', '1') default '0'
) ENGINE=MyISAM;
CREATE UNIQUE INDEX user ON vicidial_users (user);
@@ -1639,7 +1640,8 @@ user_hide_realtime_enabled ENUM('0','1') default '0',
custom_reports_use_slave_db VARCHAR(2000) default '',
usacan_phone_dialcode_fix ENUM('0','1') default '0',
cache_carrier_stats_realtime ENUM('0','1') default '0',
oldest_logs_date DATETIME
oldest_logs_date DATETIME,
log_recording_access ENUM('0', '1') default '0'
) ENGINE=MyISAM;
CREATE TABLE vicidial_campaigns_list_mix (
@@ -3448,6 +3450,19 @@ index(user),
index(processed)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE vicidial_recording_access_log (
recording_access_log_id INT(10) unsigned NOT NULL AUTO_INCREMENT,
recording_id INT(10) unsigned DEFAULT NULL,
lead_id INT(10) unsigned DEFAULT NULL,
user VARCHAR(20) DEFAULT NULL,
access_datetime DATETIME DEFAULT NULL,
access_result ENUM('ACCESSED','INVALID USER','INVALID PERMISSIONS','NO RECORDING','RECORDING UNAVAILABLE') DEFAULT NULL,
ip VARCHAR(15) default '',
PRIMARY KEY (recording_access_log_id),
index(recording_id),
index(lead_id)
) ENGINE=MyISAM AUTO_INCREMENT=1599 DEFAULT CHARSET=utf8;
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
@@ -3697,4 +3712,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version';
UPDATE system_settings set vdc_agent_api_active='1';
UPDATE system_settings SET db_schema_version='1450',db_schema_update_date=NOW(),reload_timestamp=NOW();
UPDATE system_settings SET db_schema_version='1451',db_schema_update_date=NOW(),reload_timestamp=NOW();
+19
View File
@@ -489,3 +489,22 @@ CREATE INDEX manager_chat_id_archive_key on vicidial_manager_chat_log_archive (m
CREATE INDEX manager_chat_subid_archive_key on vicidial_manager_chat_log_archive (manager_chat_subid);
UPDATE system_settings SET db_schema_version='1450',db_schema_update_date=NOW() where db_schema_version < 1450;
CREATE TABLE vicidial_recording_access_log (
recording_access_log_id INT(10) unsigned NOT NULL AUTO_INCREMENT,
recording_id INT(10) unsigned DEFAULT NULL,
lead_id INT(10) unsigned DEFAULT NULL,
user VARCHAR(20) DEFAULT NULL,
access_datetime DATETIME DEFAULT NULL,
access_result ENUM('ACCESSED','INVALID USER','INVALID PERMISSIONS','NO RECORDING','RECORDING UNAVAILABLE') DEFAULT NULL,
ip VARCHAR(15) default '',
PRIMARY KEY (recording_access_log_id),
index(recording_id),
index(lead_id)
) ENGINE=MyISAM AUTO_INCREMENT=1599 DEFAULT CHARSET=utf8;
ALTER TABLE vicidial_users ADD access_recordings ENUM('0', '1') default '0';
ALTER TABLE system_settings ADD log_recording_access ENUM('0', '1') default '0';
UPDATE system_settings SET db_schema_version='1451',db_schema_update_date=NOW() where db_schema_version < 1451;
+611
View File
@@ -0,0 +1,611 @@
<?php
# AST_recording_log_report.php
#
# This report is for viewing the a report of which users accessed which recordings
#
# Copyright (C) 2016 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
# 160115-2303 - First build
#
$startMS = microtime();
require("dbconnect_mysqli.php");
require("functions.php");
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
if (isset($_GET["access_date_D"])) {$access_date_D=$_GET["access_date_D"];}
elseif (isset($_POST["access_date_D"])) {$access_date_D=$_POST["access_date_D"];}
if (isset($_GET["access_date_end_D"])) {$access_date_end_D=$_GET["access_date_end_D"];}
elseif (isset($_POST["access_date_end_D"])) {$access_date_end_D=$_POST["access_date_end_D"];}
if (isset($_GET["access_date_T"])) {$access_date_T=$_GET["access_date_T"];}
elseif (isset($_POST["access_date_T"])) {$access_date_T=$_POST["access_date_T"];}
if (isset($_GET["access_date_end_T"])) {$access_date_end_T=$_GET["access_date_end_T"];}
elseif (isset($_POST["access_date_end_T"])) {$access_date_end_T=$_POST["access_date_end_T"];}
if (isset($_GET["users"])) {$users=$_GET["users"];}
elseif (isset($_POST["users"])) {$users=$_POST["users"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];}
elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];}
if (isset($_GET["list_ids"])) {$list_ids=$_GET["list_ids"];}
elseif (isset($_POST["list_ids"])) {$list_ids=$_POST["list_ids"];}
if (isset($_GET["recording_date_D"])) {$recording_date_D=$_GET["recording_date_D"];}
elseif (isset($_POST["recording_date_D"])) {$recording_date_D=$_POST["recording_date_D"];}
if (isset($_GET["recording_date_end_D"])) {$recording_date_end_D=$_GET["recording_date_end_D"];}
elseif (isset($_POST["recording_date_end_D"])) {$recording_date_end_D=$_POST["recording_date_end_D"];}
if (isset($_GET["recording_date_T"])) {$recording_date_T=$_GET["recording_date_T"];}
elseif (isset($_POST["recording_date_T"])) {$recording_date_T=$_POST["recording_date_T"];}
if (isset($_GET["recording_date_end_T"])) {$recording_date_end_T=$_GET["recording_date_end_T"];}
elseif (isset($_POST["recording_date_end_T"])) {$recording_date_end_T=$_POST["recording_date_end_T"];}
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"];}
if (isset($_GET["search_archived_data"])) {$search_archived_data=$_GET["search_archived_data"];}
elseif (isset($_POST["search_archived_data"])) {$search_archived_data=$_POST["search_archived_data"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
$report_name="Recording Access Log Report";
$NOW_DATE = date("Y-m-d");
if (!isset($access_date_D)) {$access_date_D=$NOW_DATE;}
if (!isset($access_date_end_D)) {$access_date_end_D=$NOW_DATE;}
if (!isset($access_date_T)) {$access_date_T="00:00:00";}
if (!isset($access_date_end_T)) {$access_date_end_T="23:59:59";}
$access_date_from="$access_date_D $access_date_T";
$access_date_to="$access_date_end_D $access_date_end_T";
$CSV_text="\"RECORDING ACCESS LOG REPORT\"\n";
$CSV_text.="\"ACCESS DATE RANGE:\",\"$access_date_from to $access_date_to\"\n";
$ASCII_rpt_header="ACCESS DATE RANGE: $access_date_from to $access_date_to\n";
$recording_date_SQL="";
if ($recording_date_D)
{
if (!isset($recording_date_end_D)) {$recording_date_end_D=$recording_date_D;}
$recording_date_from="$recording_date_D 00:00:00";
$recording_date_to="$recording_date_end_D 23:59:59";
$recording_date_SQL=" start_time>='$recording_date_from' and start_time<='$recording_date_to' and ";
$CSV_text.="\"RECORDING DATE RANGE:\",\"$recording_date_from to $recording_date_to\"\n";
$ASCII_rpt_header.="RECORDING DATE RANGE: $recording_date_from to $recording_date_to\n";
}
#if (!isset($recording_date_D)) {$recording_date_D=$NOW_DATE;}
#if (!isset($recording_date_end_D)) {$recording_date_end_D=$NOW_DATE;}
#if (!isset($recording_date_T)) {$recording_date_T="00:00:00";}
#if (!isset($recording_date_end_T)) {$recording_date_end_T="23:59:59";}
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {$HTML_text.="$stmt\n";}
if ($archive_tbl) {$agent_log_table="vicidial_agent_log_archive";} else {$agent_log_table="vicidial_agent_log";}
$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];
}
##### END SETTINGS LOOKUP #####
###########################################
### ARCHIVED DATA CHECK CONFIGURATION
$archives_available="N";
$log_tables_array=array("recording_log", "vicidial_recording_access_log");
for ($t=0; $t<count($log_tables_array); $t++)
{
$table_name=$log_tables_array[$t];
$archive_table_name=use_archive_table($table_name);
if ($archive_table_name!=$table_name) {$archives_available="Y";}
}
if ($search_archived_data)
{
$vicidial_recording_access_log_table=use_archive_table("vicidial_recording_access_log");
$recording_log_table=use_archive_table("recording_log");
}
else
{
$vicidial_recording_access_log_table="vicidial_recording_access_log";
$recording_log_table="recording_log";
}
#############
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_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW);
$PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER);
}
$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);
if ($auth_message == 'GOOD')
{$auth=1;}
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;
}
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");
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 |$group[0], $query_date, $end_date, $shift, $file_download, $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("/$report_name/",$reports_use_slave_db)) )
{
mysqli_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect_mysqli.php");
$HTML_text.="<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt="SELECT 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);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times 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];
$LOGadmin_viewable_groups = $row[2];
$LOGadmin_viewable_call_times = $row[3];
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|\n";
exit;
}
$LOGadmin_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')";
}
$i=0;
$users_string='|';
$users_ct = count($users);
while($i < $users_ct)
{
$users_string .= "$users[$i]|";
$i++;
}
$i=0;
$user_group_string='|';
$user_group_ct = count($user_group);
while($i < $users_ct)
{
$user_group_string .= "$user_group[$i]|";
$i++;
}
$stmt="select user_group from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$user_groups_to_print = mysqli_num_rows($rslt);
$i=0;
while ($i < $user_groups_to_print)
{
$row=mysqli_fetch_row($rslt);
$user_groups[$i] =$row[0];
# if (preg_match('/\-ALL/',$user_group_string)) {$user_group[$i]=$row[0];}
$i++;
}
$stmt="select user, full_name from vicidial_users $whereLOGadmin_viewable_groupsSQL order by user";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$users_to_print = mysqli_num_rows($rslt);
$i=0;
while ($i < $users_to_print)
{
$row=mysqli_fetch_row($rslt);
$user_list[$i]=$row[0];
$user_names[$i]=$row[1];
if ($all_users) {$user_list[$i]=$row[0];}
$i++;
}
$i=0;
$user_string='|';
$user_ct = count($users);
while($i < $user_ct)
{
$user_string .= "$users[$i]|";
$userQS .= "&users[]=$users[$i]";
$vra_user_SQL="vra.user in ('".implode("','", $users)."') and ";
$vu_user_SQL="vu.user in ('".implode("','", $users)."') and ";
$user_SQL="vra.user in ('".implode("','", $users)."') and ";
$i++;
}
if ( (preg_match('/\-\-ALL\-\-/',$user_string) ) or ($user_ct < 1) )
{$vu_user_SQL = ""; $vra_user_SQL = ""; $user_SQL="";}
else
{
$ASCII_rpt_header.="AGENTS: ".implode(", ", $users)."\n";
$CSV_text.="\"AGENTS:\",\"".implode(", ", $users)."\"\n";
$GRAPH_header.="<th class='column_header grey_graph_cell'>SELECTED AGENTS</th>";
}
$i=0;
$user_group_string='|';
$user_group_ct = count($user_group);
while($i < $user_group_ct)
{
$user_group_string .= "$user_group[$i]|";
$user_groupQS .= "&user_group[]=$user_group[$i]";
$user_group_SQL=" user_group in ('".implode("','", $user_group)."') and vra.user=vu.user and ";
$i++;
}
if ( (preg_match('/\-\-ALL\-\-/',$user_group_string) ) or ($user_group_ct < 1) )
{$user_group_SQL = "";}
else
{
$ASCII_rpt_header.=" User groups: ".implode(", ", $user_group)."\n";
$CSV_text.="\"User groups:\",\"".implode(", ", $user_group)."\"\n";
$GRAPH_header.="<th class='column_header grey_graph_cell'>SELECTED USER GROUPS</th>";
}
if ($DB) {echo "$user_group_string|$user_group_ct|$user_groupQS|$i<BR>\n";}
$LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date$groupQS$user_groupQS&shift=$shift&DB=$DB&show_percentages=$show_percentages";
$NWB = " &nbsp; <a href=\"javascript:openNewWindow('help.php?ADD=99999";
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
$HTML_head.="<HTML>\n";
$HTML_head.="<HEAD>\n";
$HTML_head.="<STYLE type=\"text/css\">\n";
$HTML_head.="<!--\n";
$HTML_head.=" .green {color: white; background-color: green}\n";
$HTML_head.=" .red {color: white; background-color: red}\n";
$HTML_head.=" .blue {color: white; background-color: blue}\n";
$HTML_head.=" .purple {color: white; background-color: purple}\n";
$HTML_head.="-->\n";
$HTML_head.=" </STYLE>\n";
$HTML_head.="<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
$HTML_head.="<link rel=\"stylesheet\" href=\"calendar.css\">\n";
$HTML_head.="<link rel=\"stylesheet\" href=\"horizontalbargraph.css\">\n";
$HTML_text.="<script language=\"JavaScript\">\n";
$HTML_text.="function ToggleSpan(spanID) {\n";
$HTML_text.=" if (document.getElementById(spanID).style.display == 'none') {\n";
$HTML_text.=" document.getElementById(spanID).style.display = 'block';\n";
$HTML_text.=" } else {\n";
$HTML_text.=" document.getElementById(spanID).style.display = 'none';\n";
$HTML_text.=" }\n";
$HTML_text.=" }\n";
$HTML_text.="</script>\n";
$HTML_head.="<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
$HTML_head.="<TITLE>"._QXZ("$report_name")."</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
# require("admin_header.php");
$HTML_text.="<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$HTML_text.="<FORM ACTION=\"$PHP_SELF\" METHOD=GET name=vicidial_report id=vicidial_report>\n";
$HTML_text.="<TABLE CELLSPACING=3><TR><TD VALIGN=TOP> "._QXZ("Access date range").":<BR>";
$HTML_text.="<INPUT TYPE=hidden NAME=DB VALUE=\"$DB\">\n";
$HTML_text.="<INPUT TYPE=hidden NAME=access_date ID=access_date VALUE=\"$access_date\">\n";
$HTML_text.="<INPUT TYPE=hidden NAME=access_date_end ID=access_date_end VALUE=\"$access_date_end\">\n";
$HTML_text.="<INPUT TYPE=TEXT NAME=access_date_D SIZE=11 MAXLENGTH=10 VALUE=\"$access_date_D\">";
$HTML_text.="<script language=\"JavaScript\">\n";
$HTML_text.="var o_cal = new tcal ({\n";
$HTML_text.=" // form name\n";
$HTML_text.=" 'formname': 'vicidial_report',\n";
$HTML_text.=" // input name\n";
$HTML_text.=" 'controlname': 'access_date_D'\n";
$HTML_text.="});\n";
$HTML_text.="o_cal.a_tpl.yearscroll = false;\n";
$HTML_text.="// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
$HTML_text.="</script>\n";
$HTML_text.=" &nbsp; <INPUT TYPE=TEXT NAME=access_date_T SIZE=9 MAXLENGTH=8 VALUE=\"$access_date_T\">";
$HTML_text.="<BR> "._QXZ("to")." <BR><INPUT TYPE=TEXT NAME=access_date_end_D SIZE=11 MAXLENGTH=10 VALUE=\"$access_date_end_D\">";
$HTML_text.="<script language=\"JavaScript\">\n";
$HTML_text.="var o_cal = new tcal ({\n";
$HTML_text.=" // form name\n";
$HTML_text.=" 'formname': 'vicidial_report',\n";
$HTML_text.=" // input name\n";
$HTML_text.=" 'controlname': 'access_date_end_D'\n";
$HTML_text.="});\n";
$HTML_text.="o_cal.a_tpl.yearscroll = false;\n";
$HTML_text.="// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
$HTML_text.="</script>\n";
$HTML_text.=" &nbsp; <INPUT TYPE=TEXT NAME=access_date_end_T SIZE=9 MAXLENGTH=8 VALUE=\"$access_date_end_T\">";
$HTML_text.="</TD>";
# $HTML_text.="<TD VALIGN=TOP>"._QXZ("User Groups").":<BR>";
# $HTML_text.="<SELECT SIZE=5 NAME=user_group[] multiple>\n";
# if (preg_match('/\-\-ALL\-\-/',$user_group_string))
# {$HTML_text.="<option value=\"--ALL--\" selected>-- "._QXZ("ALL USER GROUPS")." --</option>\n";}
# else
# {$HTML_text.="<option value=\"--ALL--\">-- "._QXZ("ALL USER GROUPS")." --</option>\n";}
# $o=0;
# while ($user_groups_to_print > $o)
# {
# if (preg_match("/$user_groups[$o]\|/i",$user_group_string)) {$HTML_text.="<option selected value=\"$user_groups[$o]\">$user_groups[$o]</option>\n";}
# else {$HTML_text.="<option value=\"$user_groups[$o]\">$user_groups[$o]</option>\n";}
# $o++;
# }
# $HTML_text.="</SELECT>\n";
# $HTML_text.="</TD>";
$HTML_text.="<TD VALIGN=TOP>"._QXZ("Users").": <BR>";
$HTML_text.="<SELECT SIZE=5 NAME=users[] multiple>\n";
if (preg_match('/\-\-ALL\-\-/',$users_string))
{$HTML_text.="<option value=\"--ALL--\" selected>-- "._QXZ("ALL USERS")." --</option>\n";}
else
{$HTML_text.="<option value=\"--ALL--\">-- "._QXZ("ALL USERS")." --</option>\n";}
$o=0;
while ($users_to_print > $o)
{
if (preg_match("/$user_list[$o]\|/i",$users_string)) {$HTML_text.="<option selected value=\"$user_list[$o]\">$user_list[$o] - $user_names[$o]</option>\n";}
else {$HTML_text.="<option value=\"$user_list[$o]\">$user_list[$o] - $user_names[$o]</option>\n";}
$o++;
}
$HTML_text.="</SELECT>\n";
$HTML_text.="</TD>\n";
$HTML_text.="<TD VALIGN=TOP> "._QXZ("Recording date range").":<BR>";
$HTML_text.="<INPUT TYPE=hidden NAME=DB VALUE=\"$DB\">\n";
$HTML_text.="<INPUT TYPE=hidden NAME=recording_date ID=recording_date VALUE=\"$recording_date\">\n";
$HTML_text.="<INPUT TYPE=hidden NAME=recording_date_end ID=recording_date_end VALUE=\"$recording_date_end\">\n";
$HTML_text.="<INPUT TYPE=TEXT NAME=recording_date_D SIZE=11 MAXLENGTH=10 VALUE=\"$recording_date_D\">";
$HTML_text.="<script language=\"JavaScript\">\n";
$HTML_text.="var o_cal = new tcal ({\n";
$HTML_text.=" // form name\n";
$HTML_text.=" 'formname': 'vicidial_report',\n";
$HTML_text.=" // input name\n";
$HTML_text.=" 'controlname': 'recording_date_D'\n";
$HTML_text.="});\n";
$HTML_text.="o_cal.a_tpl.yearscroll = false;\n";
$HTML_text.="// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
$HTML_text.="</script>\n";
#$HTML_text.=" &nbsp; <INPUT TYPE=TEXT NAME=recording_date_T SIZE=9 MAXLENGTH=8 VALUE=\"$recording_date_T\">";
$HTML_text.="<BR> "._QXZ("to")." <BR><INPUT TYPE=TEXT NAME=recording_date_end_D SIZE=11 MAXLENGTH=10 VALUE=\"$recording_date_end_D\">";
$HTML_text.="<script language=\"JavaScript\">\n";
$HTML_text.="var o_cal = new tcal ({\n";
$HTML_text.=" // form name\n";
$HTML_text.=" 'formname': 'vicidial_report',\n";
$HTML_text.=" // input name\n";
$HTML_text.=" 'controlname': 'recording_date_end_D'\n";
$HTML_text.="});\n";
$HTML_text.="o_cal.a_tpl.yearscroll = false;\n";
$HTML_text.="// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
$HTML_text.="</script>\n";
#$HTML_text.=" &nbsp; <INPUT TYPE=TEXT NAME=access_date_end_T SIZE=9 MAXLENGTH=8 VALUE=\"$recording_date_end_T\">";
$HTML_text.="</TD><TD VALIGN='TOP'><BR><BR>";
$HTML_text.="<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE='"._QXZ("SUBMIT")."'>\n";
if ($archives_available=="Y")
{
$HTML_text.="<BR><BR><input type='checkbox' name='search_archived_data' value='checked' $search_archived_data>"._QXZ("Search archived data")."\n";
}
$HTML_text.="</TD>";
$HTML_text.="</TR></TABLE>";
$HTML_text.="</FORM>\n\n";
$HTML_text.="<PRE><FONT SIZE=2>\n";
if ($SUBMIT)
{
$stmt="select vra.recording_access_log_id,vra.recording_id,vra.lead_id,vra.user,vra.access_datetime,vra.access_result,vra.ip, vu.full_name, vu.user_group, r.start_time from ".$vicidial_recording_access_log_table." vra, vicidial_users vu, ".$recording_log_table." r where access_datetime>='$access_date_from' and access_datetime<='$access_date_to' and $user_SQL $user_group_SQL $recording_date_SQL vra.recording_id=r.recording_id and vra.user=vu.user order by access_datetime asc";
if ($DB) {print $stmt."\n";}
$ASCII_border="+--------------+---------------------+------------+--------------------------------+---------------------+---------------------+-----------------+\n";
$HTML_text.=$ASCII_rpt_header;
$HTML_text.=sprintf("%110s", " ");
$HTML_text.="<a href=\"$PHP_SELF?DB=$DB&access_date_D=$access_date_D&access_date_T=$access_date_T&access_date_end_D=$access_date_end_D&access_date_end_T=$access_date_end_T&recording_date_D=$recording_date_D&recording_date_end_D=$recording_date_end_D$userQS$user_groupQS&file_download=1&SUBMIT=$SUBMIT\">"._QXZ("DOWNLOAD")."</a>\n";
$HTML_text.=$ASCII_border;
$HTML_text.="| RECORDING ID | RECORDING DATE/TIME | LEAD ID | USER | DATE/TIME ACCESSED | ACCESS RESULT | IP |\n";
$HTML_text.=$ASCII_border;
$CSV_text.="\n\"RECORDING ID\",\"RECORDING DATE/TIME\",\"LEAD ID\",\"USER\",\"DATE/TIME ACCESSED\",\"ACCESS RESULT\",\"IP\"\n";
$rslt=mysql_to_mysqli($stmt, $link);
while ($row=mysqli_fetch_array($rslt))
{
$full_user=substr($row["user"]." - ".$row["full_name"], 0, 30);
$HTML_text.="| ";
$HTML_text.=sprintf("%-12s", $row["recording_id"])." | ";
$HTML_text.=sprintf("%-19s", $row["start_time"])." | ";
$HTML_text.=sprintf("%-10s", $row["lead_id"])." | ";
$HTML_text.=sprintf("%-30s", $full_user)." | ";
$HTML_text.=sprintf("%-19s", $row["access_datetime"])." | ";
$HTML_text.=sprintf("%-19s", $row["access_result"])." | ";
$HTML_text.=sprintf("%-15s", $row["ip"])." |\n";
$CSV_text.="\"$row[recording_id]\",\"$row[start_time]\",\"$row[lead_id]\",\"$full_user\",\"$row[access_datetime]\",\"$row[access_result]\",\"$row[ip]\"\n";
}
$HTML_text.=$ASCII_border;
/*
+-------------------------+--------------+---------+------+---------------------+---------------------+-----------+------------+---------------------+
| recording_access_log_id | recording_id | lead_id | user | access_datetime | access_result | full_name | user_group | start_time | ip
+-------------------------+--------------+---------+------+---------------------+---------------------+-----------+------------+---------------------+
| 1599 | 164677 | 1079414 | 6666 | 2016-01-12 23:50:04 | INVALID PERMISSIONS | Admin | ADMIN | 2016-01-09 08:22:17 |
| 1600 | 164668 | 1177978 | 6666 | 2016-01-12 23:52:49 | ACCESSED | Admin | ADMIN | 2016-01-06 22:25:08 |
| 1601 | 164678 | 1177980 | 6666 | 2016-01-12 23:57:43 | ACCESSED | Admin | ADMIN | 2016-01-09 08:27:56 |
| 1602 | 164678 | 1177980 | 6666 | 2016-01-13 00:42:54 | INVALID PERMISSIONS | Admin | ADMIN | 2016-01-09 08:27:56 |
+-------------------------+--------------+---------+------+---------------------+---------------------+-----------+------------+---------------------+
*/
}
$HTML_text.="</FONT></PRE></BODY></HTML>";
if ($file_download == 0 || !$file_download)
{
echo $HTML_head;
require("admin_header.php");
echo $HTML_text;
}
else
{
$FILE_TIME = date("Ymd-His");
$CSVfilename = "AST_recording_access_log_report_$US$FILE_TIME.csv";
$CSV_text=preg_replace('/\n +,/', ',', $CSV_text);
$CSV_text=preg_replace('/ +\"/', '"', $CSV_text);
$CSV_text=preg_replace('/\" +/', '"', $CSV_text);
// We'll be outputting a TXT file
header('Content-type: application/octet-stream');
// It will be called LIST_101_20090209-121212.txt
header("Content-Disposition: attachment; filename=\"$CSVfilename\"");
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
ob_clean();
flush();
echo "$CSV_text";
}
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);
?>
+28 -9
View File
File diff suppressed because one or more lines are too long
+42 -2
View File
@@ -74,6 +74,7 @@
# 150917-1301 - Added dynamic default field maxlengths based on DB schema
# 150923-0700 - Fixed security issues with user access, issue #894
# 160102-1238 - Fixed issues with special characters, added $htmlconvert option
# 160112-2344 - Added link to direct to recording logging page, access log display
#
require("dbconnect_mysqli.php");
@@ -215,7 +216,7 @@ if ($nonselectable_statuses > 0)
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,custom_fields_enabled,webroot_writable,allow_emails,enable_languages,language_method,active_modules FROM system_settings;";
$stmt = "SELECT use_non_latin,custom_fields_enabled,webroot_writable,allow_emails,enable_languages,language_method,active_modules,log_recording_access FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
@@ -229,6 +230,7 @@ if ($qm_conf_ct > 0)
$SSenable_languages = $row[4];
$SSlanguage_method = $row[5];
$active_modules = $row[6];
$log_recording_access = $row[7];
}
##### END SETTINGS LOOKUP #####
###########################################
@@ -1813,7 +1815,10 @@ else
else
{$locat = $location;}
if ( (preg_match('/ftp/i',$location)) or (preg_match('/http/i',$location)) )
{$location = "<a href=\"$location\">$locat</a>";}
if ($log_recording_access<1)
{$location = "<a href=\"$location\">$locat</a>";}
else
{$location = "<a href=\"recording_log_redirect.php?recording_id=$row[0]&lead_id=$row[12]\">$locat</a>";}
else
{$location = $locat;}
$u++;
@@ -1833,6 +1838,41 @@ else
echo "</TABLE><BR><BR>\n";
if ($log_recording_access > 0)
{
echo "<B>"._QXZ("RECORDING ACCESS LOG FOR THIS LEAD").":</B>\n";
echo "<TABLE width=750 cellspacing=1 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td align=left><font size=2> "._QXZ("LEAD")."</td><td><font size=2>"._QXZ("DATE/TIME")." </td><td align=left><font size=2>"._QXZ("RECORDING ID")."</td><td align=left><font size=2>"._QXZ("USER")."</td><td align=left><font size=2>"._QXZ("RESULT")." </td><td align=left><font size=2>"._QXZ("IP")." </td></tr>\n";
$stmt="SELECT recording_id,lead_id,user,access_datetime,access_result,ip from vicidial_recording_access_log where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by recording_access_log_id desc limit 500;";
$rslt=mysql_to_mysqli($stmt, $link);
$logs_to_print = mysqli_num_rows($rslt);
if ($DB) {echo "$logs_to_print|$stmt|\n";}
$u=0;
while ($logs_to_print > $u)
{
$row=mysqli_fetch_row($rslt);
if (preg_match("/1$|3$|5$|7$|9$/i", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u</td>";
echo "<td align=left><font size=2> $row[1] </td>";
echo "<td align=left><font size=2> $row[3] </td>\n";
echo "<td align=left><font size=2> $row[0] </td>\n";
echo "<td align=left><font size=2> $row[2] </td>\n";
echo "<td align=left><font size=2> $row[4] </td>\n";
echo "<td align=left><font size=2> $row[5] </td>\n";
echo "</tr>\n";
}
echo "</TABLE><BR><BR>\n";
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level >= 9 and modify_leads='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
+12 -1
View File
@@ -78,6 +78,7 @@
# 160106-0700 - Added AREACODE description to the inbound_dids-filter_inbound_number entry
# 160106-1348 - Added inbound_groups-on_hook_cid_number entry
# 160108-2217 - Added campaigns-manual_dial_hopper_check entry
# 160116-1512 - Added access_recording and log_recording_access entries
#
@@ -586,7 +587,12 @@ if ($SSoutbound_autodial_active > 0)
<BR>
<A NAME="users-view_reports">
<BR>
<B><?php echo _QXZ("View Reports"); ?> -</B><?php echo _QXZ("This option allows the user to view the system web reports.");
<B><?php echo _QXZ("View Reports"); ?> -</B><?php echo _QXZ("This option allows the user to view the system web reports."); ?>
<BR>
<A NAME="users-access_recordings">
<BR>
<B><?php echo _QXZ("Access Recordings"); ?> -</B><?php echo _QXZ("This option allows the user to have access to call recordings.");
if ($SSqc_features_active > 0)
@@ -5032,6 +5038,11 @@ FR_SPAC 00 00 00 00 00 - <?php echo _QXZ("France space separated phone number");
<BR>
<B><?php echo _QXZ("Chat URL"); ?> -</B><?php echo _QXZ("This is the location where you have placed the chat web pages for customer use."); ?>
<BR>
<A NAME="settings-log_recording_access">
<BR>
<B><?php echo _QXZ("Log Recording Access"); ?> -</B><?php echo _QXZ("This option if enabled allows the logging of user access to call recordings. It also requires the User setting Access Recordings to be set to 1 to allow a user to access call recordings. Default is 0 for disabled."); ?>
<BR>
<A NAME="settings-first_login_trigger">
<BR>
+169
View File
@@ -0,0 +1,169 @@
<?php
# recording_log_redirect.php - audio recording access logging and redirect script
#
# Copyright (C) 2016 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
# 160116-1349 - First Build
#
require("dbconnect_mysqli.php");
require("functions.php");
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
$ip = getenv("REMOTE_ADDR");
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["search_archived_data"])) {$search_archived_data=$_GET["search_archived_data"];}
elseif (isset($_POST["search_archived_data"])) {$search_archived_data=$_POST["search_archived_data"];}
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,custom_fields_enabled,webroot_writable,allow_emails,enable_languages,language_method,active_modules,log_recording_access 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];
$custom_fields_enabled = $row[1];
$webroot_writable = $row[2];
$allow_emails = $row[3];
$SSenable_languages = $row[4];
$SSlanguage_method = $row[5];
$active_modules = $row[6];
$log_recording_access = $row[7];
}
##### END SETTINGS LOOKUP #####
###########################################
$recording_id = preg_replace('/[^0-9]/','',$recording_id);
$lead_id = preg_replace('/[^0-9]/','',$lead_id);
$search_archived_data = preg_replace("/'|\"|\\\\|;/","",$search_archived_data);
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);
} # end of non_latin
else
{
$PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER);
$PHP_AUTH_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW);
}
if ($search_archived_data)
{$recording_log_table=use_archive_table("recording_log");}
else
{$recording_log_table="recording_log";}
$auth=0;
$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'',1);
if ($auth_message == 'GOOD')
{$auth=1;}
if ($auth < 1)
{
$VDdisplayMESSAGE = _QXZ("Login incorrect, please try again");
$log_stmt="insert into vicidial_recording_access_log(recording_id, lead_id, user, access_datetime, access_result, ip) VALUES('$recording_id', '$lead_id', '$PHP_AUTH_USER', now(), 'INVALID USER', '$ip');";
$log_rslt=mysql_to_mysqli($log_stmt, $link);
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;
}
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;
}
if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
$rights_stmt = "SELECT access_recordings,selected_language from vicidial_users where user='$PHP_AUTH_USER';";
if ($DB) {echo "|$stmt|\n";}
$rights_rslt=mysql_to_mysqli($rights_stmt, $link);
$rights_row=mysqli_fetch_row($rights_rslt);
$access_recordings = $rights_row[0];
$VUselected_language = $rights_row[1];
# check their permissions
if ( ( $access_recordings < 1 ) or ( $log_recording_access < 1 ) )
{
header ("Content-type: text/html; charset=utf-8");
echo _QXZ("You do not have permissions to access recordings")."\n";
$log_stmt="insert into vicidial_recording_access_log(recording_id, lead_id, user, access_datetime, access_result, ip) VALUES('$recording_id', '$lead_id', '$PHP_AUTH_USER', now(), 'INVALID PERMISSIONS', '$ip')";
$log_rslt=mysql_to_mysqli($log_stmt, $link);
exit;
}
if (!$recording_id)
{
exit;
}
else
{
$rec_lookup_stmt="select recording_id,channel,server_ip,extension,start_time,start_epoch,end_time,end_epoch,length_in_sec,length_in_min,filename,location,lead_id,user,vicidial_id from ".$recording_log_table." where recording_id='$recording_id'";
$rec_lookup_rslt=mysql_to_mysqli($rec_lookup_stmt, $link);
if (mysqli_num_rows($rec_lookup_rslt)==0)
{
$log_stmt="insert into vicidial_recording_access_log(recording_id, user, access_datetime, access_result, ip, lead_id) VALUES ('$recording_id', '$PHP_AUTH_USER', now(), 'NO RECORDING', '$ip', '$lead_id');";
$log_rslt=mysql_to_mysqli($log_stmt, $link);
echo _QXZ("Not a valid recording")."\n";
exit;
}
else
{
$rec_row=mysqli_fetch_array($rec_lookup_rslt);
$lead_id=$rec_row["lead_id"];
$location=$rec_row["location"];
if (strlen($location)>2)
{
$URLserver_ip = $location;
$URLserver_ip = preg_replace('/http:\/\//i', '',$URLserver_ip);
$URLserver_ip = preg_replace('/https:\/\//i', '',$URLserver_ip);
$URLserver_ip = preg_replace('/\/.*/i', '',$URLserver_ip);
$stmt="SELECT count(*) from servers where server_ip='$URLserver_ip';";
$rsltx=mysql_to_mysqli($stmt, $link);
$rowx=mysqli_fetch_row($rsltx);
if ($rowx[0] > 0)
{
$stmt="SELECT recording_web_link,alt_server_ip,external_server_ip from servers where server_ip='$URLserver_ip';";
$rsltx=mysql_to_mysqli($stmt, $link);
$rowx=mysqli_fetch_row($rsltx);
if (preg_match("/ALT_IP/i",$rowx[0]))
{
$location = preg_replace("/$URLserver_ip/i", "$rowx[1]", $location);
}
if (preg_match("/EXTERNAL_IP/i",$rowx[0]))
{
$location = preg_replace("/$URLserver_ip/i", "$rowx[2]", $location);
}
}
}
else
{
$log_stmt="insert into vicidial_recording_access_log(recording_id, lead_id, user, access_datetime, access_result, ip) VALUES ('$recording_id', '$lead_id', '$PHP_AUTH_USER', now(), 'RECORDING UNAVAILABLE', '$ip');";
$log_rslt=mysql_to_mysqli($log_stmt, $link);
echo _QXZ("Recording is not available yet. Try again later.")."\n";
exit;
}
}
}
$log_stmt="insert into vicidial_recording_access_log(recording_id, lead_id, user, access_datetime, access_result, ip) VALUES('$recording_id', '$lead_id', '$PHP_AUTH_USER', now(), 'ACCESSED', '$ip')";
$log_rslt=mysql_to_mysqli($log_stmt, $link);
header("Location: $location");
?>
+9 -2
View File
@@ -49,6 +49,7 @@
# 150804-0749 - Added call status as option, Issue #883
# 151227-1839 - Added option to search archived data
# 160104-1226 - Added call type field to the agent activity table
# 160112-0759 - Added link to direct to recording logging page
#
$startMS = microtime();
@@ -96,7 +97,7 @@ if (isset($_GET["search_archived_data"])) {$search_archived_data=$_GET["search
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,user_territories_active,webroot_writable,allow_emails,level_8_disable_add,enable_languages,language_method FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,user_territories_active,webroot_writable,allow_emails,level_8_disable_add,enable_languages,language_method,log_recording_access FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {$MAIN.="$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
@@ -113,6 +114,7 @@ if ($qm_conf_ct > 0)
$SSlevel_8_disable_add = $row[7];
$SSenable_languages = $row[8];
$SSlanguage_method = $row[9];
$log_recording_access = $row[10];
}
##### END SETTINGS LOOKUP #####
###########################################
@@ -1339,7 +1341,12 @@ else
else
{$locat = $location;}
if ( (preg_match('/ftp/i',$location)) or (preg_match('/http/i',$location)) )
{$location = "<a href=\"$location\">$locat</a>";}
{
if ($log_recording_access<1)
{$location = "<a href=\"$location\">$locat</a>";}
else
{$location = "<a href=\"recording_log_redirect.php?recording_id=$row[0]&lead_id=$row[12]&search_archived_data=$search_archived_data\">$locat</a>";}
}
else
{$location = $locat;}
$u++;