diff --git a/app/xml_cdr/download.php b/app/xml_cdr/download.php
index 42f926f4d5..4781cda42e 100644
--- a/app/xml_cdr/download.php
+++ b/app/xml_cdr/download.php
@@ -42,4 +42,4 @@
$obj = new xml_cdr;
$obj->download();
-?>
+?>
\ No newline at end of file
diff --git a/app/xml_cdr/report.php b/app/xml_cdr/report.php
index c3b769074a..44e689d014 100644
--- a/app/xml_cdr/report.php
+++ b/app/xml_cdr/report.php
@@ -29,8 +29,6 @@
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
- require_once "resources/header.php";
- //require_once "xml_cdr_statistics_inc.php";
//check permissions
if (permission_exists('xml_cdr_view')) {
@@ -42,175 +40,154 @@
}
//additional includes
- //require_once "xml_cdr_statistics_inc.php";
require_once "resources/header.php";
-global $db;
-
$dom = date('m');
$year = date('Y');
-if (strlen($where) == 0) {
- $duuid = "domain_uuid = '".$_SESSION['domain_uuid']."' ";
-}
+for ($y = 0; $y < 4; $y++) {
+ $fileheader = array('month', 'total calls', 'total seconds', 'total minutes', 'total hours', 'billing periods', 'rate', 'approx cost');
-for ($y=0; $y<4; $y++) {
- $fileheader = array( 'month', 'total calls' , 'total seconds' , 'total minutes' , 'total hours' , 'billing periods', 'rate', 'approx cost');
+ if ($y == 0) {
+ $table_name = "Previous 12 Months Inbound Call Summary
";
+ $sql_begin = "select billsec as seconds from v_xml_cdr where (domain_uuid = :domain_uuid and direction = 'inbound') ";
+ $rate = 0.012;
+ $bill_period = 60;
+ }
+ else if ($y == 1) {
+ $table_name = "Previous 12 Months Outbound Metered Call Summary
";
+ $sql_begin = "select billsec as seconds from v_xml_cdr where (domain_uuid = :domain_uuid and direction = 'outbound') ";
+ $sql_end = "and destination_number not like '%800_______' and destination_number not like '%888_______' and destination_number not like '%877_______' and destination_number not like '%866_______' and destination_number not like '%855_______' ";
+ $rate = 0.0098;
+ $rate = $rate / 10;
+ $bill_period = 6;
+ }
+ else if ($y == 2) {
+ $table_name = "Previous 12 Months Toll Free Call Summary
";
+ $sql_begin = "select billsec as seconds from v_xml_cdr where (domain_uuid = :domain_uuid and direction = 'outbound') ";
+ $sql_end = "and (destination_number like '%800_______' or destination_number like '%888_______' or destination_number like '%877_______' or destination_number like '%866_______' or destination_number like '%855_______') ";
+ $rate = 0;
+ $bill_period = 6;
+ }
+ else if ($y == 3) {
+ $table_name = "Previous 12 Months Local Free Call Summary
";
+ $sql_begin = "select billsec as seconds from v_xml_cdr where (domain_uuid = :domain_uuid and direction = 'local') ";
+ $rate = 0;
+ $bill_period = 6;
+ }
+ //set the style
+ $c = 0;
+ $row_style["0"] = "row_style0";
+ $row_style["1"] = "row_style1";
- if ( $y == 0) {
- $tablename = "Previous 12 Months Inbound Call Summary
";
- $sql1 = "select billsec as seconds from v_xml_cdr where (".$duuid."and direction='inbound') ";
- $sql3 = ";";
- //really we should set rate in domain settings or something and pull it from the php session.
- $rate=0.012;
- $bill_period=60;
- }
- elseif ($y == 1) {
- $tablename = "Previous 12 Months Outbound Metered Call Summary
";
- $sql1 = "select billsec as seconds from v_xml_cdr where (".$duuid."and direction='outbound') ";
- $sql3 = "and destination_number not like '%800_______' and destination_number not like '%888_______' and destination_number not like '%877_______' and destination_number not like '%866_______' and destination_number not like '%855_______' ;";
- $rate=0.0098;
- $rate=$rate/10;
- $bill_period=6;
- }
- elseif ($y == 2) {
- $tablename = "Previous 12 Months Toll Free Call Summary
";
- $sql1 = "select billsec as seconds from v_xml_cdr where (".$duuid."and direction='outbound') ";
- $sql3 = "and (destination_number like '%800_______' or destination_number like '%888_______' or destination_number like '%877_______' or destination_number like '%866_______' or destination_number like '%855_______');";
- $rate=0;
- $bill_period=6;
- }
- elseif ($y == 3) {
- $tablename = "Previous 12 Months Local Free Call Summary
";
- $sql1 = "select billsec as seconds from v_xml_cdr where (".$duuid."and direction='local') ";
- $sql3 = ";";
- $rate=0;
- $bill_period=6;
- }
- else {
- echo "whoops
";
- }
+ echo "
";
+ $dom = date('m');
+ $year = date('Y');
+ $lyear = $year;
+ $last_month = $year."-".$dolm."-01";
+ $this_month = $year."-".$dom."-01";
-//set the style
- $c = 0;
- $row_style["0"] = "row_style0";
- $row_style["1"] = "row_style1";
+ echo $table_name;
- echo "";
+ foreach ($fileheader as $tr) {
+ echo "| ".$tr." | ";
+ }
- $dom = date('m');
- $year = date('Y');
- $lyear=$year;
- $lastmonth = $year."-".$dolm."-01";
- $thismonth = $year."-".$dom."-01";
+ for ($x = 0; $x < 12; $x++) {
+ if ($dom == 1) {
+ $dom = 12;
+ $year = $year - 1;
+ }
+ else if ($x == 0) {
+ $dom = $dom;
+ }
+ else {
+ $dom = $dom - 1;
+ }
+ if ($dom == 1) {
+ $dolm = 12;
+ $lyear = $lyear - 1;
+ }
+ else {
+ $dolm = $dom - 1;
+ }
- echo $tablename;
+ //convert to int
+ $dom = $dom * 1;
+ $dolm = $dolm * 1;
- foreach ($fileheader as $tr){
- echo "" . $tr . " | ";
- }
+ //back to string, prepend 0)
+ if ( $dolm < 10 ) {
+ $dolm = "0".$dolm;
+ }
+ if ( $dom < 10 ) {
+ $dom = "0".$dom;
+ }
+ $last_month = $lyear."-".$dolm."-01";
+ $this_month = $year."-".$dom."-01";
- for ($x=0; $x < 12; $x++)
- {
- if ($dom == 1){
- $dom=12;
- $year=$year-1;
- }
- elseif ($x == 0){
- $dom=$dom;
- }
- else {
- $dom=$dom-1;
- }
- if ($dom == 1) {
- $dolm=12;
- $lyear=$lyear-1;
- }
- else {
- $dolm=$dom-1;
- }
+ $sql = $sql_begin." and (start_stamp >= :last_month and start_stamp < :this_month) ".$sql_end;
+ $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
+ $parameters['last_month'] = $last_month;
+ $parameters['this_month'] = $this_month;
+ $database = new database;
+ $result = $database->select($sql, $parameters, 'all');
+ unset($sql);
+ $max = sizeof($result) - 1;
- //convert to int
- $dom=$dom*1;
- $dolm=$dolm*1;
+ $i = 0;
- //back to string, prepend 0)
- if ( $dolm < 10 ) {
- $dolm = "0".$dolm;
- }
- if ( $dom < 10 ) {
- $dom = "0".$dom;
- }
- $lastmonth = $lyear."-".$dolm."-01";
- $thismonth = $year."-".$dom."-01";
-
- $sql2 = "and (start_stamp >= '" . $lastmonth . "' AND start_stamp < '" . $thismonth. "') ";
-
- $sql = $sql1;
- $sql .= $sql2;
- $sql .= $sql3;
- $sql .= $callsort;
- //echo "
" . $sql . "
";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
- unset ($prep_statement, $sql);
- $max = sizeof($result) -1;
-
- $i=0;
-
-
- echo "";
+ echo "
";
//echo " | ".($i+1)." | \n";
- if ( $max > 0 ) {
- foreach($result as $row) {
- $result = $row['seconds'];
- $billtime_1 = intval($result/$bill_period);
- $billtime_2 = $result%$bill_period;
+ if ($max > 0) {
+ foreach ($result as $row) {
+ $result = $row['seconds'];
+ $billtime_1 = intval($result / $bill_period);
+ $billtime_2 = $result % $bill_period;
- if (($result%$bill_period) != 0 ) {
- //need to round up for billing period
- $billtime = $billtime + intval($result/$bill_period) + 1;
- //echo " mod worked ";
- }
- else {
- //no need to round up for billing period
- $billtime = $billtime + intval($result/$bill_period);
- }
- $tottime = $tottime + $result;
- }
+ if (($result % $bill_period) != 0) {
+ //need to round up for billing period
+ $billtime = $billtime + intval($result / $bill_period) + 1;
+ //echo " mod worked ";
+ }
+ else {
+ //no need to round up for billing period
+ $billtime = $billtime + intval($result / $bill_period);
+ }
+ $tottime = $tottime + $result;
+ }
- echo "".$dolm."/".$lyear." | ";
- echo "".$max." | ";
- echo "".$tottime." | ";
- $mintime = $tottime/$bill_period;
- echo "".round($mintime,1)." | ";
- $hourtime = $tottime/3600;
- echo "".round($hourtime,1)." | ";
- $tot_cost = $rate * $billtime ;
- echo "".$billtime." | ";
- echo "".$rate." | ";
- echo "$".round($tot_cost,2)." | ";
+ echo " ".$dolm."/".$lyear." | ";
+ echo " ".$max." | ";
+ echo " ".$tottime." | ";
+ $mintime = $tottime / $bill_period;
+ echo " ".round($mintime,1)." | ";
+ $hourtime = $tottime / 3600;
+ echo " ".round($hourtime,1)." | ";
+ $tot_cost = $rate * $billtime ;
+ echo " ".$billtime." | ";
+ echo " ".$rate." | ";
+ echo " $".round($tot_cost,2)." | ";
- if ($c==0) { $c=1; } else { $c=0; }
+ $c = $c ? 0 : 1;
+ }
+ echo "
";
-
- }
- echo "";
- $max=0;
- $tottime=0;
- $hourtime=0;
- $billtime=0;
- $tot_cost=0;
- $mintime=0;
- }
- echo "
";
- echo "
";
+ $max = 0;
+ $tottime = 0;
+ $hourtime = 0;
+ $billtime = 0;
+ $tot_cost = 0;
+ $mintime = 0;
+ }
+ echo "
";
+ echo "
";
}
//show the footer
- require_once "resources/footer.php";
-?>
+ require_once "resources/footer.php";
+
+?>
\ No newline at end of file
diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php
index a5b9d0c488..d01eb9c862 100644
--- a/app/xml_cdr/xml_cdr.php
+++ b/app/xml_cdr/xml_cdr.php
@@ -152,15 +152,13 @@
echo " \n";
}
echo " \n";
- echo " \n";
- echo " ";
- echo " ";
echo " \n";
- echo " | \n";
+ echo " \n";
+ echo " ";
echo " ".$paging_controls_mini." | \n";
echo " \n";
echo " \n";
@@ -449,8 +447,8 @@
file_exists($theme_image_path."icon_cdr_local_failed.png")
) ? true : false;
- // loop through the results
- foreach($result as $index => $row) {
+ //loop through the results
+ foreach ($result as $index => $row) {
//get the date and time
$tmp_year = date("Y", strtotime($row['start_stamp']));
$tmp_month = date("M", strtotime($row['start_stamp']));
@@ -464,7 +462,7 @@
$hangup_cause = ucwords($hangup_cause);
//if call cancelled, show the ring time, not the bill time.
- $seconds = ($row['hangup_cause']=="ORIGINATOR_CANCEL") ? $row['duration'] : round(($row['billmsec'] / 1000), 0, PHP_ROUND_HALF_UP);
+ $seconds = $row['hangup_cause'] == "ORIGINATOR_CANCEL" ? $row['duration'] : round(($row['billmsec'] / 1000), 0, PHP_ROUND_HALF_UP);
//determine recording properties
if (permission_exists('recording_play') || permission_exists('recording_download')) {
@@ -685,16 +683,16 @@
if ($row['leg'] == 'a') {
echo $content;
}
- elseif ($row['leg'] == 'b' && permission_exists('xml_cdr_b_leg')) {
+ else if ($row['leg'] == 'b' && permission_exists('xml_cdr_b_leg')) {
echo $content;
}
unset($content);
//toggle the color
- $c = ($c) ? 0 : 1;
- } //end foreach
- unset($sql, $result, $row_count);
- } //end foreach
+ $c = $c ? 0 : 1;
+ } //foreach
+ } //if
+ unset($sql, $result, $row_count);
//paging controls
echo "\n";
@@ -721,4 +719,4 @@
//show the footer
require_once "resources/footer.php";
-?>
+?>
\ No newline at end of file
diff --git a/app/xml_cdr/xml_cdr_archive.php b/app/xml_cdr/xml_cdr_archive.php
index 2d56c487c5..f0f8709d70 100644
--- a/app/xml_cdr/xml_cdr_archive.php
+++ b/app/xml_cdr/xml_cdr_archive.php
@@ -131,6 +131,7 @@
echo " \n";
@@ -724,4 +722,4 @@
//show the footer
require_once "resources/footer.php";
-?>
+?>
\ No newline at end of file
diff --git a/app/xml_cdr/xml_cdr_delete.php b/app/xml_cdr/xml_cdr_delete.php
index 390846fa6d..f4167b26bc 100644
--- a/app/xml_cdr/xml_cdr_delete.php
+++ b/app/xml_cdr/xml_cdr_delete.php
@@ -42,21 +42,13 @@
$language = new text;
$text = $language->get();
-//get posted values, if any
- if (sizeof($_REQUEST) > 0) {
- $xml_cdr_uuids = $_REQUEST["id"];
- if (sizeof($xml_cdr_uuids) > 0) {
- foreach ($xml_cdr_uuids as $index => $xml_cdr_uuid) {
- if (is_uuid($xml_cdr_uuid)) {
- // delete record from v_xml_cdr
- $sql = "delete from v_xml_cdr ";
- $sql .= "where xml_cdr_uuid = :xml_cdr_uuid ";
- $parameters['xml_cdr_uuid'] = $xml_cdr_uuid;
- $database = new database;
- $database->execute($sql, $parameters);
- unset($sql, $parameters);
-
- //get the call recordings
+//get posted values
+ $xml_cdr_uuids = $_REQUEST["id"];
+ if (is_array($xml_cdr_uuids) && @sizeof($xml_cdr_uuids) != 0) {
+ $records_deleted = 0;
+ foreach ($xml_cdr_uuids as $x => $xml_cdr_uuid) {
+ if (is_uuid($xml_cdr_uuid)) {
+ //get the call recordings
$sql = "select * from v_call_recordings ";
$sql .= "where call_recording_uuid = :xml_cdr_uuid ";
$parameters['xml_cdr_uuid'] = $xml_cdr_uuid;
@@ -64,28 +56,41 @@
$row = $database->select($sql, $parameters, 'row');
unset($sql, $parameters);
- //delete the call recording
+ //delete the call recording
$call_recording_path = realpath($row['call_recording_path']);
$call_recording_name = $row['call_recording_name'];
if (file_exists($call_recording_path.'/'.$call_recording_name)) {
@unlink($call_recording_path.'/'.$call_recording_name);
}
- //delete the call recording meta data
- $sql = "delete from v_call_recordings ";
- $sql .= "where call_recording_uuid = :xml_cdr_uuid ";
- $parameters['xml_cdr_uuid'] = $xml_cdr_uuid;
- $database = new database;
- $database->execute($sql, $parameters);
- unset($sql, $parameters);
-
- }
+ //build cdr delete array
+ $array['xml_cdr'][$x]['xml_cdr_uuid'] = $xml_cdr_uuid;
+ //build call recording delete array
+ $array['call_recordings'][$x]['call_recording_uuid'] = $xml_cdr_uuid;
+ //increment counter
+ $records_deleted++;
}
}
+ if (is_array($array) && @sizeof($array) != 0) {
+ //grant temporary permissions
+ $p = new permissions;
+ $p->add('xml_cdr_delete', 'temp');
+ $p->add('call_recording_delete', 'temp');
+ //execute delete
+ $database = new database;
+ $database->app_name = 'xml_cdr';
+ $database->app_uuid = '4a085c51-7635-ff03-f67b-86e834422848';
+ $database->delete($array);
+ unset($array);
+ //revoke temporary permissions
+ $p->delete('xml_cdr_delete', 'temp');
+ $p->delete('call_recording_delete', 'temp');
+ //set message
+ $_SESSION["message"] = $text['message-delete'].": ".$records_deleted;
+ }
}
-//set message and redirect the user
- $_SESSION["message"] = $text['message-delete'].": ".sizeof($xml_cdr_uuids);
+//redirect
header("Location: xml_cdr.php");
-?>
+?>
\ No newline at end of file
diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php
index 3cf10ca9c8..d6678691c5 100644
--- a/app/xml_cdr/xml_cdr_details.php
+++ b/app/xml_cdr/xml_cdr_details.php
@@ -43,22 +43,29 @@
$text = $language->get();
//get the http values and set them to a variable
- if (strlen($_REQUEST["id"]) > 0) {
- $uuid = trim($_REQUEST["id"]);
+ if (is_uuid($_REQUEST["id"])) {
+ $uuid = $_REQUEST["id"];
}
//get the cdr string from the database
$sql = "select * from v_xml_cdr ";
if (permission_exists('xml_cdr_all')) {
- $sql .= "where xml_cdr_uuid = '$uuid' ";
- } else {
- $sql .= "where xml_cdr_uuid = '$uuid' and domain_uuid = '$domain_uuid' ";
+ $sql .= "where xml_cdr_uuid = :xml_cdr_uuid ";
}
- $row = $db->query($sql)->fetch();
- $start_stamp = trim($row["start_stamp"]);
- $xml_string = trim($row["xml"]);
- $json_string = trim($row["json"]);
- //print_r($row);
+ else {
+ $sql .= "where xml_cdr_uuid = :xml_cdr_uuid ";
+ $sql .= "and domain_uuid = :domain_uuid ";
+ $parameters['domain_uuid'] = $domain_uuid;
+ }
+ $parameters['xml_cdr_uuid'] = $uuid;
+ $database = new database;
+ $row = $database->select($sql, $parameters, 'row');
+ if (is_array($row) && @sizeof($row) != 0) {
+ $start_stamp = trim($row["start_stamp"]);
+ $xml_string = trim($row["xml"]);
+ $json_string = trim($row["json"]);
+ }
+ unset($sql, $parameters, $row);
//get the format
if (strlen($xml_string) > 0) {
@@ -89,7 +96,7 @@
try {
if ($format == 'json') {
$array = json_decode($json_string,true);
- if (is_null($array)){
+ if (is_null($array)) {
$j = stripslashes($json_string);
$array = json_decode($j,true);
}
@@ -98,7 +105,7 @@
$array = json_decode(json_encode((array)simplexml_load_string($xml_string)),true);
}
}
- catch(Exception $e) {
+ catch (Exception $e) {
echo $e->getMessage();
}
@@ -126,28 +133,28 @@
//detail summary
//get the variables
- $xml_cdr_uuid = check_str(urldecode($array["variables"]["uuid"]));
- $direction = check_str(urldecode($array["channel_data"]["direction"]));
- $language = check_str(urldecode($array["variables"]["language"]));
- $start_epoch = check_str(urldecode($array["variables"]["start_epoch"]));
- $start_stamp = check_str(urldecode($array["variables"]["start_stamp"]));
- $start_uepoch = check_str(urldecode($array["variables"]["start_uepoch"]));
- $answer_stamp = check_str(urldecode($array["variables"]["answer_stamp"]));
- $answer_epoch = check_str(urldecode($array["variables"]["answer_epoch"]));
- $answer_uepoch = check_str(urldecode($array["variables"]["answer_uepoch"]));
- $end_epoch = check_str(urldecode($array["variables"]["end_epoch"]));
- $end_uepoch = check_str(urldecode($array["variables"]["end_uepoch"]));
- $end_stamp = check_str(urldecode($array["variables"]["end_stamp"]));
- $duration = check_str(urldecode($array["variables"]["duration"]));
- $mduration = check_str(urldecode($array["variables"]["mduration"]));
- $billsec = check_str(urldecode($array["variables"]["billsec"]));
- $billmsec = check_str(urldecode($array["variables"]["billmsec"]));
- $bridge_uuid = check_str(urldecode($array["variables"]["bridge_uuid"]));
- $read_codec = check_str(urldecode($array["variables"]["read_codec"]));
- $write_codec = check_str(urldecode($array["variables"]["write_codec"]));
- $remote_media_ip = check_str(urldecode($array["variables"]["remote_media_ip"]));
- $hangup_cause = check_str(urldecode($array["variables"]["hangup_cause"]));
- $hangup_cause_q850 = check_str(urldecode($array["variables"]["hangup_cause_q850"]));
+ $xml_cdr_uuid = urldecode($array["variables"]["uuid"]);
+ $direction = urldecode($array["channel_data"]["direction"]);
+ $language = urldecode($array["variables"]["language"]);
+ $start_epoch = urldecode($array["variables"]["start_epoch"]);
+ $start_stamp = urldecode($array["variables"]["start_stamp"]);
+ $start_uepoch = urldecode($array["variables"]["start_uepoch"]);
+ $answer_stamp = urldecode($array["variables"]["answer_stamp"]);
+ $answer_epoch = urldecode($array["variables"]["answer_epoch"]);
+ $answer_uepoch = urldecode($array["variables"]["answer_uepoch"]);
+ $end_epoch = urldecode($array["variables"]["end_epoch"]);
+ $end_uepoch = urldecode($array["variables"]["end_uepoch"]);
+ $end_stamp = urldecode($array["variables"]["end_stamp"]);
+ $duration = urldecode($array["variables"]["duration"]);
+ $mduration = urldecode($array["variables"]["mduration"]);
+ $billsec = urldecode($array["variables"]["billsec"]);
+ $billmsec = urldecode($array["variables"]["billmsec"]);
+ $bridge_uuid = urldecode($array["variables"]["bridge_uuid"]);
+ $read_codec = urldecode($array["variables"]["read_codec"]);
+ $write_codec = urldecode($array["variables"]["write_codec"]);
+ $remote_media_ip = urldecode($array["variables"]["remote_media_ip"]);
+ $hangup_cause = urldecode($array["variables"]["hangup_cause"]);
+ $hangup_cause_q850 = urldecode($array["variables"]["hangup_cause_q850"]);
if (!isset($array["callflow"][0])) {
$tmp = $array["callflow"];
unset($array["callflow"]);
@@ -156,12 +163,12 @@
$x = 0;
if (is_array($array["callflow"])) foreach ($array["callflow"] as $row) {
if ($x == 0) {
- $destination_number = check_str(urldecode($row["caller_profile"]["destination_number"]));
- $context = check_str(urldecode($row["caller_profile"]["context"]));
- $network_addr = check_str(urldecode($row["caller_profile"]["network_addr"]));
+ $destination_number = urldecode($row["caller_profile"]["destination_number"]);
+ $context = urldecode($row["caller_profile"]["context"]);
+ $network_addr = urldecode($row["caller_profile"]["network_addr"]);
}
- $caller_id_name = check_str(urldecode($row["caller_profile"]["caller_id_name"]));
- $caller_id_number = check_str(urldecode($row["caller_profile"]["caller_id_number"]));
+ $caller_id_name = urldecode($row["caller_profile"]["caller_id_name"]);
+ $caller_id_number = urldecode($row["caller_profile"]["caller_id_number"]);
$x++;
}
unset($x);
@@ -253,7 +260,7 @@
echo " | ".$key." | \n";
echo " ".wordwrap($value,75," \n", TRUE)." | \n";
echo "
\n";
- if ($c==0) { $c=1; } else { $c=0; }
+ $c = $c ? 0 : 1;
}
echo "";
echo "
\n";
@@ -274,47 +281,49 @@
echo "".$text['label-name']." | \n";
echo "".$text['label-value']." | \n";
echo "\n";
- if (is_array($array["variables"])) foreach($array["variables"] as $key => $value) {
- if (is_array($value)) { $value = implode($value); }
- $value = urldecode($value);
- if ($key != "digits_dialed" && $key != "dsn") {
- echo "\n";
- echo " | ".$key." | \n";
- if ($key == "bridge_uuid" || $key == "signal_bond") {
- echo " \n";
- echo " ".$value." \n";
- $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
- $tmp_name = '';
- if (file_exists($tmp_dir.'/'.$value.'.wav')) {
- $tmp_name = $value.".wav";
+ if (is_array($array["variables"])) {
+ foreach($array["variables"] as $key => $value) {
+ if (is_array($value)) { $value = implode($value); }
+ $value = urldecode($value);
+ if ($key != "digits_dialed" && $key != "dsn") {
+ echo " |
\n";
+ echo " | ".$key." | \n";
+ if ($key == "bridge_uuid" || $key == "signal_bond") {
+ echo " \n";
+ echo " ".$value." \n";
+ $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
+ $tmp_name = '';
+ if (file_exists($tmp_dir.'/'.$value.'.wav')) {
+ $tmp_name = $value.".wav";
+ }
+ else if (file_exists($tmp_dir.'/'.$value.'_1.wav')) {
+ $tmp_name = $value."_1.wav";
+ }
+ else if (file_exists($tmp_dir.'/'.$value.'.mp3')) {
+ $tmp_name = $value.".mp3";
+ }
+ else if (file_exists($tmp_dir.'/'.$value.'_1.mp3')) {
+ $tmp_name = $value."_1.mp3";
+ }
+ if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
+ echo " \n";
+ echo " play";
+ echo " ";
+ }
+ if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
+ echo " \n";
+ echo " download";
+ echo " ";
+ }
+ echo " | \n";
}
- elseif (file_exists($tmp_dir.'/'.$value.'_1.wav')) {
- $tmp_name = $value."_1.wav";
+ else {
+ echo " ".wordwrap($value,75," \n", true)." | \n";
}
- elseif (file_exists($tmp_dir.'/'.$value.'.mp3')) {
- $tmp_name = $value.".mp3";
- }
- elseif (file_exists($tmp_dir.'/'.$value.'_1.mp3')) {
- $tmp_name = $value."_1.mp3";
- }
- if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
- echo " \n";
- echo " play";
- echo " ";
- }
- if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
- echo " \n";
- echo " download";
- echo " ";
- }
- echo "\n";
+ echo "
\n";
}
- else {
- echo " ".wordwrap($value,75," \n", TRUE)." | \n";
- }
- echo "\n";
+ $c = $c ? 0 : 1;
}
- if ($c==0) { $c=1; } else { $c=0; }
}
echo "";
echo "
\n";
@@ -337,14 +346,16 @@
echo "\n";
//foreach($array["variables"] as $key => $value) {
- if (is_array($array["app_log"]["application"])) foreach ($array["app_log"]["application"] as $row) {
- $app_name = $row["@attributes"]["app_name"];
- $app_data = urldecode($row["@attributes"]["app_data"]);
- echo "\n";
- echo " | ".$app_name." | \n";
- echo " ".wordwrap($app_data,75," \n", TRUE)." | \n";
- echo "
\n";
- if ($c==0) { $c=1; } else { $c=0; }
+ if (is_array($array["app_log"]["application"])) {
+ foreach ($array["app_log"]["application"] as $row) {
+ $app_name = $row["@attributes"]["app_name"];
+ $app_data = urldecode($row["@attributes"]["app_data"]);
+ echo "\n";
+ echo " | ".$app_name." | \n";
+ echo " ".wordwrap($app_data,75," \n", true)." | \n";
+ echo "
\n";
+ $c = $c ? 0 : 1;
+ }
}
echo "";
echo "
\n";
@@ -353,173 +364,187 @@
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
- if (is_array($array["callflow"])) foreach ($array["callflow"] as $row) {
-
- echo "\n";
- echo "\n";
- echo " \n";
-
- //attributes
- echo " \n";
- echo " \n";
- echo " | ".$text['label-call-flow']." | \n";
- echo " | \n";
- echo " \n";
- echo " \n";
-
+ if (is_array($array["callflow"])) {
+ foreach ($array["callflow"] as $row) {
echo "\n";
- echo " \n";
- echo " | ".$text['label-name']." | \n";
- echo " ".$text['label-value']." | \n";
- echo " \n";
- if (is_array($row["@attributes"])) foreach($row["@attributes"] as $key => $value) {
- $value = urldecode($value);
+ echo "\n";
+ echo " \n";
+
+ //attributes
+ echo " \n";
echo " \n";
- echo " | ".$key." | \n";
- echo " ".wordwrap($value,75," \n", TRUE)." | \n";
+ echo " ".$text['label-call-flow']." | \n";
+ echo " | \n";
echo " \n";
- if ($c==0) { $c=1; } else { $c=0; }
- }
- echo " \n";
- echo "
| \n";
- echo " \n";
- echo " \n";
+ echo " | \n";
- //extension attributes
- echo "\n";
- echo " \n";
- echo " | ".$text['label-call-flow-2']." | \n";
- echo " | \n";
- echo " \n";
- echo " \n";
-
- echo "\n";
- echo " \n";
- echo " | ".$text['label-name']." | \n";
- echo " ".$text['label-value']." | \n";
- echo " \n";
- if (is_array($row["extension"]["@attributes"])) foreach($row["extension"]["@attributes"] as $key => $value) {
- $value = urldecode($value);
- echo " \n";
- echo " | ".$key." | \n";
- echo " ".wordwrap($value,75," \n", TRUE)." | \n";
+ echo "\n";
+ echo " \n";
+ echo " | ".$text['label-name']." | \n";
+ echo " ".$text['label-value']." | \n";
echo " \n";
- if ($c==0) { $c=1; } else { $c=0; }
- }
- echo " \n";
- echo "
| \n";
- echo " \n";
- echo " \n";
-
- //extension application
- echo "\n";
- echo " \n";
- echo " | ".$text['label-call-flow-3']." | \n";
- echo " | \n";
- echo " \n";
- echo " \n";
-
- echo "\n";
- echo " \n";
- echo " | ".$text['label-name']." | \n";
- echo " ".$text['label-data']." | \n";
- echo " \n";
- if (is_array($row["extension"]["application"])) foreach ($row["extension"]["application"] as $tmp_row) {
- $app_name = $tmp_row["@attributes"]["app_name"];
- $app_data = urldecode($tmp_row["@attributes"]["app_data"]);
- echo " \n";
- echo " | ".$app_name." | \n";
- echo " ".wordwrap($app_data,75," \n", TRUE)." | \n";
- echo " \n";
- if ($c==0) { $c=1; } else { $c=0; }
- }
- echo " \n";
- echo "
| \n";
- echo " \n";
- echo " \n";
-
- //caller profile
- echo "\n";
- echo " \n";
- echo " | ".$text['label-call-flow-4']." | \n";
- echo " | \n";
- echo " \n";
- echo " \n";
-
- echo "\n";
- echo " \n";
- echo " | ".$text['label-name']." | \n";
- echo " ".$text['label-value']." | \n";
- echo " \n";
- if (is_array($row["caller_profile"])) foreach($row["caller_profile"] as $key => $value) {
- if (is_array($value)) { $value = implode($value); }
- $value = urldecode($value);
- echo " \n";
- if ($key != "originatee") {
- if (is_array($value)) { $value = implode($value); }
- $value = urldecode($value);
- echo " | ".$key." | \n";
- echo " ".wordwrap($value,75," \n", TRUE)." | \n";
+ if (is_array($row["@attributes"])) {
+ foreach($row["@attributes"] as $key => $value) {
+ $value = urldecode($value);
+ echo " \n";
+ echo " | ".$key." | \n";
+ echo " ".wordwrap($value,75," \n", true)." | \n";
+ echo " \n";
+ $c = $c ? 0 : 1;
+ }
}
- else {
- echo " ".$key." | \n";
- echo " \n";
- echo " \n";
- if (isset($child["originatee_caller_profile"])) foreach($child["originatee_caller_profile"] as $key => $value) {
- //print_r($tmp_child);
- echo " \n";
- echo " | ".$key." | \n";
- if ($key != "uuid") {
- echo " ".wordwrap($value,75," \n", TRUE)." | \n";
+ echo " \n";
+ echo "
| \n";
+ echo " \n";
+ echo " \n";
+
+ //extension attributes
+ echo "\n";
+ echo " \n";
+ echo " | ".$text['label-call-flow-2']." | \n";
+ echo " | \n";
+ echo " \n";
+ echo " \n";
+
+ echo "\n";
+ echo " \n";
+ echo " | ".$text['label-name']." | \n";
+ echo " ".$text['label-value']." | \n";
+ echo " \n";
+ if (is_array($row["extension"]["@attributes"])) {
+ foreach($row["extension"]["@attributes"] as $key => $value) {
+ $value = urldecode($value);
+ echo " \n";
+ echo " | ".$key." | \n";
+ echo " ".wordwrap($value,75," \n", true)." | \n";
+ echo " \n";
+ $c = $c ? 0 : 1;
+ }
+ }
+ echo " \n";
+ echo "
| \n";
+ echo " \n";
+ echo " \n";
+
+ //extension application
+ echo "\n";
+ echo " \n";
+ echo " | ".$text['label-call-flow-3']." | \n";
+ echo " | \n";
+ echo " \n";
+ echo " \n";
+
+ echo "\n";
+ echo " \n";
+ echo " | ".$text['label-name']." | \n";
+ echo " ".$text['label-data']." | \n";
+ echo " \n";
+ if (is_array($row["extension"]["application"])) {
+ foreach ($row["extension"]["application"] as $tmp_row) {
+ $app_name = $tmp_row["@attributes"]["app_name"];
+ $app_data = urldecode($tmp_row["@attributes"]["app_data"]);
+ echo " \n";
+ echo " | ".$app_name." | \n";
+ echo " ".wordwrap($app_data,75," \n", true)." | \n";
+ echo " \n";
+ $c = $c ? 0 : 1;
+ }
+ }
+ echo " \n";
+ echo "
| \n";
+ echo " \n";
+ echo " \n";
+
+ //caller profile
+ echo "\n";
+ echo " \n";
+ echo " | ".$text['label-call-flow-4']." | \n";
+ echo " | \n";
+ echo " \n";
+ echo " \n";
+
+ echo "\n";
+ echo " \n";
+ echo " | ".$text['label-name']." | \n";
+ echo " ".$text['label-value']." | \n";
+ echo " \n";
+ if (is_array($row["caller_profile"])) {
+ foreach($row["caller_profile"] as $key => $value) {
+ if (is_array($value)) { $value = implode($value); }
+ $value = urldecode($value);
+ echo " \n";
+ if ($key != "originatee") {
+ if (is_array($value)) { $value = implode($value); }
+ $value = urldecode($value);
+ echo " | ".$key." | \n";
+ echo " ".wordwrap($value,75," \n", true)." | \n";
}
else {
- echo " ".$value." | \n";
+ echo " ".$key." | \n";
+ echo " \n";
+ echo " \n";
+ if (isset($child["originatee_caller_profile"])) {
+ foreach($child["originatee_caller_profile"] as $key => $value) {
+ //print_r($tmp_child);
+ echo " \n";
+ echo " | ".$key." | \n";
+ if ($key != "uuid") {
+ echo " ".wordwrap($value,75," \n", true)." | \n";
+ }
+ else {
+ echo " ".$value." | \n";
+ }
+ echo " \n";
+ }
+ }
+ echo " \n";
+ echo " | \n";
}
- echo " \n";
+ echo "\n";
+ $c = $c ? 0 : 1;
}
- echo " \n";
- echo " | \n";
}
- echo "\n";
- if ($c==0) { $c=1; } else { $c=0; }
- }
- echo " \n";
- echo "
| \n";
- echo " \n";
- echo " \n";
-
- //times
- echo "\n";
- echo " \n";
- echo " | ".$text['label-call-flow-5']." | \n";
- echo " | \n";
- echo " \n";
-
- echo " \n";
- echo " | ".$text['label-name']." | \n";
- echo " ".$text['label-value']." | \n";
- echo " \n";
- if (is_array($row["times"])) foreach($row["times"] as $key => $value) {
- $value = urldecode($value);
- echo " \n";
- echo " | ".$key." | \n";
- echo " ".wordwrap($value,75," \n", TRUE)." | \n";
+ echo " \n";
+ echo "
| \n";
echo " \n";
- if ($c==0) { $c=1; } else { $c=0; }
- }
+ echo " \n";
- echo " \n";
- echo "
| \n";
- echo " \n";
+ //times
+ echo "\n";
+ echo " \n";
+ echo " | ".$text['label-call-flow-5']." | \n";
+ echo " | \n";
+ echo " \n";
- echo " ";
- echo "
\n";
+ echo " \n";
+ echo " | ".$text['label-name']." | \n";
+ echo " ".$text['label-value']." | \n";
+ echo " \n";
+ if (is_array($row["times"])) {
+ foreach($row["times"] as $key => $value) {
+ $value = urldecode($value);
+ echo " \n";
+ echo " | ".$key." | \n";
+ echo " ".wordwrap($value,75," \n", true)." | \n";
+ echo " \n";
+ $c = $c ? 0 : 1;
+ }
+ }
- echo "\n";
- echo "\n";
- echo " ";
+ echo " |
\n";
+ echo "
| \n";
+ echo "
\n";
+
+ echo "
";
+ echo "
\n";
+
+ echo "\n";
+ echo "\n";
+ echo "";
+ }
}
//get the footer
require_once "resources/footer.php";
-?>
+
+?>
\ No newline at end of file
diff --git a/app/xml_cdr/xml_cdr_export.php b/app/xml_cdr/xml_cdr_export.php
index 0d4f66f5e1..b78a86d7b4 100644
--- a/app/xml_cdr/xml_cdr_export.php
+++ b/app/xml_cdr/xml_cdr_export.php
@@ -47,10 +47,10 @@
require_once "xml_cdr_inc.php";
//get the format
- $export_format = check_str($_REQUEST['export_format']);
+ $export_format = $_REQUEST['export_format'];
//get the format
- $showall = check_str($_REQUEST['showall']);
+ $showall = $_REQUEST['showall'];
//exprot the csv
if ($export_format == 'csv') {
@@ -69,7 +69,7 @@
//set the csv headers
$z = 0;
- foreach($result[0] as $key => $val) {
+ foreach ($result[0] as $key => $val) {
if ($key != "xml" && $key != "json") {
if ($z == 0) {
echo '"'.$key.'"';
@@ -84,9 +84,9 @@
//show the csv data
$x=0;
- while(true) {
+ while (true) {
$z = 0;
- foreach($result[0] as $key => $val) {
+ foreach ($result[0] as $key => $val) {
if ($key != "xml" && $key != "json") {
if ($z == 0) {
echo '"'.$result[$x][$key].'"';
@@ -109,8 +109,8 @@
if ($export_format == 'pdf') {
//load pdf libraries
- require_once("resources/tcpdf/tcpdf.php");
- require_once("resources/fpdi/fpdi.php");
+ require_once "resources/tcpdf/tcpdf.php";
+ require_once "resources/fpdi/fpdi.php";
//determine page size
switch ($_SESSION['fax']['page_size']['text']) {
@@ -318,4 +318,4 @@
}
-?>
+?>
\ No newline at end of file
diff --git a/app/xml_cdr/xml_cdr_extension_summary.php b/app/xml_cdr/xml_cdr_extension_summary.php
index 8018c41a21..b285aa8350 100644
--- a/app/xml_cdr/xml_cdr_extension_summary.php
+++ b/app/xml_cdr/xml_cdr_extension_summary.php
@@ -47,11 +47,11 @@
require_once "resources/header.php";
//retrieve submitted data
- $quick_select = check_str($_REQUEST['quick_select']);
- $start_stamp_begin = check_str($_REQUEST['start_stamp_begin']);
- $start_stamp_end = check_str($_REQUEST['start_stamp_end']);
- $include_internal = check_str($_REQUEST['include_internal']);
- $quick_select = (sizeof($_REQUEST) == 0) ? 3 : $quick_select; //set default
+ $quick_select = $_REQUEST['quick_select'];
+ $start_stamp_begin = $_REQUEST['start_stamp_begin'];
+ $start_stamp_end = $_REQUEST['start_stamp_end'];
+ $include_internal = $_REQUEST['include_internal'];
+ $quick_select = sizeof($_REQUEST) == 0 ? 3 : $quick_select; //set default
//get the summary
$cdr = new xml_cdr;
@@ -112,7 +112,8 @@
echo "onclick=\"window.location='xml_cdr_extension_summary.php?";
if (strlen($_SERVER["QUERY_STRING"]) > 0) {
echo $_SERVER["QUERY_STRING"]."&type=csv';\">\n";
- } else {
+ }
+ else {
echo "type=csv';\">\n";
}
@@ -257,4 +258,4 @@
//show the footer
require_once "resources/footer.php";
-?>
+?>
\ No newline at end of file
diff --git a/app/xml_cdr/xml_cdr_import.php b/app/xml_cdr/xml_cdr_import.php
index ee70d8fb42..3c80c55cf0 100644
--- a/app/xml_cdr/xml_cdr_import.php
+++ b/app/xml_cdr/xml_cdr_import.php
@@ -48,4 +48,4 @@
$cdr = new xml_cdr;
$cdr->read_files();
-?>
+?>
\ No newline at end of file
diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php
index fe0fc5fbf7..a71086fbc0 100644
--- a/app/xml_cdr/xml_cdr_inc.php
+++ b/app/xml_cdr/xml_cdr_inc.php
@@ -95,7 +95,8 @@
case 'equal': $mos_comparison = "<"; break;
case 'notequal': $mos_comparison = "<>"; break;
}
- } else {
+ }
+ else {
$mos_comparison = '';
}
//$mos_comparison = $_REQUEST["mos_comparison"];
@@ -193,20 +194,13 @@
//count the records in the database
/*
if ($_SESSION['cdr']['limit']['numeric'] == 0) {
- $sql = "select count(xml_cdr_uuid) as num_rows from v_xml_cdr ";
- $sql .= "where domain_uuid = '".$domain_uuid."' ".$sql_where;
- $prep_statement = $db->prepare(check_sql($sql));
- if ($prep_statement) {
- $prep_statement->execute();
- $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
- if ($row['num_rows'] > 0) {
- $num_rows = $row['num_rows'];
- }
- else {
- $num_rows = '0';
- }
- }
- unset($prep_statement, $result);
+ $sql = "select count(*) from v_xml_cdr ";
+ $sql .= "where domain_uuid = :domain_uuid ";
+ $sql .= ".$sql_where;
+ $parameters['domain_uuid'] = $domain_uuid;
+ $database = new database;
+ $num_rows = $database->select($sql, $parameters, 'column');
+ unset($sql, $parameters);
}
*/
@@ -246,7 +240,7 @@
$sql .= "c.source_number, \n";
$sql .= "c.destination_number, \n";
$sql .= "c.leg, \n";
- $sql .= "(c.xml IS NOT NULL OR c.json IS NOT NULL) AS raw_data_exists, \n";
+ $sql .= "(c.xml is not null or c.json is not null) as raw_data_exists, \n";
$sql .= "c.json, \n";
if (is_array($_SESSION['cdr']['field'])) {
foreach ($_SESSION['cdr']['field'] as $field) {
@@ -277,8 +271,9 @@
$sql .= "left join v_extensions as e on e.extension_uuid = c.extension_uuid \n";
$sql .= "inner join v_domains as d on d.domain_uuid = c.domain_uuid \n";
if ($_REQUEST['show'] == "all" && permission_exists('xml_cdr_all')) {
- $sql .= "where 1 = 1 ";
- } else {
+ $sql .= "where true ";
+ }
+ else {
$sql .= "where c.domain_uuid = :domain_uuid \n";
$parameters['domain_uuid'] = $domain_uuid;
}
@@ -290,7 +285,7 @@
$sql .= "and missed_call = 1 \n";
}
if (strlen($start_epoch) > 0 && strlen($stop_epoch) > 0) {
- $sql .= "and start_epoch BETWEEN :start_epoch AND :stop_epoch \n";
+ $sql .= "and start_epoch between :start_epoch and :stop_epoch \n";
$parameters['start_epoch'] = $start_epoch;
$parameters['stop_epoch'] = $stop_epoch;
}
@@ -355,7 +350,7 @@
}
if (strlen($start_stamp_begin) > 0 && strlen($start_stamp_end) > 0) {
- $sql .= "and start_stamp BETWEEN :start_stamp_begin AND :start_stamp_end ";
+ $sql .= "and start_stamp between :start_stamp_begin and :start_stamp_end ";
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000';
$parameters['start_stamp_end'] = $start_stamp_end.':59.999';
}
@@ -370,7 +365,7 @@
}
}
if (strlen($answer_stamp_begin) > 0 && strlen($answer_stamp_end) > 0) {
- $sql .= "and answer_stamp BETWEEN :answer_stamp_begin AND :answer_stamp_end ";
+ $sql .= "and answer_stamp between :answer_stamp_begin and :answer_stamp_end ";
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000';
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999';
}
@@ -385,7 +380,7 @@
}
}
if (strlen($end_stamp_begin) > 0 && strlen($end_stamp_end) > 0) {
- $sql .= "and end_stamp BETWEEN :end_stamp_begin AND :end_stamp_end ";
+ $sql .= "and end_stamp between :end_stamp_begin and :end_stamp_end ";
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000';
$parameters['end_stamp_end'] = $end_stamp_end.':59.999';
}
@@ -501,7 +496,6 @@
}
}
$sql = str_replace(" ", " ", $sql);
- //$sql= str_replace("where and", "where", $sql);
$database = new database;
if ($archive_request == 'true') {
if ($_SESSION['cdr']['archive_database']['boolean'] == 'true') {
@@ -527,4 +521,4 @@
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
-?>
+?>
\ No newline at end of file
diff --git a/app/xml_cdr/xml_cdr_search.php b/app/xml_cdr/xml_cdr_search.php
index 23a7a63282..aa8c5b7dd3 100644
--- a/app/xml_cdr/xml_cdr_search.php
+++ b/app/xml_cdr/xml_cdr_search.php
@@ -61,7 +61,8 @@
//start the html form
if (strlen(check_str($_GET['redirect'])) > 0) {
echo "