Update xml_cdr_inc.php

This commit is contained in:
FusionPBX 2018-05-01 02:57:47 -06:00 committed by GitHub
parent a84f7155d5
commit e05683f66b
1 changed files with 39 additions and 41 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2017 Portions created by the Initial Developer are Copyright (C) 2008-2018
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -120,10 +120,10 @@
$mod_caller_id_name = str_replace("*", "%", $caller_id_name); $mod_caller_id_name = str_replace("*", "%", $caller_id_name);
$sql_where_ands[] = "caller_id_name like '".$mod_caller_id_name."'"; $sql_where_ands[] = "caller_id_name like '".$mod_caller_id_name."'";
} }
if (strlen($caller_extension_uuid) > 0) { if (strlen($caller_extension_uuid) > 0 and is_uuid($caller_extension_uuid)) {
$sql_where_ands[] = "extension_uuid = '".$caller_extension_uuid."'"; $sql_where_ands[] = "extension_uuid = '".$caller_extension_uuid."'";
} }
if (strlen($caller_id_number) > 0) { if (strlen($caller_id_number) > 0 && is_numeric($caller_id_number)) {
$mod_caller_id_number = str_replace("*", "%", $caller_id_number); $mod_caller_id_number = str_replace("*", "%", $caller_id_number);
$sql_where_ands[] = "caller_id_number like '".$mod_caller_id_number."'"; $sql_where_ands[] = "caller_id_number like '".$mod_caller_id_number."'";
} }
@ -321,10 +321,9 @@
if ($_REQUEST['export_format'] == "csv") { $rows_per_page = 0; } if ($_REQUEST['export_format'] == "csv") { $rows_per_page = 0; }
if ($_REQUEST['export_format'] == "pdf") { $rows_per_page = 0; } if ($_REQUEST['export_format'] == "pdf") { $rows_per_page = 0; }
//page results if rows_per_page is greater than zero //count the records in the database
if ($rows_per_page > 0) { /*
if ($_SESSION['cdr']['limit']['numeric'] == 0) {
//get the number of rows in the v_xml_cdr
$sql = "select count(uuid) as num_rows from v_xml_cdr "; $sql = "select count(uuid) as num_rows from v_xml_cdr ";
$sql .= "where domain_uuid = '".$domain_uuid."' ".$sql_where; $sql .= "where domain_uuid = '".$domain_uuid."' ".$sql_where;
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
@ -339,6 +338,8 @@
} }
} }
unset($prep_statement, $result); unset($prep_statement, $result);
}
*/
//limit the number of results //limit the number of results
if ($_SESSION['cdr']['limit']['numeric'] > 0) { if ($_SESSION['cdr']['limit']['numeric'] > 0) {
@ -350,12 +351,9 @@
//prepare to page the results //prepare to page the results
//$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; //set on the page that includes this page //$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; //set on the page that includes this page
$page = $_GET['page']; if (is_numeric($_GET['page'])) { $page = $_GET['page']; }
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (!isset($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls_mini, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page, true); //top
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); //bottom
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
}
//get the results from the db //get the results from the db
$sql = "select "; $sql = "select ";
@ -422,9 +420,6 @@
} }
$sql= str_replace(" ", " ", $sql); $sql= str_replace(" ", " ", $sql);
$sql= str_replace("where and", "where", $sql); $sql= str_replace("where and", "where", $sql);
//$prep_statement = $db->prepare(check_sql($sql));
//$prep_statement->execute();
//$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
$database = new database; $database = new database;
if ($archive_request == 'true') { if ($archive_request == 'true') {
if ($_SESSION['cdr']['archive_database']['boolean'] == 'true') { if ($_SESSION['cdr']['archive_database']['boolean'] == 'true') {
@ -441,9 +436,12 @@
$result = $database->result; $result = $database->result;
$result_count = count($result); $result_count = count($result);
unset($database); unset($database);
$result_count = count($result);
unset ($prep_statement, $sql);
//return the paging
list($paging_controls_mini, $rows_per_page, $offset) = paging($num_rows, $param, $rows_per_page, true, $result_count); //top
list($paging_controls, $rows_per_page, $offset) = paging($num_rows, $param, $rows_per_page, false, $result_count); //bottom
//set the row style
$c = 0; $c = 0;
$row_style["0"] = "row_style0"; $row_style["0"] = "row_style0";
$row_style["1"] = "row_style1"; $row_style["1"] = "row_style1";