diff --git a/app/access_controls/access_controls.php b/app/access_controls/access_controls.php index 586e82d364..530a47863e 100644 --- a/app/access_controls/access_controls.php +++ b/app/access_controls/access_controls.php @@ -46,28 +46,26 @@ $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 - $obj = new access_controls; - $obj->copy($access_controls); - //redirect - header('Location: access_controls.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($access_controls) && @sizeof($access_controls) != 0) { + $obj = new access_controls; -//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; + switch ($action) { + case 'copy': + if (permission_exists('access_control_add')) { + $obj->copy($access_controls); + } + break; + + case 'delete': + 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 diff --git a/app/bridges/bridges.php b/app/bridges/bridges.php index 02b4a7a68b..a2995ca641 100644 --- a/app/bridges/bridges.php +++ b/app/bridges/bridges.php @@ -50,40 +50,32 @@ $bridges = $_POST['bridges']; } -//copy the bridges - 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; - } - } +//process posted data by action + if ($action != '' && is_array($bridges) && @sizeof($bridges) != 0) { + $obj = new bridges; -//toggle the bridges - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('bridge_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('bridge_edit')) { + $obj->toggle($bridges); + } + break; + + case 'delete': + if (permission_exists('bridge_delete')) { + $obj->delete($bridges); + } + break; } + + header('Location: bridges.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get order and 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); diff --git a/app/call_block/call_block.php b/app/call_block/call_block.php index d8ca6d88d5..40c4af45db 100644 --- a/app/call_block/call_block.php +++ b/app/call_block/call_block.php @@ -47,40 +47,32 @@ $call_blocks = $_POST['call_blocks']; } -//copy the call blocks - 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; - } - } +//process posted data by action + if ($action != '' && is_array($call_blocks) && @sizeof($call_blocks) != 0) { + $obj = new call_block; -//toggle the call blocks - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('call_block_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('call_block_edit')) { + $obj->toggle($call_blocks); + } + break; + + case 'delete': + if (permission_exists('call_block_delete')) { + $obj->delete($call_blocks); + } + break; } + + header('Location: call_block.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get variables used to control the order diff --git a/app/call_broadcast/call_broadcast.php b/app/call_broadcast/call_broadcast.php index 892d0815bd..3dc9bef6ed 100644 --- a/app/call_broadcast/call_broadcast.php +++ b/app/call_broadcast/call_broadcast.php @@ -46,28 +46,26 @@ $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 - $obj = new call_broadcast; - $obj->copy($call_broadcasts); - //redirect - header('Location: call_broadcast.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($call_broadcasts) && @sizeof($call_broadcasts) != 0) { + $obj = new call_broadcast; -//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; + switch ($action) { + case 'copy': + if (permission_exists('call_broadcast_add')) { + $obj->copy($call_broadcasts); + } + break; + + case 'delete': + 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 diff --git a/app/call_center_active/call_center_queue.php b/app/call_center_active/call_center_queue.php index fc6fba428b..d03033b0b8 100644 --- a/app/call_center_active/call_center_queue.php +++ b/app/call_center_active/call_center_queue.php @@ -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; diff --git a/app/call_centers/call_center_agents.php b/app/call_centers/call_center_agents.php index 646d1f9b9f..5a2e651f1e 100644 --- a/app/call_centers/call_center_agents.php +++ b/app/call_centers/call_center_agents.php @@ -50,28 +50,26 @@ $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 - $obj = new call_center; - $obj->copy_agents($call_center_agents); - //redirect - header('Location: call_center_agents.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($call_center_agents) && @sizeof($call_center_agents) != 0) { + $obj = new call_center; -//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; + switch ($action) { + case 'copy': + if (permission_exists('call_center_agent_add')) { + $obj->copy_agents($call_center_agents); + } + break; + + case 'delete': + 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 diff --git a/app/call_centers/call_center_queues.php b/app/call_centers/call_center_queues.php index 383894fe47..8e8fce4bd5 100644 --- a/app/call_centers/call_center_queues.php +++ b/app/call_centers/call_center_queues.php @@ -50,28 +50,26 @@ $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 - $obj = new call_center; - $obj->copy_queues($call_center_queues); - //redirect - header('Location: call_center_queues.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($call_center_queues) && @sizeof($call_center_queues) != 0) { + $obj = new call_center; -//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; + switch ($action) { + case 'copy': + if (permission_exists('call_center_queue_add')) { + $obj->copy_queues($call_center_queues); + } + break; + + case 'delete': + 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 diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index 1127057b31..7143224d42 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -50,40 +50,32 @@ $call_flows = $_POST['call_flows']; } -//copy the call flows - 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; - } - } +//process posted data by action + if ($action != '' && is_array($call_flows) && @sizeof($call_flows) != 0) { + $obj = new call_flows; -//toggle the call flows - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('call_flow_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('call_flow_edit')) { + $obj->toggle($call_flows); + } + break; + + case 'delete': + if (permission_exists('call_flow_delete')) { + $obj->delete($call_flows); + } + break; } + + header('Location: call_flows.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get variables used to control the order diff --git a/app/calls/calls.php b/app/calls/calls.php index ed711065a2..5c1cace7cc 100644 --- a/app/calls/calls.php +++ b/app/calls/calls.php @@ -50,40 +50,33 @@ $extensions = $_POST['extensions']; } -//toggle the call forward feature - 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; - } - } +//process posted data by action + if ($action != '' && is_array($extensions) && @sizeof($extensions) != 0) { + switch ($action) { + case 'toggle_call_forward': + if (permission_exists('call_forward')) { + $obj = new call_forward; + $obj->toggle($extensions); + } + break; -//toggle the follow me feature - 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; - } - } + case 'toggle_follow_me': + if (permission_exists('follow_me')) { + $obj = new follow_me; + $obj->toggle($extensions); + } + break; -//toggle the do not disturb feature - 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 - header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; + case 'toggle_do_not_disturb': + if (permission_exists('do_not_disturb')) { + $obj = new do_not_disturb; + $obj->toggle($extensions); + } + break; } + + header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get order and order by diff --git a/app/conference_centers/conference_centers.php b/app/conference_centers/conference_centers.php index aa88c7c84e..d71e341f94 100644 --- a/app/conference_centers/conference_centers.php +++ b/app/conference_centers/conference_centers.php @@ -51,40 +51,32 @@ } /* -//copy the conference centers - 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; - } - } +//process posted data by action + if ($action != '' && is_array($conference_centers) && @sizeof($conference_centers) != 0) { + $obj = new conference_centers; -//toggle the conference centers - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('conference_center_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('conference_center_edit')) { + $obj->toggle($conference_centers); + } + break; + + case 'delete': + if (permission_exists('conference_center_delete')) { + $obj->delete($conference_centers); + } + break; } + + header('Location: conference_centers.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } */ diff --git a/app/conferences/conferences.php b/app/conferences/conferences.php index 1e84bf4022..f856d7786e 100644 --- a/app/conferences/conferences.php +++ b/app/conferences/conferences.php @@ -50,40 +50,32 @@ $conferences = $_POST['conferences']; } -//copy the conferences - 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; - } - } +//process posted data by action + if ($action != '' && is_array($conferences) && @sizeof($conferences) != 0) { + $obj = new conferences; -//toggle the conferences - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('conference_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('conference_edit')) { + $obj->toggle($conferences); + } + break; + + case 'delete': + if (permission_exists('conference_delete')) { + $obj->delete($conferences); + } + break; } + + header('Location: conferences.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get variables used to control the order diff --git a/app/contacts/contacts.php b/app/contacts/contacts.php index 8c0a022218..b755242fd2 100644 --- a/app/contacts/contacts.php +++ b/app/contacts/contacts.php @@ -50,16 +50,20 @@ $contacts = $_POST['contacts']; } -//delete the contacts - if (permission_exists('contact_delete')) { - if ($action == 'delete' && is_array($contacts) && @sizeof($contacts) != 0) { - //delete - $obj = new contacts; - $obj->delete($contacts); - //redirect - header('Location: contacts.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; +//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); + } + break; } + + header('Location: contacts.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //retrieve current user's assigned groups (uuids) diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index 3f6d0cd3a6..29e540eba4 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -50,28 +50,26 @@ $destinations = $_POST['destinations']; } -//toggle the destinations - if (permission_exists('destination_edit')) { - if ($action == 'toggle' && is_array($destinations) && @sizeof($destinations) != 0) { - //toggle - $obj = new destinations; - $obj->toggle($destinations); - //redirect - header('Location: destinations.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($destinations) && @sizeof($destinations) != 0) { + $obj = new destinations; -//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; + switch ($action) { + case 'toggle': + if (permission_exists('destination_edit')) { + $obj->toggle($destinations); + } + break; + + case 'delete': + if (permission_exists('destination_delete')) { + $obj->delete($destinations); + } + break; } + + header('Location: destinations.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get the destination select list diff --git a/app/devices/device_profiles.php b/app/devices/device_profiles.php index 20f51cd1ae..bd9156e5e7 100644 --- a/app/devices/device_profiles.php +++ b/app/devices/device_profiles.php @@ -49,40 +49,32 @@ $profiles = $_POST['profiles']; } -//copy the device profiles - 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; - } - } +//process posted data by action + if ($action != '' && is_array($profiles) && @sizeof($profiles) != 0) { + $obj = new device; -//toggle the device profiles - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('device_profile_add')) { + $obj->copy_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; + case 'toggle': + if (permission_exists('device_profile_edit')) { + $obj->toggle_profiles($profiles); + } + break; + + case 'delete': + if (permission_exists('device_profile_delete')) { + $obj->delete_profiles($profiles); + } + break; } + + header('Location: device_profiles.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get variables used to control the order diff --git a/app/devices/device_vendors.php b/app/devices/device_vendors.php index d09d996871..f3ec7e5c18 100644 --- a/app/devices/device_vendors.php +++ b/app/devices/device_vendors.php @@ -50,28 +50,26 @@ $vendors = $_POST['vendors']; } -//toggle the device vendors - if (permission_exists('device_vendor_edit')) { - if ($action == 'toggle' && is_array($vendors) && @sizeof($vendors) != 0) { - //toggle - $obj = new device; - $obj->toggle_vendors($vendors); - //redirect - header('Location: device_vendors.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($vendors) && @sizeof($vendors) != 0) { + $obj = new device; -//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; + switch ($action) { + case 'toggle': + if (permission_exists('device_vendor_edit')) { + $obj->toggle_vendors($vendors); + } + break; + + case 'delete': + 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 diff --git a/app/devices/devices.php b/app/devices/devices.php index a8c10add3a..a10824d209 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -52,28 +52,26 @@ //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 - $obj = new device; - $obj->toggle($devices); - //redirect - header('Location: devices.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($devices) && @sizeof($devices) != 0) { + $obj = new device; -//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; + switch ($action) { + case 'toggle': + if (permission_exists('device_edit')) { + $obj->toggle($devices); + } + break; + + case 'delete': + 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 diff --git a/app/dialplans/dialplans.php b/app/dialplans/dialplans.php index f8c2016748..324fa676bf 100644 --- a/app/dialplans/dialplans.php +++ b/app/dialplans/dialplans.php @@ -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') { - $obj = new dialplan; - $obj->app_uuid = $app_uuid; - $obj->list_page = $redirect_url; - $obj->copy($dialplans); - } + //create object, set app_uuid and redirect + $obj = new dialplan; + $obj->app_uuid = $app_uuid; + $obj->list_page = $redirect_url; - //toggle the dialplans - if ($action == 'toggle') { - $obj = new dialplan; - $obj->app_uuid = $app_uuid; - $obj->list_page = $redirect_url; - $obj->toggle($dialplans); - } + //process action + switch ($action) { + case 'copy': + if (permission_exists('dialplan_add')) { + $obj->copy($dialplans); + } + break; - //delete the dialplans - if ($action == 'delete') { - $obj = new dialplan; - $obj->app_uuid = $app_uuid; - $obj->list_page = $redirect_url; - $obj->delete($dialplans); + case 'toggle': + if (permission_exists('dialplan_edit')) { + $obj->toggle($dialplans); + } + break; + + 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 diff --git a/app/email_logs/email_logs.php b/app/email_logs/email_logs.php index a33f70418d..5d29be2e9e 100644 --- a/app/email_logs/email_logs.php +++ b/app/email_logs/email_logs.php @@ -41,42 +41,34 @@ $emails = $_POST['emails']; } -//download the emails - 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) - message::add($text['message-download_failed'],'negative',7000); - //redirect - header('Location: email_logs.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($emails) && @sizeof($emails) != 0) { + $obj = new email_logs; -//resend the emails - 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; - } - } + switch ($action) { + case 'download': + if (permission_exists('email_log_download')) { + $obj->download($emails); + //download failed, set message + message::add($text['message-download_failed'],'negative',7000); + } + 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; + case 'resend': + if (permission_exists('email_log_resend')) { + $obj->resend($emails); + } + break; + + case 'delete': + if (permission_exists('email_log_delete')) { + $obj->delete($emails); + } + break; } + + header('Location: email_logs.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get order and order by and sanatize the values diff --git a/app/email_templates/email_templates.php b/app/email_templates/email_templates.php index 343e664a7f..f4602d9693 100644 --- a/app/email_templates/email_templates.php +++ b/app/email_templates/email_templates.php @@ -47,40 +47,32 @@ $email_templates = $_POST['email_templates']; } -//copy the email_templates - 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; - } - } +//process posted data by action + if ($action != '' && is_array($email_templates) && @sizeof($email_templates) != 0) { + $obj = new email_templates; -//toggle the email_templates - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('email_template_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('email_template_edit')) { + $obj->toggle($email_templates); + } + break; + + case 'delete': + if (permission_exists('email_template_delete')) { + $obj->delete($email_templates); + } + break; } + + header('Location: email_templates.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get variables used to control the order diff --git a/app/extensions/extensions.php b/app/extensions/extensions.php index 8dfff3fe58..9a09f3027b 100644 --- a/app/extensions/extensions.php +++ b/app/extensions/extensions.php @@ -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,28 +50,26 @@ $extensions = $_POST['extensions']; } -//toggle the extensions - if (permission_exists('extension_enabled')) { - if ($action == 'toggle' && is_array($extensions) && @sizeof($extensions) != 0) { - //toggle - $obj = new extension; - $obj->toggle($extensions); - //redirect - header('Location: extensions.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($extensions) && @sizeof($extensions) != 0) { + $obj = new extension; -//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; + switch ($action) { + case 'toggle': + if (permission_exists('extension_enabled')) { + $obj->toggle($extensions); + } + break; + + case 'delete': + if (permission_exists('extension_delete')) { + $obj->delete($extensions); + } + break; } + + header('Location: extensions.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get order and order by diff --git a/app/fax/fax.php b/app/fax/fax.php index 7c8e09691a..19c11c1efd 100644 --- a/app/fax/fax.php +++ b/app/fax/fax.php @@ -50,28 +50,26 @@ $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 - $obj = new fax; - $obj->copy($fax_servers); - //redirect - header('Location: fax.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($fax_servers) && @sizeof($fax_servers) != 0) { + $obj = new fax; -//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; + switch ($action) { + case 'copy': + if (permission_exists('fax_extension_copy')) { + $obj->copy($fax_servers); + } + break; + + case 'delete': + 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 diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index d5b8f9b12e..e95dd5958a 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.php @@ -50,40 +50,32 @@ $gateways = $_POST['gateways']; } -//copy the gateways - 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; - } - } +//process posted data by action + if ($action != '' && is_array($gateways) && @sizeof($gateways) != 0) { + $obj = new gateways; -//toggle the gateways - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('gateway_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('gateway_edit')) { + $obj->toggle($gateways); + } + break; + + case 'delete': + if (permission_exists('gateway_delete')) { + $obj->delete($gateways); + } + break; } + + header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //connect to event socket diff --git a/app/ivr_menus/ivr_menus.php b/app/ivr_menus/ivr_menus.php index f64d79f964..5d5e484b83 100644 --- a/app/ivr_menus/ivr_menus.php +++ b/app/ivr_menus/ivr_menus.php @@ -50,40 +50,32 @@ $ivr_menus = $_POST['ivr_menus']; } -//copy the ivr menus - 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; - } - } +//process posted data by action + if ($action != '' && is_array($ivr_menus) && @sizeof($ivr_menus) != 0) { + $obj = new ivr_menu; -//toggle the ivr menus - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('ivr_menu_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('ivr_menu_edit')) { + $obj->toggle($ivr_menus); + } + break; + + case 'delete': + if (permission_exists('ivr_menu_delete')) { + $obj->delete($ivr_menus); + } + break; } + + header('Location: ivr_menus.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get order and order by diff --git a/app/modules/modules.php b/app/modules/modules.php index d87d5ff872..0275a4cfe6 100644 --- a/app/modules/modules.php +++ b/app/modules/modules.php @@ -50,28 +50,26 @@ $modules = $_POST['modules']; } -//toggle the modules - if (permission_exists('module_edit')) { - if ($action == 'toggle' && is_array($modules) && @sizeof($modules) != 0) { - //toggle - $obj = new modules; - $obj->toggle($modules); - //redirect - header('Location: modules.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - } +//process posted data by action + if ($action != '' && is_array($modules) && @sizeof($modules) != 0) { + $obj = new modules; -//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; + switch ($action) { + case 'toggle': + if (permission_exists('module_edit')) { + $obj->toggle($modules); + } + break; + + case 'delete': + if (permission_exists('module_delete')) { + $obj->delete($modules); + } + break; } + + header('Location: modules.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //connect to event socket diff --git a/app/number_translations/number_translations.php b/app/number_translations/number_translations.php index 840436399d..f06e41d1e6 100644 --- a/app/number_translations/number_translations.php +++ b/app/number_translations/number_translations.php @@ -43,40 +43,32 @@ $number_translations = $_POST['number_translations']; } -//copy the number translations - 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; - } - } +//process posted data by action + if ($action != '' && is_array($number_translations) && @sizeof($number_translations) != 0) { + $obj = new number_translations; -//toggle the number translations - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('number_translation_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('number_translation_edit')) { + $obj->toggle($number_translations); + } + break; + + case 'delete': + if (permission_exists('number_translation_delete')) { + $obj->delete($number_translations); + } + break; } + + header('Location: number_translations.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get order and order by diff --git a/app/phrases/phrases.php b/app/phrases/phrases.php index 1ee85a1bdc..b2d27ea44a 100644 --- a/app/phrases/phrases.php +++ b/app/phrases/phrases.php @@ -48,46 +48,35 @@ $phrases = $_POST['phrases']; } -//copy the phrases - 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; - } - } +//process posted data by action + if ($action != '' && is_array($phrases) && @sizeof($phrases) != 0) { + $obj = new phrases; -//toggle the phrases - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('phrase_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('phrase_edit')) { + $obj->toggle($phrases); + save_phrases_xml(); + } + break; + + case 'delete': + if (permission_exists('phrase_delete')) { + $obj->delete($phrases); + save_phrases_xml(); + } + break; } + + header('Location: phrases.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get order and order by diff --git a/app/pin_numbers/pin_numbers.php b/app/pin_numbers/pin_numbers.php index 4d99a0e555..565c416dac 100644 --- a/app/pin_numbers/pin_numbers.php +++ b/app/pin_numbers/pin_numbers.php @@ -50,40 +50,32 @@ $pin_numbers = $_POST['pin_numbers']; } -//copy the pin numbers - 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; - } - } +//process posted data by action + if ($action != '' && is_array($pin_numbers) && @sizeof($pin_numbers) != 0) { + $obj = new pin_numbers; -//toggle the pin numbers - 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; - } - } + switch ($action) { + case 'copy': + if (permission_exists('pin_number_add')) { + $obj->copy($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; + case 'toggle': + if (permission_exists('pin_number_edit')) { + $obj->toggle($pin_numbers); + } + break; + + case 'delete': + if (permission_exists('pin_number_delete')) { + $obj->delete($pin_numbers); + } + break; } + + header('Location: pin_numbers.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get order and order by diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php index 630e326a3e..c435f34c53 100644 --- a/app/recordings/recordings.php +++ b/app/recordings/recordings.php @@ -264,16 +264,20 @@ $recordings = $_POST['recordings']; } -//delete the recordings - if (permission_exists('recording_delete')) { - if ($action == 'delete' && is_array($recordings) && @sizeof($recordings) != 0) { - //delete - $obj = new switch_recordings; - $obj->delete($recordings); - //redirect - header('Location: recordings.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; +//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); + } + break; } + + header('Location: recordings.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; } //get order and order by diff --git a/app/registrations/registrations.php b/app/registrations/registrations.php index a9d5f1591e..03ce273d0d 100644 --- a/app/registrations/registrations.php +++ b/app/registrations/registrations.php @@ -59,30 +59,24 @@ //process posted data if ($action != '' && is_array($registrations) && @sizeof($registrations) != 0) { + $obj = new registrations; - //perform action - switch ($action) { - //unregister the registrations - case 'unregister': - $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; - } + switch ($action) { + case 'unregister': + $obj->unregister($registrations); + break; - //redirect - header('Location: registrations.php'.($search || $profile ? '?' : null).$qs['search'].$qs['profile']); - exit; + case 'provision': + $obj->provision($registrations); + break; + case 'reboot': + $obj->reboot($registrations); + break; + } + + header('Location: registrations.php'.($search || $profile ? '?' : null).$qs['search'].$qs['profile']); + exit; } //get the registrations diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index 75974d42dc..f6735317e8 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -50,16 +50,20 @@ $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 - $obj = new xml_cdr; - $obj->delete($xml_cdrs); - //redirect - header('Location: xml_cdr.php'); - exit; +//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); + } + break; } + + header('Location: xml_cdr.php'); + exit; } //create token