Streamlined DID check to optimize page load in Inbound Reports
git-svn-id: svn://192.168.202.10@3096 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_CLOSERstats.php
|
||||
#
|
||||
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2019 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES:
|
||||
# 60619-1714 - Added variable filtering to eliminate SQL injection attack threat
|
||||
@@ -61,6 +61,7 @@
|
||||
# 171012-2015 - Fixed javascript/apache errors with graphs
|
||||
# 180323-2306 - Fix for user time calculation, subtracted queue_seconds
|
||||
# 180712-1508 - Fix for rare allowed reports issue
|
||||
# 190508-1900 - Streamlined DID check to optimize page load
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -633,6 +634,8 @@ if ($DID=='Y')
|
||||
$did_SQL = preg_replace('/,$/i', '',$did_SQL);
|
||||
if (strlen($did_SQL)<3) {$did_SQL="''";}
|
||||
|
||||
if ($dids_to_print>0)
|
||||
{
|
||||
$stmt="select uniqueid from ".$vicidial_did_log_table." where did_id IN($did_SQL);";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
@@ -644,6 +647,8 @@ if ($DID=='Y')
|
||||
$unid_SQL .= "'$row[0]',";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$unid_SQL = preg_replace('/,$/i', '',$unid_SQL);
|
||||
if (strlen($unid_SQL)<3) {$unid_SQL="''";}
|
||||
|
||||
@@ -683,6 +688,8 @@ if ($group_ct > 1)
|
||||
|
||||
$i=0;
|
||||
while($i < $group_ct)
|
||||
{
|
||||
if ($DID=='Y')
|
||||
{
|
||||
$did_id[$i]='0';
|
||||
$DIDunid_SQL='';
|
||||
@@ -694,7 +701,6 @@ if ($group_ct > 1)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$did_id[$i] = $row[0];
|
||||
}
|
||||
|
||||
$stmt="select uniqueid from ".$vicidial_did_log_table." where did_id='$did_id[$i]';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
@@ -707,8 +713,10 @@ if ($group_ct > 1)
|
||||
$DIDunid_SQL .= "'$row[0]',";
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
$DIDunid_SQL = preg_replace('/,$/i', '',$DIDunid_SQL);
|
||||
if (strlen($DIDunid_SQL)<3) {$DIDunid_SQL="''";}
|
||||
}
|
||||
|
||||
$stmt="select count(*),sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';";
|
||||
if ($DID=='Y')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_CLOSERstats_v2.php
|
||||
#
|
||||
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2019 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES:
|
||||
# 60619-1714 - Added variable filtering to eliminate SQL injection attack threat
|
||||
@@ -65,6 +65,7 @@
|
||||
# 171012-2015 - Fixed javascript/apache errors with graphs
|
||||
# 180323-2307 - Fix for user time calculation, subtracted queue_seconds
|
||||
# 180712-1508 - Fix for rare allowed reports issue
|
||||
# 190508-1901 - Streamlined DID check to optimize page load
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -921,8 +922,9 @@ if ($DID=='Y')
|
||||
$i++;
|
||||
}
|
||||
$did_SQL = preg_replace('/,$/i', '',$did_SQL);
|
||||
if (strlen($did_SQL)<3) {$did_SQL="''";}
|
||||
|
||||
if ($dids_to_print>0)
|
||||
{
|
||||
$stmt="select uniqueid from ".$vicidial_did_log_table." where did_id IN($did_SQL);";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
@@ -934,6 +936,8 @@ if ($DID=='Y')
|
||||
$unid_SQL .= "'$row[0]',";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$unid_SQL = preg_replace('/,$/i', '',$unid_SQL);
|
||||
if (strlen($unid_SQL)<3) {$unid_SQL="''";}
|
||||
|
||||
@@ -980,6 +984,8 @@ if ($group_ct > 1)
|
||||
|
||||
$i=0;
|
||||
while($i < $group_ct)
|
||||
{
|
||||
if ($DID=='Y')
|
||||
{
|
||||
$did_id[$i]='0';
|
||||
$DIDunid_SQL='';
|
||||
@@ -991,7 +997,6 @@ if ($group_ct > 1)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$did_id[$i] = $row[0];
|
||||
}
|
||||
|
||||
$stmt="select uniqueid from ".$vicidial_did_log_table." where did_id='$did_id[$i]';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
@@ -1004,8 +1009,10 @@ if ($group_ct > 1)
|
||||
$DIDunid_SQL .= "'$row[0]',";
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
$DIDunid_SQL = preg_replace('/,$/i', '',$DIDunid_SQL);
|
||||
if (strlen($DIDunid_SQL)<3) {$DIDunid_SQL="''";}
|
||||
}
|
||||
|
||||
$stmt="select count(*),sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' $calldate_call_time_clause and campaign_id='$group[$i]';";
|
||||
if ($DID=='Y')
|
||||
|
||||
Reference in New Issue
Block a user