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

View File

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

View File

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

View File

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

View File

@ -69,8 +69,7 @@
//paging the records
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".$search;
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_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_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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