diff --git a/app/access_controls/access_controls.php b/app/access_controls/access_controls.php index 530a47863e..6f784c6872 100644 --- a/app/access_controls/access_controls.php +++ b/app/access_controls/access_controls.php @@ -46,19 +46,18 @@ $access_controls = $_POST['access_controls']; } -//process posted data by action +//process the http post 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 = new access_controls; $obj->copy($access_controls); } break; - case 'delete': if (permission_exists('access_control_delete')) { + $obj = new access_controls; $obj->delete($access_controls); } break; diff --git a/app/call_block/call_block.php b/app/call_block/call_block.php index 40c4af45db..c86cf881c6 100644 --- a/app/call_block/call_block.php +++ b/app/call_block/call_block.php @@ -47,25 +47,24 @@ $call_blocks = $_POST['call_blocks']; } -//process posted data by action +//process the http post 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')) { + $obj = new call_block; $obj->copy($call_blocks); } break; - case 'toggle': if (permission_exists('call_block_edit')) { + $obj = new call_block; $obj->toggle($call_blocks); } break; - case 'delete': if (permission_exists('call_block_delete')) { + $obj = new call_block; $obj->delete($call_blocks); } break; diff --git a/app/call_broadcast/call_broadcast.php b/app/call_broadcast/call_broadcast.php index 3dc9bef6ed..e760748e06 100644 --- a/app/call_broadcast/call_broadcast.php +++ b/app/call_broadcast/call_broadcast.php @@ -46,19 +46,18 @@ $call_broadcasts = $_POST['call_broadcasts']; } -//process posted data by action +//process the http post 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 = new call_broadcast; $obj->copy($call_broadcasts); } break; - case 'delete': if (permission_exists('call_broadcast_delete')) { + $obj = new call_broadcast; $obj->delete($call_broadcasts); } break; diff --git a/app/call_centers/call_center_agents.php b/app/call_centers/call_center_agents.php index 5a2e651f1e..ba25ad310b 100644 --- a/app/call_centers/call_center_agents.php +++ b/app/call_centers/call_center_agents.php @@ -50,19 +50,18 @@ $call_center_agents = $_POST['call_center_agents']; } -//process posted data by action +//process the http post 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 = new call_center; $obj->copy_agents($call_center_agents); } break; - case 'delete': if (permission_exists('call_center_agent_delete')) { + $obj = new call_center; $obj->delete_agents($call_center_agents); } break; diff --git a/app/call_centers/call_center_queues.php b/app/call_centers/call_center_queues.php index 8e8fce4bd5..dad535db71 100644 --- a/app/call_centers/call_center_queues.php +++ b/app/call_centers/call_center_queues.php @@ -50,19 +50,18 @@ $call_center_queues = $_POST['call_center_queues']; } -//process posted data by action +//process the http post 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 = new call_center; $obj->copy_queues($call_center_queues); } break; - case 'delete': if (permission_exists('call_center_queue_delete')) { + $obj = new call_center; $obj->delete_queues($call_center_queues); } break; diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index 7143224d42..9bb0d460dc 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -50,25 +50,24 @@ $call_flows = $_POST['call_flows']; } -//process posted data by action +//process the http post 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')) { + $obj = new call_flows; $obj->copy($call_flows); } break; - case 'toggle': if (permission_exists('call_flow_edit')) { + $obj = new call_flows; $obj->toggle($call_flows); } break; - case 'delete': if (permission_exists('call_flow_delete')) { + $obj = new call_flows; $obj->delete($call_flows); } break; diff --git a/app/calls/calls.php b/app/calls/calls.php index 5c1cace7cc..52fc61c21f 100644 --- a/app/calls/calls.php +++ b/app/calls/calls.php @@ -50,7 +50,7 @@ $extensions = $_POST['extensions']; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($extensions) && @sizeof($extensions) != 0) { switch ($action) { case 'toggle_call_forward': @@ -59,14 +59,12 @@ $obj->toggle($extensions); } break; - case 'toggle_follow_me': if (permission_exists('follow_me')) { $obj = new follow_me; $obj->toggle($extensions); } break; - case 'toggle_do_not_disturb': if (permission_exists('do_not_disturb')) { $obj = new do_not_disturb; diff --git a/app/conference_centers/conference_centers.php b/app/conference_centers/conference_centers.php index d71e341f94..570f4452c7 100644 --- a/app/conference_centers/conference_centers.php +++ b/app/conference_centers/conference_centers.php @@ -51,25 +51,24 @@ } /* -//process posted data by action +//process the http post 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')) { + $obj = new conference_centers; $obj->copy($conference_centers); } break; - case 'toggle': if (permission_exists('conference_center_edit')) { + $obj = new conference_centers; $obj->toggle($conference_centers); } break; - case 'delete': if (permission_exists('conference_center_delete')) { + $obj = new conference_centers; $obj->delete($conference_centers); } break; diff --git a/app/conferences/conferences.php b/app/conferences/conferences.php index f856d7786e..9ce4fec7bf 100644 --- a/app/conferences/conferences.php +++ b/app/conferences/conferences.php @@ -50,25 +50,24 @@ $conferences = $_POST['conferences']; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($conferences) && @sizeof($conferences) != 0) { - $obj = new conferences; - switch ($action) { case 'copy': if (permission_exists('conference_add')) { + $obj = new conferences; $obj->copy($conferences); } break; - case 'toggle': if (permission_exists('conference_edit')) { + $obj = new conferences; $obj->toggle($conferences); } break; - case 'delete': if (permission_exists('conference_delete')) { + $obj = new conferences; $obj->delete($conferences); } break; diff --git a/app/contacts/contacts.php b/app/contacts/contacts.php index b755242fd2..10a141ec2f 100644 --- a/app/contacts/contacts.php +++ b/app/contacts/contacts.php @@ -50,13 +50,12 @@ $contacts = $_POST['contacts']; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($contacts) && @sizeof($contacts) != 0) { - $obj = new contacts; - switch ($action) { case 'delete': if (permission_exists('contact_delete')) { + $obj = new contacts; $obj->delete($contacts); } break; diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index 29e540eba4..5fe2c0b9d6 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -50,19 +50,18 @@ $destinations = $_POST['destinations']; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($destinations) && @sizeof($destinations) != 0) { - $obj = new destinations; - switch ($action) { case 'toggle': if (permission_exists('destination_edit')) { + $obj = new destinations; $obj->toggle($destinations); } break; - case 'delete': if (permission_exists('destination_delete')) { + $obj = new destinations; $obj->delete($destinations); } break; diff --git a/app/devices/device_profiles.php b/app/devices/device_profiles.php index bd9156e5e7..05cc49e726 100644 --- a/app/devices/device_profiles.php +++ b/app/devices/device_profiles.php @@ -49,25 +49,24 @@ $profiles = $_POST['profiles']; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($profiles) && @sizeof($profiles) != 0) { - $obj = new device; - switch ($action) { case 'copy': if (permission_exists('device_profile_add')) { + $obj = new device; $obj->copy_profiles($profiles); } break; - case 'toggle': if (permission_exists('device_profile_edit')) { + $obj = new device; $obj->toggle_profiles($profiles); } break; - case 'delete': if (permission_exists('device_profile_delete')) { + $obj = new device; $obj->delete_profiles($profiles); } break; diff --git a/app/devices/device_vendors.php b/app/devices/device_vendors.php index f3ec7e5c18..a19fc5e097 100644 --- a/app/devices/device_vendors.php +++ b/app/devices/device_vendors.php @@ -50,19 +50,18 @@ $vendors = $_POST['vendors']; } -//process posted data by action +//process the http post 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 = new device; $obj->toggle_vendors($vendors); } break; - case 'delete': if (permission_exists('device_vendor_delete')) { + $obj = new device; $obj->delete_vendors($vendors); } break; diff --git a/app/devices/devices.php b/app/devices/devices.php index a10824d209..7a45a03ab3 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -52,19 +52,18 @@ //get the search $search = strtolower($_REQUEST["search"]); -//process posted data by action +//process the http post data by action if ($action != '' && is_array($devices) && @sizeof($devices) != 0) { - $obj = new device; - switch ($action) { case 'toggle': if (permission_exists('device_edit')) { + $obj = new device; $obj->toggle($devices); } break; - case 'delete': if (permission_exists('device_delete')) { + $obj = new device; $obj->delete($devices); } break; diff --git a/app/dialplans/dialplans.php b/app/dialplans/dialplans.php index 324fa676bf..d105244800 100644 --- a/app/dialplans/dialplans.php +++ b/app/dialplans/dialplans.php @@ -57,7 +57,7 @@ $app_uuid = $_REQUEST["app_uuid"]; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($dialplans) && @sizeof($dialplans) != 0) { //define redirect parameters and url @@ -65,37 +65,39 @@ if ($search) { $params[] = "search=".urlencode($search); } if ($order_by) { $params[] = "order_by=".urlencode($order_by); } if ($order) { $params[] = "order=".urlencode($order); } - $redirect_url = 'dialplans.php'.($params ? '?'.implode('&', $params) : null); + $list_page = 'dialplans.php'.($params ? '?'.implode('&', $params) : null); unset($params); - //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 = new dialplan; + $obj->app_uuid = $app_uuid; + $obj->list_page = $list_page; $obj->copy($dialplans); } break; - case 'toggle': if (permission_exists('dialplan_edit')) { + $obj = new dialplan; + $obj->app_uuid = $app_uuid; + $obj->list_page = $list_page; $obj->toggle($dialplans); } break; - case 'delete': if (permission_exists('dialplan_delete')) { + $obj = new dialplan; + $obj->app_uuid = $app_uuid; + $obj->list_page = $list_page; $obj->delete($dialplans); } break; } //redirect - header('Location: '.$redirect_url); + header('Location: '.$list_page); exit; } diff --git a/app/email_logs/email_logs.php b/app/email_logs/email_logs.php index 5d29be2e9e..ba8b90d163 100644 --- a/app/email_logs/email_logs.php +++ b/app/email_logs/email_logs.php @@ -41,27 +41,25 @@ $emails = $_POST['emails']; } -//process posted data by action +//process the http post 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')) { + $obj = new email_logs; $obj->download($emails); - //download failed, set message - message::add($text['message-download_failed'],'negative',7000); + message::add($text['message-download_failed'],'negative',7000); //download failed, set message } break; - case 'resend': if (permission_exists('email_log_resend')) { + $obj = new email_logs; $obj->resend($emails); } break; - case 'delete': if (permission_exists('email_log_delete')) { + $obj = new email_logs; $obj->delete($emails); } break; diff --git a/app/email_templates/email_templates.php b/app/email_templates/email_templates.php index f4602d9693..b9562dc390 100644 --- a/app/email_templates/email_templates.php +++ b/app/email_templates/email_templates.php @@ -47,25 +47,24 @@ $email_templates = $_POST['email_templates']; } -//process posted data by action +//process the http post 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')) { + $obj = new email_templates; $obj->copy($email_templates); } break; - case 'toggle': if (permission_exists('email_template_edit')) { + $obj = new email_templates; $obj->toggle($email_templates); } break; - case 'delete': if (permission_exists('email_template_delete')) { + $obj = new email_templates; $obj->delete($email_templates); } break; diff --git a/app/extensions/extensions.php b/app/extensions/extensions.php index 9a09f3027b..2cbfce43e1 100644 --- a/app/extensions/extensions.php +++ b/app/extensions/extensions.php @@ -50,19 +50,18 @@ $extensions = $_POST['extensions']; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($extensions) && @sizeof($extensions) != 0) { - $obj = new extension; - switch ($action) { case 'toggle': if (permission_exists('extension_enabled')) { + $obj = new extension; $obj->toggle($extensions); } break; - case 'delete': if (permission_exists('extension_delete')) { + $obj = new extension; $obj->delete($extensions); } break; diff --git a/app/fax/fax.php b/app/fax/fax.php index 19c11c1efd..590bd4d236 100644 --- a/app/fax/fax.php +++ b/app/fax/fax.php @@ -50,19 +50,18 @@ $fax_servers = $_POST['fax_servers']; } -//process posted data by action +//process the http post 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 = new fax; $obj->copy($fax_servers); } break; - case 'delete': if (permission_exists('fax_extension_delete')) { + $obj = new fax; $obj->delete($fax_servers); } break; diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index e95dd5958a..59bfa84c1c 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.php @@ -50,25 +50,24 @@ $gateways = $_POST['gateways']; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($gateways) && @sizeof($gateways) != 0) { - $obj = new gateways; - switch ($action) { case 'copy': if (permission_exists('gateway_add')) { + $obj = new gateways; $obj->copy($gateways); } break; - case 'toggle': if (permission_exists('gateway_edit')) { + $obj = new gateways; $obj->toggle($gateways); } break; - case 'delete': if (permission_exists('gateway_delete')) { + $obj = new gateways; $obj->delete($gateways); } break; diff --git a/app/ivr_menus/ivr_menus.php b/app/ivr_menus/ivr_menus.php index 5d5e484b83..9728bbd78b 100644 --- a/app/ivr_menus/ivr_menus.php +++ b/app/ivr_menus/ivr_menus.php @@ -50,25 +50,24 @@ $ivr_menus = $_POST['ivr_menus']; } -//process posted data by action +//process the http post 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')) { + $obj = new ivr_menu; $obj->copy($ivr_menus); } break; - case 'toggle': if (permission_exists('ivr_menu_edit')) { + $obj = new ivr_menu; $obj->toggle($ivr_menus); } break; - case 'delete': if (permission_exists('ivr_menu_delete')) { + $obj = new ivr_menu; $obj->delete($ivr_menus); } break; diff --git a/app/modules/modules.php b/app/modules/modules.php index 0275a4cfe6..4218c8f0fd 100644 --- a/app/modules/modules.php +++ b/app/modules/modules.php @@ -50,19 +50,18 @@ $modules = $_POST['modules']; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($modules) && @sizeof($modules) != 0) { - $obj = new modules; - switch ($action) { case 'toggle': if (permission_exists('module_edit')) { + $obj = new modules; $obj->toggle($modules); } break; - case 'delete': if (permission_exists('module_delete')) { + $obj = new modules; $obj->delete($modules); } break; diff --git a/app/number_translations/number_translations.php b/app/number_translations/number_translations.php index f06e41d1e6..3a98b14f7b 100644 --- a/app/number_translations/number_translations.php +++ b/app/number_translations/number_translations.php @@ -43,25 +43,24 @@ $number_translations = $_POST['number_translations']; } -//process posted data by action +//process the http post 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')) { + $obj = new number_translations; $obj->copy($number_translations); } break; - case 'toggle': if (permission_exists('number_translation_edit')) { + $obj = new number_translations; $obj->toggle($number_translations); } break; - case 'delete': if (permission_exists('number_translation_delete')) { + $obj = new number_translations; $obj->delete($number_translations); } break; diff --git a/app/phrases/phrases.php b/app/phrases/phrases.php index b2d27ea44a..52676bb826 100644 --- a/app/phrases/phrases.php +++ b/app/phrases/phrases.php @@ -48,27 +48,26 @@ $phrases = $_POST['phrases']; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($phrases) && @sizeof($phrases) != 0) { - $obj = new phrases; - switch ($action) { case 'copy': if (permission_exists('phrase_add')) { + $obj = new phrases; $obj->copy($phrases); save_phrases_xml(); } break; - case 'toggle': if (permission_exists('phrase_edit')) { + $obj = new phrases; $obj->toggle($phrases); save_phrases_xml(); } break; - case 'delete': if (permission_exists('phrase_delete')) { + $obj = new phrases; $obj->delete($phrases); save_phrases_xml(); } diff --git a/app/pin_numbers/pin_numbers.php b/app/pin_numbers/pin_numbers.php index 565c416dac..dfbce9a39d 100644 --- a/app/pin_numbers/pin_numbers.php +++ b/app/pin_numbers/pin_numbers.php @@ -50,25 +50,24 @@ $pin_numbers = $_POST['pin_numbers']; } -//process posted data by action +//process the http post 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')) { + $obj = new pin_numbers; $obj->copy($pin_numbers); } break; - case 'toggle': if (permission_exists('pin_number_edit')) { + $obj = new pin_numbers; $obj->toggle($pin_numbers); } break; - case 'delete': if (permission_exists('pin_number_delete')) { + $obj = new pin_numbers; $obj->delete($pin_numbers); } break; diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php index c435f34c53..081b8a27dd 100644 --- a/app/recordings/recordings.php +++ b/app/recordings/recordings.php @@ -264,13 +264,12 @@ $recordings = $_POST['recordings']; } -//process posted data by action +//process the http post 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 = new switch_recordings; $obj->delete($recordings); } break; diff --git a/app/ring_groups/ring_groups.php b/app/ring_groups/ring_groups.php index e868df21d9..4417a2b86a 100644 --- a/app/ring_groups/ring_groups.php +++ b/app/ring_groups/ring_groups.php @@ -51,20 +51,19 @@ $ring_groups = $_POST['ring_groups']; } -//process posted data by action +//process the http post data by action if ($action != '' && is_array($ring_groups) && @sizeof($ring_groups) != 0) { - $obj = new ring_groups; - switch ($action) { case 'copy': + $obj = new ring_groups; $obj->copy($ring_groups); break; - case 'toggle': + $obj = new ring_groups; $obj->toggle($ring_groups); break; - case 'delete': + $obj = new ring_groups; $obj->delete($ring_groups); break; } diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index f6735317e8..cd40ccd984 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -50,13 +50,12 @@ $xml_cdrs = $_POST['xml_cdrs']; } -//process posted data by action +//process the http post 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 = new xml_cdr; $obj->delete($xml_cdrs); } break;