List Views: Simplify action handling.

This commit is contained in:
Nate 2019-11-30 11:12:41 -07:00
parent b993ab8197
commit bfb17507f1
30 changed files with 590 additions and 720 deletions

View File

@ -46,28 +46,26 @@
$access_controls = $_POST['access_controls']; $access_controls = $_POST['access_controls'];
} }
//copy the access controls //process posted data by action
if (permission_exists('access_control_add')) { if ($action != '' && is_array($access_controls) && @sizeof($access_controls) != 0) {
if ($action == 'copy' && is_array($access_controls) && @sizeof($access_controls) != 0) { $obj = new access_controls;
//copy
$obj = new access_controls;
$obj->copy($access_controls);
//redirect
header('Location: access_controls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the access controls switch ($action) {
if (permission_exists('access_control_delete')) { case 'copy':
if ($action == 'delete' && is_array($access_controls) && @sizeof($access_controls) != 0) { if (permission_exists('access_control_add')) {
//delete $obj->copy($access_controls);
$obj = new access_controls; }
$obj->delete($access_controls); break;
//redirect
header('Location: access_controls.php'.($search != '' ? '?search='.urlencode($search) : null)); case 'delete':
exit; if (permission_exists('access_control_delete')) {
$obj->delete($access_controls);
}
break;
} }
header('Location: access_controls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get variables used to control the order //get variables used to control the order

View File

@ -50,40 +50,32 @@
$bridges = $_POST['bridges']; $bridges = $_POST['bridges'];
} }
//copy the bridges //process posted data by action
if (permission_exists('bridge_add')) { if ($action != '' && is_array($bridges) && @sizeof($bridges) != 0) {
if ($action == 'copy' && is_array($bridges) && @sizeof($bridges) != 0) { $obj = new bridges;
//copy
$obj = new bridges;
$obj->copy($bridges);
//redirect
header('Location: bridges.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the bridges switch ($action) {
if (permission_exists('bridge_edit')) { case 'copy':
if ($action == 'toggle' && is_array($bridges) && @sizeof($bridges) != 0) { if (permission_exists('bridge_add')) {
//toggle $obj->copy($bridges);
$obj = new bridges; }
$obj->toggle($bridges); break;
//redirect
header('Location: bridges.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the bridges case 'toggle':
if (permission_exists('bridge_delete')) { if (permission_exists('bridge_edit')) {
if ($action == 'delete' && is_array($bridges) && @sizeof($bridges) != 0) { $obj->toggle($bridges);
//delete }
$obj = new bridges; break;
$obj->delete($bridges);
//redirect case 'delete':
header('Location: bridges.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('bridge_delete')) {
exit; $obj->delete($bridges);
}
break;
} }
header('Location: bridges.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by //get order and order by
@ -121,10 +113,8 @@
//prepare to page the results //prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".$search; $param = $search ? "&search=".$search : null;
if ($_GET['show'] == "all" && permission_exists('bridge_all')) { $param = ($_GET['show'] == "all" && permission_exists('bridge_all')) ? "&show=all" : null;
$param .= "&show=all";
}
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0; $page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);

View File

@ -47,40 +47,32 @@
$call_blocks = $_POST['call_blocks']; $call_blocks = $_POST['call_blocks'];
} }
//copy the call blocks //process posted data by action
if (permission_exists('call_block_add')) { if ($action != '' && is_array($call_blocks) && @sizeof($call_blocks) != 0) {
if ($action == 'copy' && is_array($call_blocks) && @sizeof($call_blocks) != 0) { $obj = new call_block;
//copy
$obj = new call_block;
$obj->copy($call_blocks);
//redirect
header('Location: call_block.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the call blocks switch ($action) {
if (permission_exists('call_block_edit')) { case 'copy':
if ($action == 'toggle' && is_array($call_blocks) && @sizeof($call_blocks) != 0) { if (permission_exists('call_block_add')) {
//toggle $obj->copy($call_blocks);
$obj = new call_block; }
$obj->toggle($call_blocks); break;
//redirect
header('Location: call_block.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the call blocks case 'toggle':
if (permission_exists('call_block_delete')) { if (permission_exists('call_block_edit')) {
if ($action == 'delete' && is_array($call_blocks) && @sizeof($call_blocks) != 0) { $obj->toggle($call_blocks);
//delete }
$obj = new call_block; break;
$obj->delete($call_blocks);
//redirect case 'delete':
header('Location: call_block.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('call_block_delete')) {
exit; $obj->delete($call_blocks);
}
break;
} }
header('Location: call_block.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get variables used to control the order //get variables used to control the order

View File

@ -46,28 +46,26 @@
$call_broadcasts = $_POST['call_broadcasts']; $call_broadcasts = $_POST['call_broadcasts'];
} }
//copy the call broadcasts //process posted data by action
if (permission_exists('call_broadcast_add')) { if ($action != '' && is_array($call_broadcasts) && @sizeof($call_broadcasts) != 0) {
if ($action == 'copy' && is_array($call_broadcasts) && @sizeof($call_broadcasts) != 0) { $obj = new call_broadcast;
//copy
$obj = new call_broadcast;
$obj->copy($call_broadcasts);
//redirect
header('Location: call_broadcast.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the call broadcasts switch ($action) {
if (permission_exists('call_broadcast_delete')) { case 'copy':
if ($action == 'delete' && is_array($call_broadcasts) && @sizeof($call_broadcasts) != 0) { if (permission_exists('call_broadcast_add')) {
//delete $obj->copy($call_broadcasts);
$obj = new call_broadcast; }
$obj->delete($call_broadcasts); break;
//redirect
header('Location: call_broadcast.php'.($search != '' ? '?search='.urlencode($search) : null)); case 'delete':
exit; if (permission_exists('call_broadcast_delete')) {
$obj->delete($call_broadcasts);
}
break;
} }
header('Location: call_broadcast.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get the http get variables and set them to php variables //get the http get variables and set them to php variables

View File

@ -69,8 +69,7 @@
//paging the records //paging the records
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".$search; $param = "&search=".$search;
$page = $_GET['page']; $page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;

View File

@ -50,28 +50,26 @@
$call_center_agents = $_POST['call_center_agents']; $call_center_agents = $_POST['call_center_agents'];
} }
//copy the call center agents //process posted data by action
if (permission_exists('call_center_agent_add')) { if ($action != '' && is_array($call_center_agents) && @sizeof($call_center_agents) != 0) {
if ($action == 'copy' && is_array($call_center_agents) && @sizeof($call_center_agents) != 0) { $obj = new call_center;
//copy
$obj = new call_center;
$obj->copy_agents($call_center_agents);
//redirect
header('Location: call_center_agents.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the call center agents switch ($action) {
if (permission_exists('call_center_agent_delete')) { case 'copy':
if ($action == 'delete' && is_array($call_center_agents) && @sizeof($call_center_agents) != 0) { if (permission_exists('call_center_agent_add')) {
//delete $obj->copy_agents($call_center_agents);
$obj = new call_center; }
$obj->delete_agents($call_center_agents); break;
//redirect
header('Location: call_center_agents.php'.($search != '' ? '?search='.urlencode($search) : null)); case 'delete':
exit; if (permission_exists('call_center_agent_delete')) {
$obj->delete_agents($call_center_agents);
}
break;
} }
header('Location: call_center_agents.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get http variables and set them to php variables //get http variables and set them to php variables

View File

@ -50,28 +50,26 @@
$call_center_queues = $_POST['call_center_queues']; $call_center_queues = $_POST['call_center_queues'];
} }
//copy the call center queues //process posted data by action
if (permission_exists('call_center_queue_add')) { if ($action != '' && is_array($call_center_queues) && @sizeof($call_center_queues) != 0) {
if ($action == 'copy' && is_array($call_center_queues) && @sizeof($call_center_queues) != 0) { $obj = new call_center;
//copy
$obj = new call_center;
$obj->copy_queues($call_center_queues);
//redirect
header('Location: call_center_queues.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the call center queues switch ($action) {
if (permission_exists('call_center_queue_delete')) { case 'copy':
if ($action == 'delete' && is_array($call_center_queues) && @sizeof($call_center_queues) != 0) { if (permission_exists('call_center_queue_add')) {
//delete $obj->copy_queues($call_center_queues);
$obj = new call_center; }
$obj->delete_queues($call_center_queues); break;
//redirect
header('Location: call_center_queues.php'.($search != '' ? '?search='.urlencode($search) : null)); case 'delete':
exit; if (permission_exists('call_center_queue_delete')) {
$obj->delete_queues($call_center_queues);
}
break;
} }
header('Location: call_center_queues.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get http variables and set as php variables //get http variables and set as php variables

View File

@ -50,40 +50,32 @@
$call_flows = $_POST['call_flows']; $call_flows = $_POST['call_flows'];
} }
//copy the call flows //process posted data by action
if (permission_exists('call_flow_add')) { if ($action != '' && is_array($call_flows) && @sizeof($call_flows) != 0) {
if ($action == 'copy' && is_array($call_flows) && @sizeof($call_flows) != 0) { $obj = new call_flows;
//copy
$obj = new call_flows;
$obj->copy($call_flows);
//redirect
header('Location: call_flows.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the call flows switch ($action) {
if (permission_exists('call_flow_edit')) { case 'copy':
if ($action == 'toggle' && is_array($call_flows) && @sizeof($call_flows) != 0) { if (permission_exists('call_flow_add')) {
//toggle $obj->copy($call_flows);
$obj = new call_flows; }
$obj->toggle($call_flows); break;
//redirect
header('Location: call_flows.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the call flows case 'toggle':
if (permission_exists('call_flow_delete')) { if (permission_exists('call_flow_edit')) {
if ($action == 'delete' && is_array($call_flows) && @sizeof($call_flows) != 0) { $obj->toggle($call_flows);
//delete }
$obj = new call_flows; break;
$obj->delete($call_flows);
//redirect case 'delete':
header('Location: call_flows.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('call_flow_delete')) {
exit; $obj->delete($call_flows);
}
break;
} }
header('Location: call_flows.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get variables used to control the order //get variables used to control the order

View File

@ -50,40 +50,33 @@
$extensions = $_POST['extensions']; $extensions = $_POST['extensions'];
} }
//toggle the call forward feature //process posted data by action
if (permission_exists('call_forward')) { if ($action != '' && is_array($extensions) && @sizeof($extensions) != 0) {
if ($action == 'toggle_call_forward' && is_array($extensions) && @sizeof($extensions) != 0) { switch ($action) {
//toggle case 'toggle_call_forward':
$obj = new call_forward; if (permission_exists('call_forward')) {
$obj->toggle($extensions); $obj = new call_forward;
//redirect $obj->toggle($extensions);
header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null)); }
exit; break;
}
}
//toggle the follow me feature case 'toggle_follow_me':
if (permission_exists('follow_me')) { if (permission_exists('follow_me')) {
if ($action == 'toggle_follow_me' && is_array($extensions) && @sizeof($extensions) != 0) { $obj = new follow_me;
//toggle $obj->toggle($extensions);
$obj = new follow_me; }
$obj->toggle($extensions); break;
//redirect
header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the do not disturb feature case 'toggle_do_not_disturb':
if (permission_exists('do_not_disturb')) { if (permission_exists('do_not_disturb')) {
if ($action == 'toggle_do_not_disturb' && is_array($extensions) && @sizeof($extensions) != 0) { $obj = new do_not_disturb;
//toggle $obj->toggle($extensions);
$obj = new do_not_disturb; }
$obj->toggle($extensions); break;
//redirect
header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by //get order and order by

View File

@ -51,40 +51,32 @@
} }
/* /*
//copy the conference centers //process posted data by action
if (permission_exists('conference_center_add')) { if ($action != '' && is_array($conference_centers) && @sizeof($conference_centers) != 0) {
if ($action == 'copy' && is_array($conference_centers) && @sizeof($conference_centers) != 0) { $obj = new conference_centers;
//copy
$obj = new conference_centers;
$obj->copy_conference_centers($conference_centers);
//redirect
header('Location: conference_centers.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the conference centers switch ($action) {
if (permission_exists('conference_center_edit')) { case 'copy':
if ($action == 'toggle' && is_array($conference_centers) && @sizeof($conference_centers) != 0) { if (permission_exists('conference_center_add')) {
//toggle $obj->copy($conference_centers);
$obj = new conference_centers; }
$obj->toggle_conference_centers($conference_centers); break;
//redirect
header('Location: conference_centers.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the conference centers case 'toggle':
if (permission_exists('conference_center_delete')) { if (permission_exists('conference_center_edit')) {
if ($action == 'delete' && is_array($conference_centers) && @sizeof($conference_centers) != 0) { $obj->toggle($conference_centers);
//delete }
$obj = new conference_centers; break;
$obj->delete_conference_centers($conference_centers);
//redirect case 'delete':
header('Location: conference_centers.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('conference_center_delete')) {
exit; $obj->delete($conference_centers);
}
break;
} }
header('Location: conference_centers.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
*/ */

View File

@ -50,40 +50,32 @@
$conferences = $_POST['conferences']; $conferences = $_POST['conferences'];
} }
//copy the conferences //process posted data by action
if (permission_exists('conference_add')) { if ($action != '' && is_array($conferences) && @sizeof($conferences) != 0) {
if ($action == 'copy' && is_array($conferences) && @sizeof($conferences) != 0) { $obj = new conferences;
//copy
$obj = new conferences;
$obj->copy($conferences);
//redirect
header('Location: conferences.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the conferences switch ($action) {
if (permission_exists('conference_edit')) { case 'copy':
if ($action == 'toggle' && is_array($conferences) && @sizeof($conferences) != 0) { if (permission_exists('conference_add')) {
//toggle $obj->copy($conferences);
$obj = new conferences; }
$obj->toggle($conferences); break;
//redirect
header('Location: conferences.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the conferences case 'toggle':
if (permission_exists('conference_delete')) { if (permission_exists('conference_edit')) {
if ($action == 'delete' && is_array($conferences) && @sizeof($conferences) != 0) { $obj->toggle($conferences);
//delete }
$obj = new conferences; break;
$obj->delete($conferences);
//redirect case 'delete':
header('Location: conferences.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('conference_delete')) {
exit; $obj->delete($conferences);
}
break;
} }
header('Location: conferences.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get variables used to control the order //get variables used to control the order

View File

@ -50,16 +50,20 @@
$contacts = $_POST['contacts']; $contacts = $_POST['contacts'];
} }
//delete the contacts //process posted data by action
if (permission_exists('contact_delete')) { if ($action != '' && is_array($contacts) && @sizeof($contacts) != 0) {
if ($action == 'delete' && is_array($contacts) && @sizeof($contacts) != 0) { $obj = new contacts;
//delete
$obj = new contacts; switch ($action) {
$obj->delete($contacts); case 'delete':
//redirect if (permission_exists('contact_delete')) {
header('Location: contacts.php'.($search != '' ? '?search='.urlencode($search) : null)); $obj->delete($contacts);
exit; }
break;
} }
header('Location: contacts.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//retrieve current user's assigned groups (uuids) //retrieve current user's assigned groups (uuids)

View File

@ -50,28 +50,26 @@
$destinations = $_POST['destinations']; $destinations = $_POST['destinations'];
} }
//toggle the destinations //process posted data by action
if (permission_exists('destination_edit')) { if ($action != '' && is_array($destinations) && @sizeof($destinations) != 0) {
if ($action == 'toggle' && is_array($destinations) && @sizeof($destinations) != 0) { $obj = new destinations;
//toggle
$obj = new destinations;
$obj->toggle($destinations);
//redirect
header('Location: destinations.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the destinations switch ($action) {
if (permission_exists('destination_delete')) { case 'toggle':
if ($action == 'delete' && is_array($destinations) && @sizeof($destinations) != 0) { if (permission_exists('destination_edit')) {
//delete $obj->toggle($destinations);
$obj = new destinations; }
$obj->delete($destinations); break;
//redirect
header('Location: destinations.php'.($search != '' ? '?search='.urlencode($search) : null)); case 'delete':
exit; if (permission_exists('destination_delete')) {
$obj->delete($destinations);
}
break;
} }
header('Location: destinations.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get the destination select list //get the destination select list

View File

@ -49,40 +49,32 @@
$profiles = $_POST['profiles']; $profiles = $_POST['profiles'];
} }
//copy the device profiles //process posted data by action
if (permission_exists('device_profile_add')) { if ($action != '' && is_array($profiles) && @sizeof($profiles) != 0) {
if ($action == 'copy' && is_array($profiles) && @sizeof($profiles) != 0) { $obj = new device;
//copy
$obj = new device;
$obj->copy_profiles($profiles);
//redirect
header('Location: device_profiles.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the device profiles switch ($action) {
if (permission_exists('device_profile_edit')) { case 'copy':
if ($action == 'toggle' && is_array($profiles) && @sizeof($profiles) != 0) { if (permission_exists('device_profile_add')) {
//toggle $obj->copy_profiles($profiles);
$obj = new device; }
$obj->toggle_profiles($profiles); break;
//redirect
header('Location: device_profiles.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the device profiles case 'toggle':
if (permission_exists('device_profile_delete')) { if (permission_exists('device_profile_edit')) {
if ($action == 'delete' && is_array($profiles) && @sizeof($profiles) != 0) { $obj->toggle_profiles($profiles);
//delete }
$obj = new device; break;
$obj->delete_profiles($profiles);
//redirect case 'delete':
header('Location: device_profiles.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('device_profile_delete')) {
exit; $obj->delete_profiles($profiles);
}
break;
} }
header('Location: device_profiles.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get variables used to control the order //get variables used to control the order

View File

@ -50,28 +50,26 @@
$vendors = $_POST['vendors']; $vendors = $_POST['vendors'];
} }
//toggle the device vendors //process posted data by action
if (permission_exists('device_vendor_edit')) { if ($action != '' && is_array($vendors) && @sizeof($vendors) != 0) {
if ($action == 'toggle' && is_array($vendors) && @sizeof($vendors) != 0) { $obj = new device;
//toggle
$obj = new device;
$obj->toggle_vendors($vendors);
//redirect
header('Location: device_vendors.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the device vendors switch ($action) {
if (permission_exists('device_vendor_delete')) { case 'toggle':
if ($action == 'delete' && is_array($vendors) && @sizeof($vendors) != 0) { if (permission_exists('device_vendor_edit')) {
//delete $obj->toggle_vendors($vendors);
$obj = new device; }
$obj->delete_vendors($vendors); break;
//redirect
header('Location: device_vendors.php'.($search != '' ? '?search='.urlencode($search) : null)); case 'delete':
exit; if (permission_exists('device_vendor_delete')) {
$obj->delete_vendors($vendors);
}
break;
} }
header('Location: device_vendors.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get variables used to control the order //get variables used to control the order

View File

@ -52,28 +52,26 @@
//get the search //get the search
$search = strtolower($_REQUEST["search"]); $search = strtolower($_REQUEST["search"]);
//toggle the devices //process posted data by action
if (permission_exists('device_edit')) { if ($action != '' && is_array($devices) && @sizeof($devices) != 0) {
if ($action == 'toggle' && is_array($devices) && @sizeof($devices) != 0) { $obj = new device;
//toggle
$obj = new device;
$obj->toggle($devices);
//redirect
header('Location: devices.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the devices switch ($action) {
if (permission_exists('device_delete')) { case 'toggle':
if ($action == 'delete' && is_array($devices) && @sizeof($devices) != 0) { if (permission_exists('device_edit')) {
//delete $obj->toggle($devices);
$obj = new device; }
$obj->delete($devices); break;
//redirect
header('Location: devices.php'.($search != '' ? '?search='.urlencode($search) : null)); case 'delete':
exit; if (permission_exists('device_delete')) {
$obj->delete($devices);
}
break;
} }
header('Location: devices.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by and sanatize the values //get order and order by and sanatize the values

View File

@ -57,8 +57,8 @@
$app_uuid = $_REQUEST["app_uuid"]; $app_uuid = $_REQUEST["app_uuid"];
} }
//process action //process posted data by action
if ($action && is_array($dialplans) && @sizeof($dialplans) != 0) { if ($action != '' && is_array($dialplans) && @sizeof($dialplans) != 0) {
//define redirect parameters and url //define redirect parameters and url
if (is_uuid($app_uuid)) { $params[] = "app_uuid=".urlencode($app_uuid); } if (is_uuid($app_uuid)) { $params[] = "app_uuid=".urlencode($app_uuid); }
@ -68,34 +68,35 @@
$redirect_url = 'dialplans.php'.($params ? '?'.implode('&', $params) : null); $redirect_url = 'dialplans.php'.($params ? '?'.implode('&', $params) : null);
unset($params); unset($params);
//copy the dialplans //create object, set app_uuid and redirect
if ($action == 'copy') { $obj = new dialplan;
$obj = new dialplan; $obj->app_uuid = $app_uuid;
$obj->app_uuid = $app_uuid; $obj->list_page = $redirect_url;
$obj->list_page = $redirect_url;
$obj->copy($dialplans);
}
//toggle the dialplans //process action
if ($action == 'toggle') { switch ($action) {
$obj = new dialplan; case 'copy':
$obj->app_uuid = $app_uuid; if (permission_exists('dialplan_add')) {
$obj->list_page = $redirect_url; $obj->copy($dialplans);
$obj->toggle($dialplans); }
} break;
//delete the dialplans case 'toggle':
if ($action == 'delete') { if (permission_exists('dialplan_edit')) {
$obj = new dialplan; $obj->toggle($dialplans);
$obj->app_uuid = $app_uuid; }
$obj->list_page = $redirect_url; break;
$obj->delete($dialplans);
case 'delete':
if (permission_exists('dialplan_delete')) {
$obj->delete($dialplans);
}
break;
} }
//redirect //redirect
header('Location: '.$redirect_url); header('Location: '.$redirect_url);
exit; exit;
} }
//get order and order by and sanatize the values //get order and order by and sanatize the values

View File

@ -41,42 +41,34 @@
$emails = $_POST['emails']; $emails = $_POST['emails'];
} }
//download the emails //process posted data by action
if (permission_exists('email_log_download')) { if ($action != '' && is_array($emails) && @sizeof($emails) != 0) {
if ($action == 'download' && is_array($emails) && @sizeof($emails) != 0) { $obj = new email_logs;
//download
$obj = new email_logs;
$obj->download($emails);
//set message (download failed)
message::add($text['message-download_failed'],'negative',7000);
//redirect
header('Location: email_logs.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//resend the emails switch ($action) {
if (permission_exists('email_log_resend')) { case 'download':
if ($action == 'resend' && is_array($emails) && @sizeof($emails) != 0) { if (permission_exists('email_log_download')) {
//resend $obj->download($emails);
$obj = new email_logs; //download failed, set message
$obj->resend($emails); message::add($text['message-download_failed'],'negative',7000);
//exit }
header('Location: email_logs.php'.($search != '' ? '?search='.urlencode($search) : null)); break;
exit;
}
}
//delete the emails case 'resend':
if (permission_exists('email_log_delete')) { if (permission_exists('email_log_resend')) {
if ($action == 'delete' && is_array($emails) && @sizeof($emails) != 0) { $obj->resend($emails);
//delete }
$obj = new email_logs; break;
$obj->delete($emails);
//redirect case 'delete':
header('Location: email_logs.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('email_log_delete')) {
exit; $obj->delete($emails);
}
break;
} }
header('Location: email_logs.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by and sanatize the values //get order and order by and sanatize the values

View File

@ -47,40 +47,32 @@
$email_templates = $_POST['email_templates']; $email_templates = $_POST['email_templates'];
} }
//copy the email_templates //process posted data by action
if (permission_exists('email_template_add')) { if ($action != '' && is_array($email_templates) && @sizeof($email_templates) != 0) {
if ($action == 'copy' && is_array($email_templates) && @sizeof($email_templates) != 0) { $obj = new email_templates;
//copy
$obj = new email_templates;
$obj->copy($email_templates);
//redirect
header('Location: email_templates.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the email_templates switch ($action) {
if (permission_exists('email_template_edit')) { case 'copy':
if ($action == 'toggle' && is_array($email_templates) && @sizeof($email_templates) != 0) { if (permission_exists('email_template_add')) {
//toggle $obj->copy($email_templates);
$obj = new email_templates; }
$obj->toggle($email_templates); break;
//redirect
header('Location: email_templates.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the email_templates case 'toggle':
if (permission_exists('email_template_delete')) { if (permission_exists('email_template_edit')) {
if ($action == 'delete' && is_array($email_templates) && @sizeof($email_templates) != 0) { $obj->toggle($email_templates);
//delete }
$obj = new email_templates; break;
$obj->delete($email_templates);
//redirect case 'delete':
header('Location: email_templates.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('email_template_delete')) {
exit; $obj->delete($email_templates);
}
break;
} }
header('Location: email_templates.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get variables used to control the order //get variables used to control the order

View File

@ -25,7 +25,7 @@
*/ */
//includes //includes
include "root.php"; include_once "root.php";
require_once "resources/require.php"; require_once "resources/require.php";
require_once "resources/check_auth.php"; require_once "resources/check_auth.php";
require_once "resources/paging.php"; require_once "resources/paging.php";
@ -50,28 +50,26 @@
$extensions = $_POST['extensions']; $extensions = $_POST['extensions'];
} }
//toggle the extensions //process posted data by action
if (permission_exists('extension_enabled')) { if ($action != '' && is_array($extensions) && @sizeof($extensions) != 0) {
if ($action == 'toggle' && is_array($extensions) && @sizeof($extensions) != 0) { $obj = new extension;
//toggle
$obj = new extension;
$obj->toggle($extensions);
//redirect
header('Location: extensions.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the extensions switch ($action) {
if (permission_exists('extension_delete')) { case 'toggle':
if ($action == 'delete' && is_array($extensions) && @sizeof($extensions) != 0) { if (permission_exists('extension_enabled')) {
//delete $obj->toggle($extensions);
$obj = new extension; }
$obj->delete($extensions); break;
//redirect
header('Location: extensions.php'.($search != '' ? '?search='.urlencode($search) : null)); case 'delete':
exit; if (permission_exists('extension_delete')) {
$obj->delete($extensions);
}
break;
} }
header('Location: extensions.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by //get order and order by

View File

@ -50,28 +50,26 @@
$fax_servers = $_POST['fax_servers']; $fax_servers = $_POST['fax_servers'];
} }
//copy the fax servers //process posted data by action
if (permission_exists('fax_extension_copy')) { if ($action != '' && is_array($fax_servers) && @sizeof($fax_servers) != 0) {
if ($action == 'copy' && is_array($fax_servers) && @sizeof($fax_servers) != 0) { $obj = new fax;
//copy
$obj = new fax;
$obj->copy($fax_servers);
//redirect
header('Location: fax.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the fax servers switch ($action) {
if (permission_exists('fax_extension_delete')) { case 'copy':
if ($action == 'delete' && is_array($fax_servers) && @sizeof($fax_servers) != 0) { if (permission_exists('fax_extension_copy')) {
//delete $obj->copy($fax_servers);
$obj = new fax; }
$obj->delete($fax_servers); break;
//redirect
header('Location: fax.php'.($search != '' ? '?search='.urlencode($search) : null)); case 'delete':
exit; if (permission_exists('fax_extension_delete')) {
$obj->delete($fax_servers);
}
break;
} }
header('Location: fax.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by //get order and order by

View File

@ -50,40 +50,32 @@
$gateways = $_POST['gateways']; $gateways = $_POST['gateways'];
} }
//copy the gateways //process posted data by action
if (permission_exists('gateway_add')) { if ($action != '' && is_array($gateways) && @sizeof($gateways) != 0) {
if ($action == 'copy' && is_array($gateways) && @sizeof($gateways) != 0) { $obj = new gateways;
//copy
$obj = new gateways;
$obj->copy($gateways);
//redirect
header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the gateways switch ($action) {
if (permission_exists('gateway_edit')) { case 'copy':
if ($action == 'toggle' && is_array($gateways) && @sizeof($gateways) != 0) { if (permission_exists('gateway_add')) {
//toggle $obj->copy($gateways);
$obj = new gateways; }
$obj->toggle($gateways); break;
//redirect
header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the gateways case 'toggle':
if (permission_exists('gateway_delete')) { if (permission_exists('gateway_edit')) {
if ($action == 'delete' && is_array($gateways) && @sizeof($gateways) != 0) { $obj->toggle($gateways);
//delete }
$obj = new gateways; break;
$obj->delete($gateways);
//redirect case 'delete':
header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('gateway_delete')) {
exit; $obj->delete($gateways);
}
break;
} }
header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//connect to event socket //connect to event socket

View File

@ -50,40 +50,32 @@
$ivr_menus = $_POST['ivr_menus']; $ivr_menus = $_POST['ivr_menus'];
} }
//copy the ivr menus //process posted data by action
if (permission_exists('ivr_menu_add')) { if ($action != '' && is_array($ivr_menus) && @sizeof($ivr_menus) != 0) {
if ($action == 'copy' && is_array($ivr_menus) && @sizeof($ivr_menus) != 0) { $obj = new ivr_menu;
//copy
$obj = new ivr_menu;
$obj->copy($ivr_menus);
//redirect
header('Location: ivr_menus.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the ivr menus switch ($action) {
if (permission_exists('ivr_menu_edit')) { case 'copy':
if ($action == 'toggle' && is_array($ivr_menus) && @sizeof($ivr_menus) != 0) { if (permission_exists('ivr_menu_add')) {
//toggle $obj->copy($ivr_menus);
$obj = new ivr_menu; }
$obj->toggle($ivr_menus); break;
//redirect
header('Location: ivr_menus.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the ivr menus case 'toggle':
if (permission_exists('ivr_menu_delete')) { if (permission_exists('ivr_menu_edit')) {
if ($action == 'delete' && is_array($ivr_menus) && @sizeof($ivr_menus) != 0) { $obj->toggle($ivr_menus);
//delete }
$obj = new ivr_menu; break;
$obj->delete($ivr_menus);
//redirect case 'delete':
header('Location: ivr_menus.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('ivr_menu_delete')) {
exit; $obj->delete($ivr_menus);
}
break;
} }
header('Location: ivr_menus.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by //get order and order by

View File

@ -50,28 +50,26 @@
$modules = $_POST['modules']; $modules = $_POST['modules'];
} }
//toggle the modules //process posted data by action
if (permission_exists('module_edit')) { if ($action != '' && is_array($modules) && @sizeof($modules) != 0) {
if ($action == 'toggle' && is_array($modules) && @sizeof($modules) != 0) { $obj = new modules;
//toggle
$obj = new modules;
$obj->toggle($modules);
//redirect
header('Location: modules.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the modules switch ($action) {
if (permission_exists('module_delete')) { case 'toggle':
if ($action == 'delete' && is_array($modules) && @sizeof($modules) != 0) { if (permission_exists('module_edit')) {
//delete $obj->toggle($modules);
$obj = new modules; }
$obj->delete($modules); break;
//redirect
header('Location: modules.php'.($search != '' ? '?search='.urlencode($search) : null)); case 'delete':
exit; if (permission_exists('module_delete')) {
$obj->delete($modules);
}
break;
} }
header('Location: modules.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//connect to event socket //connect to event socket

View File

@ -43,40 +43,32 @@
$number_translations = $_POST['number_translations']; $number_translations = $_POST['number_translations'];
} }
//copy the number translations //process posted data by action
if (permission_exists('number_translation_add')) { if ($action != '' && is_array($number_translations) && @sizeof($number_translations) != 0) {
if ($action == 'copy' && is_array($number_translations) && @sizeof($number_translations) != 0) { $obj = new number_translations;
//copy
$obj = new number_translations;
$obj->copy($number_translations);
//redirect
header('Location: number_translations.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the number translations switch ($action) {
if (permission_exists('number_translation_edit')) { case 'copy':
if ($action == 'toggle' && is_array($number_translations) && @sizeof($number_translations) != 0) { if (permission_exists('number_translation_add')) {
//toggle $obj->copy($number_translations);
$obj = new number_translations; }
$obj->toggle($number_translations); break;
//redirect
header('Location: number_translations.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the number translations case 'toggle':
if (permission_exists('number_translation_delete')) { if (permission_exists('number_translation_edit')) {
if ($action == 'delete' && is_array($number_translations) && @sizeof($number_translations) != 0) { $obj->toggle($number_translations);
//delete }
$obj = new number_translations; break;
$obj->delete($number_translations);
//redirect case 'delete':
header('Location: number_translations.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('number_translation_delete')) {
exit; $obj->delete($number_translations);
}
break;
} }
header('Location: number_translations.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by //get order and order by

View File

@ -48,46 +48,35 @@
$phrases = $_POST['phrases']; $phrases = $_POST['phrases'];
} }
//copy the phrases //process posted data by action
if (permission_exists('phrase_add')) { if ($action != '' && is_array($phrases) && @sizeof($phrases) != 0) {
if ($action == 'copy' && is_array($phrases) && @sizeof($phrases) != 0) { $obj = new phrases;
//copy
$obj = new phrases;
$obj->copy($phrases);
//save the xml
save_phrases_xml();
//redirect
header('Location: phrases.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the phrases switch ($action) {
if (permission_exists('phrase_edit')) { case 'copy':
if ($action == 'toggle' && is_array($phrases) && @sizeof($phrases) != 0) { if (permission_exists('phrase_add')) {
//toggle $obj->copy($phrases);
$obj = new phrases; save_phrases_xml();
$obj->toggle($phrases); }
//save the xml break;
save_phrases_xml();
//redirect
header('Location: phrases.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the phrases case 'toggle':
if (permission_exists('phrase_delete')) { if (permission_exists('phrase_edit')) {
if ($action == 'delete' && is_array($phrases) && @sizeof($phrases) != 0) { $obj->toggle($phrases);
//delete save_phrases_xml();
$obj = new phrases; }
$obj->delete($phrases); break;
//save the xml
save_phrases_xml(); case 'delete':
//redirect if (permission_exists('phrase_delete')) {
header('Location: phrases.php'.($search != '' ? '?search='.urlencode($search) : null)); $obj->delete($phrases);
exit; save_phrases_xml();
}
break;
} }
header('Location: phrases.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by //get order and order by

View File

@ -50,40 +50,32 @@
$pin_numbers = $_POST['pin_numbers']; $pin_numbers = $_POST['pin_numbers'];
} }
//copy the pin numbers //process posted data by action
if (permission_exists('pin_number_add')) { if ($action != '' && is_array($pin_numbers) && @sizeof($pin_numbers) != 0) {
if ($action == 'copy' && is_array($pin_numbers) && @sizeof($pin_numbers) != 0) { $obj = new pin_numbers;
//copy
$obj = new pin_numbers;
$obj->copy($pin_numbers);
//redirect
header('Location: pin_numbers.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the pin numbers switch ($action) {
if (permission_exists('pin_number_edit')) { case 'copy':
if ($action == 'toggle' && is_array($pin_numbers) && @sizeof($pin_numbers) != 0) { if (permission_exists('pin_number_add')) {
//toggle $obj->copy($pin_numbers);
$obj = new pin_numbers; }
$obj->toggle($pin_numbers); break;
//redirect
header('Location: pin_numbers.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the pin numbers case 'toggle':
if (permission_exists('pin_number_delete')) { if (permission_exists('pin_number_edit')) {
if ($action == 'delete' && is_array($pin_numbers) && @sizeof($pin_numbers) != 0) { $obj->toggle($pin_numbers);
//delete }
$obj = new pin_numbers; break;
$obj->delete($pin_numbers);
//redirect case 'delete':
header('Location: pin_numbers.php'.($search != '' ? '?search='.urlencode($search) : null)); if (permission_exists('pin_number_delete')) {
exit; $obj->delete($pin_numbers);
}
break;
} }
header('Location: pin_numbers.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by //get order and order by

View File

@ -264,16 +264,20 @@
$recordings = $_POST['recordings']; $recordings = $_POST['recordings'];
} }
//delete the recordings //process posted data by action
if (permission_exists('recording_delete')) { if ($action != '' && is_array($recordings) && @sizeof($recordings) != 0) {
if ($action == 'delete' && is_array($recordings) && @sizeof($recordings) != 0) { $obj = new switch_recordings;
//delete
$obj = new switch_recordings; switch ($action) {
$obj->delete($recordings); case 'delete':
//redirect if (permission_exists('recording_delete')) {
header('Location: recordings.php'.($search != '' ? '?search='.urlencode($search) : null)); $obj->delete($recordings);
exit; }
break;
} }
header('Location: recordings.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
} }
//get order and order by //get order and order by

View File

@ -59,30 +59,24 @@
//process posted data //process posted data
if ($action != '' && is_array($registrations) && @sizeof($registrations) != 0) { if ($action != '' && is_array($registrations) && @sizeof($registrations) != 0) {
$obj = new registrations;
//perform action switch ($action) {
switch ($action) { case 'unregister':
//unregister the registrations $obj->unregister($registrations);
case 'unregister': break;
$obj = new registrations;
$obj->unregister($registrations);
break;
//provision the registrations
case 'provision':
$obj = new registrations;
$obj->provision($registrations);
break;
//reboot the registrations
case 'reboot':
$obj = new registrations;
$obj->reboot($registrations);
break;
}
//redirect case 'provision':
header('Location: registrations.php'.($search || $profile ? '?' : null).$qs['search'].$qs['profile']); $obj->provision($registrations);
exit; break;
case 'reboot':
$obj->reboot($registrations);
break;
}
header('Location: registrations.php'.($search || $profile ? '?' : null).$qs['search'].$qs['profile']);
exit;
} }
//get the registrations //get the registrations

View File

@ -50,16 +50,20 @@
$xml_cdrs = $_POST['xml_cdrs']; $xml_cdrs = $_POST['xml_cdrs'];
} }
//delete the cdr //process posted data by action
if (permission_exists('xml_cdr_delete')) { if ($action != '' && is_array($xml_cdrs) && @sizeof($xml_cdrs) != 0) {
if ($action == 'delete' && is_array($xml_cdrs) && @sizeof($xml_cdrs) != 0) { $obj = new xml_cdr;
//delete
$obj = new xml_cdr; switch ($action) {
$obj->delete($xml_cdrs); case 'delete':
//redirect if (permission_exists('xml_cdr_delete')) {
header('Location: xml_cdr.php'); $obj->delete($xml_cdrs);
exit; }
break;
} }
header('Location: xml_cdr.php');
exit;
} }
//create token //create token