Database class integration.
This commit is contained in:
parent
8882502cc6
commit
e18f1ef537
|
|
@ -30,10 +30,7 @@
|
||||||
require_once "resources/check_auth.php";
|
require_once "resources/check_auth.php";
|
||||||
|
|
||||||
//check permissions
|
//check permissions
|
||||||
if (permission_exists('call_broadcast_view')) {
|
if (!permission_exists('call_broadcast_view')) {
|
||||||
//access granted
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "access denied";
|
echo "access denied";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
@ -46,29 +43,13 @@
|
||||||
$order_by = $_GET["order_by"];
|
$order_by = $_GET["order_by"];
|
||||||
$order = $_GET["order"];
|
$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 count(*) 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 "; }
|
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$parameters['domain_uuid'] = $domain_uuid;
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
$result = $database->select($sql, $parameters, 'all');
|
|
||||||
$num_rows = $database->select($sql, $parameters, 'column');
|
$num_rows = $database->select($sql, $parameters, 'column');
|
||||||
|
unset($sql, $parameters);
|
||||||
|
|
||||||
//prepare the paging
|
//prepare the paging
|
||||||
require_once "resources/paging.php";
|
require_once "resources/paging.php";
|
||||||
|
|
@ -82,10 +63,10 @@
|
||||||
//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 "; }
|
$sql .= order_by($order_by, $order);
|
||||||
$sql .= " limit $rows_per_page offset $offset ";
|
$sql .= limit_offset($rows_per_page, $offset);
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$parameters['domain_uuid'] = $domain_uuid;
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
$result = $database->select($sql, $parameters, 'all');
|
$result = $database->select($sql, $parameters, 'all');
|
||||||
|
|
||||||
//set the row style
|
//set the row style
|
||||||
|
|
|
||||||
|
|
@ -38,23 +38,22 @@ else {
|
||||||
$language = new text;
|
$language = new text;
|
||||||
$text = $language->get();
|
$text = $language->get();
|
||||||
|
|
||||||
//get the id
|
|
||||||
if (count($_GET)>0) {
|
|
||||||
$id = $_GET["id"];
|
|
||||||
}
|
|
||||||
|
|
||||||
//delete the call broadcast entry
|
//delete the call broadcast entry
|
||||||
if (strlen($id)>0) {
|
if (is_uuid($_GET["id"])) {
|
||||||
$sql = "delete from v_call_broadcasts ";
|
$call_broadcast_uuid = $_GET['id'];
|
||||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
$array['call_broadcasts'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
$sql .= "and call_broadcast_uuid = '$id' ";
|
$array['call_broadcasts'][0][''] = $call_broadcast_uuid;
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
|
||||||
$prep_statement->execute();
|
$database = new database;
|
||||||
unset($sql);
|
$database->app_name = 'call_broadcasts';
|
||||||
|
$database->app_uuid = 'efc11f6b-ed73-9955-4d4d-3a1bed75a056';
|
||||||
|
$database->delete($array);
|
||||||
|
$response = $database->message;
|
||||||
|
unset($array);
|
||||||
|
|
||||||
|
message::add($text['message-delete']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message::add($text['confirm-delete']);
|
|
||||||
header("Location: call_broadcast.php");
|
header("Location: call_broadcast.php");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,11 +69,13 @@ function cmd_async($cmd) {
|
||||||
|
|
||||||
//get the call broadcast details from the database
|
//get the call broadcast details from the database
|
||||||
$sql = "select * from v_call_broadcasts ";
|
$sql = "select * from v_call_broadcasts ";
|
||||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
$sql .= "where domain_uuid = :domain_uuid ";
|
||||||
$sql .= "and call_broadcast_uuid = '$call_broadcast_uuid' ";
|
$sql .= "and call_broadcast_uuid = :call_broadcast_uuid ";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
$prep_statement->execute();
|
$parameters['call_broadcast_uuid'] = $call_broadcast_uuid;
|
||||||
while($row = $prep_statement->fetch()) {
|
$database = new database;
|
||||||
|
$row = $database->select($sql, $parameters, 'row');
|
||||||
|
if (is_array($row) && sizeof($row) != 0) {
|
||||||
$broadcast_name = $row["broadcast_name"];
|
$broadcast_name = $row["broadcast_name"];
|
||||||
$broadcast_description = $row["broadcast_description"];
|
$broadcast_description = $row["broadcast_description"];
|
||||||
$broadcast_timeout = $row["broadcast_timeout"];
|
$broadcast_timeout = $row["broadcast_timeout"];
|
||||||
|
|
@ -95,9 +97,8 @@ function cmd_async($cmd) {
|
||||||
// $broadcast_destination_application = $broadcast_destination_array[0];
|
// $broadcast_destination_application = $broadcast_destination_array[0];
|
||||||
// $broadcast_destination_data = $broadcast_destination_array[1];
|
// $broadcast_destination_data = $broadcast_destination_array[1];
|
||||||
//}
|
//}
|
||||||
break; //limit to 1 row
|
|
||||||
}
|
}
|
||||||
unset ($prep_statement);
|
unset($sql, $parameters, $row);
|
||||||
|
|
||||||
if (strlen($broadcast_caller_id_name) == 0) {
|
if (strlen($broadcast_caller_id_name) == 0) {
|
||||||
$broadcast_caller_id_name = "anonymous";
|
$broadcast_caller_id_name = "anonymous";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue