Merge pull request #4218 from AlexanderDCrane/patch-466

Update call_broadcast.php
This commit is contained in:
FusionPBX 2019-05-28 14:54:48 -06:00 committed by GitHub
commit cbb0ea8293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 18 deletions

View File

@ -42,15 +42,33 @@
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
//get the http get variables and set them to php variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//validate order by
if (strlen($order_by) > 0) {
$order_by = preg_replace('#[^a-zA-Z0-9_\-]#', '', $order_by);
}
//validate the order
switch ($order) {
case 'asc':
break;
case 'desc':
break;
default:
$order = '';
}
//get the count //get the count
$sql = "select * from v_call_broadcasts "; $sql = "select count(*) from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = :domain_uuid ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare(check_sql($sql)); $database = new database;
$prep_statement->execute(); $parameters['domain_uuid'] = $domain_uuid;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $database->select($sql, $parameters, 'all');
$num_rows = count($result); $num_rows = $database->select($sql, $parameters, 'column');
unset ($prep_statement, $result, $sql);
//prepare the paging //prepare the paging
require_once "resources/paging.php"; require_once "resources/paging.php";
@ -63,14 +81,12 @@
//get the call call broadcasts //get the call call broadcasts
$sql = "select * from v_call_broadcasts "; $sql = "select * from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = :domain_uuid ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$sql .= " limit $rows_per_page offset $offset "; $sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql)); $database = new database;
$prep_statement->execute(); $parameters['domain_uuid'] = $domain_uuid;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $database->select($sql, $parameters, 'all');
$result_count = count($result);
unset ($prep_statement, $sql);
//set the row style //set the row style
$c = 0; $c = 0;
@ -80,10 +96,6 @@
//add the header //add the header
require_once "resources/header.php"; require_once "resources/header.php";
//get the http get variables and set them to php variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//show the content //show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'><tr>\n"; echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'><tr>\n";
echo "<td width='50%' nowrap='nowrap' align='left'><b>".$text['title']."</b></td>\n"; echo "<td width='50%' nowrap='nowrap' align='left'><b>".$text['title']."</b></td>\n";
@ -104,7 +116,7 @@
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
if ($result_count > 0) { if (is_array($result)) {
foreach($result as $row) { foreach($result as $row) {
$tr_link = (permission_exists('call_broadcast_edit')) ? "href='call_broadcast_edit.php?id=".$row['call_broadcast_uuid']."'" : null; $tr_link = (permission_exists('call_broadcast_edit')) ? "href='call_broadcast_edit.php?id=".$row['call_broadcast_uuid']."'" : null;
echo "<tr ".$tr_link.">\n"; echo "<tr ".$tr_link.">\n";