Minor mods to Access Controls, Bridges, Call Block and Call Broadcast lists and classes.
This commit is contained in:
parent
dc1ba5299c
commit
0c584db194
|
|
@ -77,6 +77,10 @@ if (!class_exists('access_controls')) {
|
|||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p->add('access_control_node_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
|
|
@ -84,6 +88,9 @@ if (!class_exists('access_controls')) {
|
|||
$database->delete($array);
|
||||
unset($array);
|
||||
|
||||
//revoke temporary permissions
|
||||
$p->delete('access_control_node_delete', 'temp');
|
||||
|
||||
//set message
|
||||
message::add($text['message-delete']);
|
||||
}
|
||||
|
|
@ -122,6 +129,8 @@ if (!class_exists('access_controls')) {
|
|||
|
||||
//create insert array from existing data
|
||||
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
|
||||
|
||||
//primary table
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where ".implode(' or ', $record_uuids)." ";
|
||||
$database = new database;
|
||||
|
|
@ -129,12 +138,15 @@ if (!class_exists('access_controls')) {
|
|||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
$y = 0;
|
||||
foreach ($rows as $x => $row) {
|
||||
//primary table
|
||||
$primary_uuid = uuid();
|
||||
|
||||
//copy data
|
||||
$array[$this->table][$x] = $row;
|
||||
|
||||
//overwrite
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $primary_uuid;
|
||||
$array[$this->table][$x]['access_control_name'] = $row['access_control_name'];
|
||||
$array[$this->table][$x]['access_control_default'] = $row['access_control_default'];
|
||||
$array[$this->table][$x]['access_control_description'] = trim($row['access_control_description'].' ('.$text['label-copy'].')');
|
||||
|
||||
//sub table
|
||||
$sql_2 = "select * from v_access_control_nodes where access_control_uuid = :access_control_uuid";
|
||||
$parameters_2['access_control_uuid'] = $row['access_control_uuid'];
|
||||
|
|
@ -142,13 +154,16 @@ if (!class_exists('access_controls')) {
|
|||
$rows_2 = $database->select($sql_2, $parameters_2, 'all');
|
||||
if (is_array($rows_2) && @sizeof($rows_2) != 0) {
|
||||
foreach ($rows_2 as $row_2) {
|
||||
|
||||
//copy data
|
||||
$array['access_control_nodes'][$y] = $row_2;
|
||||
|
||||
//overwrite
|
||||
$array['access_control_nodes'][$y]['access_control_node_uuid'] = uuid();
|
||||
$array['access_control_nodes'][$y]['access_control_uuid'] = $primary_uuid;
|
||||
$array['access_control_nodes'][$y]['node_type'] = $row_2['node_type'];
|
||||
$array['access_control_nodes'][$y]['node_cidr'] = $row_2['node_cidr'];
|
||||
$array['access_control_nodes'][$y]['node_domain'] = $row_2['node_domain'];
|
||||
$array['access_control_nodes'][$y]['node_description'] = $row_2['node_description'];
|
||||
|
||||
//increment
|
||||
$y++;
|
||||
|
||||
}
|
||||
}
|
||||
unset($sql_2, $parameters_2, $rows_2, $row_2);
|
||||
|
|
@ -160,6 +175,10 @@ if (!class_exists('access_controls')) {
|
|||
//save the changes and set the message
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p->add('access_control_node_add', 'temp');
|
||||
|
||||
//save the array
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
|
|
@ -167,6 +186,9 @@ if (!class_exists('access_controls')) {
|
|||
$database->save($array);
|
||||
unset($array);
|
||||
|
||||
//revoke temporary permissions
|
||||
$p->delete('access_control_node_add', 'temp');
|
||||
|
||||
//set message
|
||||
message::add($text['message-copy']);
|
||||
|
||||
|
|
|
|||
|
|
@ -199,13 +199,14 @@ if (!class_exists('bridges')) {
|
|||
$rows = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $x => $row) {
|
||||
$new_uuid = uuid();
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $new_uuid;
|
||||
$array[$this->table][$x]['domain_uuid'] = $row['domain_uuid'];
|
||||
$array[$this->table][$x]['bridge_name'] = $row['bridge_name'];
|
||||
$array[$this->table][$x]['bridge_destination'] = $row['bridge_destination'];
|
||||
$array[$this->table][$x]['bridge_enabled'] = $row['bridge_enabled'];
|
||||
|
||||
//copy data
|
||||
$array[$this->table][$x] = $row;
|
||||
|
||||
//overwrite
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = uuid();
|
||||
$array[$this->table][$x]['bridge_description'] = trim($row['bridge_description'].' ('.$text['label-copy'].')');
|
||||
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
|
|
|
|||
|
|
@ -199,16 +199,14 @@ if (!class_exists('call_block')) {
|
|||
$rows = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $x => $row) {
|
||||
$new_uuid = uuid();
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $new_uuid;
|
||||
$array[$this->table][$x]['domain_uuid'] = $row['domain_uuid'];
|
||||
$array[$this->table][$x]['call_block_name'] = $row['call_block_name'];
|
||||
$array[$this->table][$x]['call_block_number'] = $row['call_block_number'];
|
||||
$array[$this->table][$x]['call_block_count'] = 0;
|
||||
$array[$this->table][$x]['call_block_action'] = $row['call_block_action'];
|
||||
$array[$this->table][$x]['date_added'] = $row['date_added'];
|
||||
$array[$this->table][$x]['call_block_enabled'] = $row['call_block_enabled'];
|
||||
|
||||
//copy data
|
||||
$array[$this->table][$x] = $row;
|
||||
|
||||
//overwrite
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = uuid();
|
||||
$array[$this->table][$x]['call_block_description'] = trim($row['call_block_description'].' ('.$text['label-copy'].')');
|
||||
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
|
|
|
|||
|
|
@ -128,21 +128,14 @@ if (!class_exists('call_broadcast')) {
|
|||
$rows = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $x => $row) {
|
||||
$new_uuid = uuid();
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $new_uuid;
|
||||
$array[$this->table][$x]['domain_uuid'] = $row['domain_uuid'];
|
||||
$array[$this->table][$x]['broadcast_name'] = $row['broadcast_name'];
|
||||
|
||||
//copy data
|
||||
$array[$this->table][$x] = $row;
|
||||
|
||||
//overwrite
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = uuid();
|
||||
$array[$this->table][$x]['broadcast_description'] = trim($row['broadcast_description'].' ('.$text['label-copy'].')');
|
||||
$array[$this->table][$x]['broadcast_timeout'] = $row['broadcast_timeout'];
|
||||
$array[$this->table][$x]['broadcast_concurrent_limit'] = $row['broadcast_concurrent_limit'];
|
||||
$array[$this->table][$x]['recording_uuid'] = $row['recording_uuid'];
|
||||
$array[$this->table][$x]['broadcast_caller_id_name'] = $row['broadcast_caller_id_name'];
|
||||
$array[$this->table][$x]['broadcast_caller_id_number'] = $row['broadcast_caller_id_number'];
|
||||
$array[$this->table][$x]['broadcast_destination_type'] = $row['broadcast_destination_type'];
|
||||
$array[$this->table][$x]['broadcast_phone_numbers'] = $row['broadcast_phone_numbers'];
|
||||
$array[$this->table][$x]['broadcast_avmd'] = $row['broadcast_avmd'];
|
||||
$array[$this->table][$x]['broadcast_destination_data'] = $row['broadcast_destination_data'];
|
||||
$array[$this->table][$x]['broadcast_accountcode'] = $row['broadcast_accountcode'];
|
||||
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
|
|
|
|||
Loading…
Reference in New Issue