Selaa lähdekoodia

Bulk account settings (#49)

* Create app_config.php

* Create app_languages.php

* Create app_menu.php

* Create bulk_account_settings.php

* Create bulk_account_settings_devices.php

* Create bulk_account_settings_devices_update.php

* Add files via upload
konradSC 8 vuotta sitten
vanhempi
commit
bcf8dad81c

+ 34 - 0
bulk_account_settings/app_config.php

@@ -0,0 +1,34 @@
+<?php
+	
+	//application details
+		$apps[$x]['name'] = "Bulk Account Settings";
+		$apps[$x]['uuid'] = "6b4e03c9-c302-4eaa-b16d-e1c5c08a2eb7";
+		$apps[$x]['category'] = "Advanced";
+		$apps[$x]['subcategory'] = "";
+		$apps[$x]['version'] = "";
+		$apps[$x]['license'] = "Mozilla Public License 1.1";
+		$apps[$x]['url'] = "http://www.fusionpbx.com";
+		$apps[$x]['description']['en-us'] = "Bulk Account Settings";
+
+	//permission details
+
+		$y=0;
+		$apps[$x]['permissions'][$y]['name'] = "bulk_account_settings";
+		$apps[$x]['permissions'][$y]['menu']['uuid'] = "74341982-313c-4c42-bf4a-533be4f50a4a";
+		$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = "bulk_account_settings_extensions";
+		$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = "bulk_account_settings_devices";
+		$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+		$y++;		
+		$apps[$x]['permissions'][$y]['name'] = "bulk_account_settings_users";
+		$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+		$y++;		
+		$apps[$x]['permissions'][$y]['name'] = "bulk_account_settings_voicemails";
+		$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+		$y++;		
+		$apps[$x]['permissions'][$y]['name'] = "bulk_account_settings_view";
+		$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+?>

+ 839 - 0
bulk_account_settings/app_languages.php

@@ -0,0 +1,839 @@
+<?php
+$text['button-devices']['en-us'] = "Devices";
+$text['button-devices']['es-cl'] = "Devices";
+$text['button-devices']['pt-pt'] = "Devices";
+$text['button-devices']['fr-fr'] = "Devices";
+$text['button-devices']['pt-br'] = "Devices";
+$text['button-devices']['pl'] = "Devices";
+$text['button-devices']['sv-se'] = "Devices";
+$text['button-devices']['uk'] = "Devices";
+$text['button-devices']['de-at'] = "Devices";
+$text['button-devices']['it-it'] = "Devices";
+
+$text['button-extensions']['en-us'] = "Extensions";
+$text['button-extensions']['es-cl'] = "Extensions";
+$text['button-extensions']['pt-pt'] = "Extensions";
+$text['button-extensions']['fr-fr'] = "Extensions";
+$text['button-extensions']['pt-br'] = "Extensions";
+$text['button-extensions']['pl'] = "Extensions";
+$text['button-extensions']['sv-se'] = "Extensions";
+$text['button-extensions']['uk'] = "Extensions";
+$text['button-extensions']['de-at'] = "Extensions";
+$text['button-extensions']['it-it'] = "Extensions";
+
+$text['button-users']['en-us'] = "Users";
+$text['button-users']['es-cl'] = "Users";
+$text['button-users']['pt-pt'] = "Users";
+$text['button-users']['fr-fr'] = "Users";
+$text['button-users']['pt-br'] = "Users";
+$text['button-users']['pl'] = "Users";
+$text['button-users']['sv-se'] = "Users";
+$text['button-users']['uk'] = "Users";
+$text['button-users']['de-at'] = "Users";
+$text['button-users']['it-it'] = "Users";
+
+$text['button-voicemails']['en-us'] = "Voicemails";
+$text['button-voicemails']['es-cl'] = "Voicemails";
+$text['button-voicemails']['pt-pt'] = "Voicemails";
+$text['button-voicemails']['fr-fr'] = "Voicemails";
+$text['button-voicemails']['pt-br'] = "Voicemails";
+$text['button-voicemails']['pl'] = "Voicemails";
+$text['button-voicemails']['sv-se'] = "Voicemails";
+$text['button-voicemails']['uk'] = "Voicemails";
+$text['button-voicemails']['de-at'] = "Voicemails";
+$text['button-voicemails']['it-it'] = "Voicemails";
+
+$text['button-call_routing']['en-us'] = "Call Routing";
+$text['button-call_routing']['es-cl'] = "Call Routing";
+$text['button-call_routing']['pt-pt'] = "Call Routing";
+$text['button-call_routing']['fr-fr'] = "Call Routing";
+$text['button-call_routing']['pt-br'] = "Call Routing";
+$text['button-call_routing']['pl'] = "Call Routing";
+$text['button-call_routing']['sv-se'] = "Call Routing";
+$text['button-call_routing']['uk'] = "Call Routing";
+$text['button-call_routing']['de-at'] = "Call Routing";
+$text['button-call_routing']['it-it'] = "Call Routing";
+
+$text['button-submit']['en-us'] = "Submit";
+$text['button-submit']['es-cl'] = "Submit";
+$text['button-submit']['pt-pt'] = "Submit";
+$text['button-submit']['fr-fr'] = "Submit";
+$text['button-submit']['pt-br'] = "Submit";
+$text['button-submit']['pl'] = "Submit";
+$text['button-submit']['sv-se'] = "Submit";
+$text['button-submit']['uk'] = "Submit";
+$text['button-submit']['de-at'] = "Submit";
+$text['button-submit']['it-it'] = "Submit";
+
+$text['confirm-update']['en-us'] = "Please confirm the following updates";
+$text['confirm-update']['es-cl'] = "Please confirm the following updates";
+$text['confirm-update']['pt-pt'] = "Please confirm the following updates";
+$text['confirm-update']['fr-fr'] = "Please confirm the following updates";
+$text['confirm-update']['pt-br'] = "Please confirm the following updates";
+$text['confirm-update']['pl'] = "Please confirm the following updates";
+$text['confirm-update']['sv-se'] = "Please confirm the following updates";
+$text['confirm-update']['uk'] = "Please confirm the following updates";
+$text['confirm-update']['de-at'] = "Please confirm the following updates";
+$text['confirm-update']['it-it'] = "Please confirm the following updates";
+
+
+$text['description-extension_settings_description']['en-us'] = "Choose the setting to modify.";
+$text['description-extension_settings_description']['es-cl'] = "Choose the setting to modify.";
+$text['description-extension_settings_description']['pt-pt'] = "Choose the setting to modify.";
+$text['description-extension_settings_description']['fr-fr'] = "Choose the setting to modify.";
+$text['description-extension_settings_description']['pt-br'] = "Choose the setting to modify.";
+$text['description-extension_settings_description']['pl'] = "Choose the setting to modify.";
+$text['description-extension_settings_description']['sv-se'] = "Choose the setting to modify.";
+$text['description-extension_settings_description']['uk'] = "Choose the setting to modify.";
+$text['description-extension_settings_description']['de-at'] = "Choose the setting to modify.";
+$text['description-extension_settings_description']['it-it'] = "Choose the setting to modify.";
+
+$text['description-accountcode']['en-us'] = "Enter the new accountcode for the selected extensions.";
+$text['description-accountcode']['es-cl'] = "Enter the new accountcode for the selected extensions.";
+$text['description-accountcode']['pt-pt'] = "Enter the new accountcode for the selected extensions.";
+$text['description-accountcode']['fr-fr'] = "Enter the new accountcode for the selected extensions.";
+$text['description-accountcode']['pt-br'] = "Enter the new accountcode for the selected extensions.";
+$text['description-accountcode']['pl'] = "Enter the new accountcode for the selected extensions.";
+$text['description-accountcode']['sv-se'] = "Enter the new accountcode for the selected extensions.";
+$text['description-accountcode']['uk'] = "Enter the new accountcode for the selected extensions.";
+$text['description-accountcode']['de-at'] = "Enter the new accountcode for the selected extensions.";
+$text['description-accountcode']['it-it'] = "Enter the new accountcode for the selected extensions.";
+
+$text['description-call_group']['en-us'] = "Enter the new call group for the selected extensions.";
+$text['description-call_group']['es-cl'] = "Enter the new call group for the selected extensions.";
+$text['description-call_group']['pt-pt'] = "Enter the new call group for the selected extensions.";
+$text['description-call_group']['fr-fr'] = "Enter the new call group for the selected extensions.";
+$text['description-call_group']['pt-br'] = "Enter the new call group for the selected extensions.";
+$text['description-call_group']['pl'] = "Enter the new call group for the selected extensions.";
+$text['description-call_group']['sv-se'] = "Enter the new call group for the selected extensions.";
+$text['description-call_group']['uk'] = "Enter the new call group for the selected extensions.";
+$text['description-call_group']['de-at'] = "Enter the new call group for the selected extensions.";
+$text['description-call_group']['it-it'] = "Enter the new call group for the selected extensions.";
+
+$text['description-call_timeout']['en-us'] = "Enter the new call timeout for the selected extensions.";
+$text['description-call_timeout']['es-cl'] = "Enter the new call timeout for the selected extensions.";
+$text['description-call_timeout']['pt-pt'] = "Enter the new call timeout for the selected extensions.";
+$text['description-call_timeout']['fr-fr'] = "Enter the new call timeout for the selected extensions.";
+$text['description-call_timeout']['pt-br'] = "Enter the new call timeout for the selected extensions.";
+$text['description-call_timeout']['pl'] = "Enter the new call timeout for the selected extensions.";
+$text['description-call_timeout']['sv-se'] = "Enter the new call timeout for the selected extensions.";
+$text['description-call_timeout']['uk'] = "Enter the new call timeout for the selected extensions.";
+$text['description-call_timeout']['de-at'] = "Enter the new call timeout for the selected extensions.";
+$text['description-call_timeout']['it-it'] = "Enter the new call timeout for the selected extensions.";
+
+$text['description-devices_settings']['en-us'] = "Choose the setting to modify.";
+$text['description-devices_settings']['es-cl'] = "Choose the setting to modify.";
+$text['description-devices_settings']['pt-pt'] = "Choose the setting to modify.";
+$text['description-devices_settings']['fr-fr'] = "Choose the setting to modify.";
+$text['description-devices_settings']['pt-br'] = "Choose the setting to modify.";
+$text['description-devices_settings']['pl'] = "Choose the setting to modify.";
+$text['description-devices_settings']['sv-se'] = "Choose the setting to modify.";
+$text['description-devices_settings']['uk'] = "Choose the setting to modify.";
+$text['description-devices_settings']['de-at'] = "Choose the setting to modify.";
+$text['description-devices_settings']['it-it'] = "Choose the setting to modify.";
+
+$text['description-device_profile']['en-us'] = "Select the new device profile for the selected devices.";
+$text['description-device_profile']['es-cl'] = "Select the new device profile for the selected devices.";
+$text['description-device_profile']['pt-pt'] = "Select the new device profile for the selected devices.";
+$text['description-device_profile']['fr-fr'] = "Select the new device profile for the selected devices.";
+$text['description-device_profile']['pt-br'] = "Select the new device profile for the selected devices.";
+$text['description-device_profile']['pl'] = "Select the new device profile for the selected devices.";
+$text['description-device_profile']['sv-se'] = "Select the new device profile for the selected devices.";
+$text['description-device_profile']['uk'] = "Select the new device profile for the selected devices.";
+$text['description-device_profile']['de-at'] = "Select the new device profile for the selected devices.";
+$text['description-device_profile']['it-it'] = "Select the new device profile for the selected devices.";
+
+$text['description-device_template']['en-us'] = "Select the new device template for the selected devices.";
+$text['description-device_template']['es-cl'] = "Select the new device template for the selected devices.";
+$text['description-device_template']['pt-pt'] = "Select the new device template for the selected devices.";
+$text['description-device_template']['fr-fr'] = "Select the new device template for the selected devices.";
+$text['description-device_template']['pt-br'] = "Select the new device template for the selected devices.";
+$text['description-device_template']['pl'] = "Select the new device template for the selected devices.";
+$text['description-device_template']['sv-se'] = "Select the new device template for the selected devices.";
+$text['description-device_template']['uk'] = "Select the new device template for the selected devices.";
+$text['description-device_template']['de-at'] = "Select the new device template for the selected devices.";
+$text['description-device_template']['it-it'] = "Select the new device template for the selected devices.";
+
+
+$text['description-password']['en-us'] = "Enter the new password for the selected users.";
+$text['description-password']['es-cl'] = "Enter the new password for the selected users.";
+$text['description-password']['pt-pt'] = "Enter the new password for the selected users.";
+$text['description-password']['fr-fr'] = "Enter the new password for the selected users.";
+$text['description-password']['pt-br'] = "Enter the new password for the selected users.";
+$text['description-password']['pl'] = "Enter the new password for the selected users.";
+$text['description-password']['sv-se'] = "Enter the new password for the selected users.";
+$text['description-password']['uk'] = "Enter the new password for the selected users.";
+$text['description-password']['de-at'] = "Enter the new password for the selected users.";
+$text['description-password']['it-it'] = "Enter the new password for the selected users.";
+
+$text['description-enabled']['en-us'] = "Select the new enabled status for the selected extensions.";
+$text['description-enabled']['es-cl'] = "Select the new enabled status for the selected extensions.";
+$text['description-enabled']['pt-pt'] = "Select the new enabled status for the selected extensions.";
+$text['description-enabled']['fr-fr'] = "Select the new enabled status for the selected extensions.";
+$text['description-enabled']['pt-br'] = "Select the new enabled status for the selected extensions.";
+$text['description-enabled']['pl'] = "Select the new enabled status for the selected extensions.";
+$text['description-enabled']['sv-se'] = "Select the new enabled status for the selected extensions.";
+$text['description-enabled']['uk'] = "Select the new enabled status for the selected extensions.";
+$text['description-enabled']['de-at'] = "Select the new enabled status for the selected extensions.";
+$text['description-enabled']['it-it'] = "Select the new enabled status for the selected extensions.";
+
+$text['description-emergency_caller_id_name']['en-us'] = "Enter the new emergency caller id name for the selected extensions.";
+$text['description-emergency_caller_id_name']['es-cl'] = "Enter the new emergency caller id name for the selected extensions.";
+$text['description-emergency_caller_id_name']['pt-pt'] = "Enter the new emergency caller id name for the selected extensions.";
+$text['description-emergency_caller_id_name']['fr-fr'] = "Enter the new emergency caller id name for the selected extensions.";
+$text['description-emergency_caller_id_name']['pt-br'] = "Enter the new emergency caller id name for the selected extensions.";
+$text['description-emergency_caller_id_name']['pl'] = "Enter the new emergency caller id name for the selected extensions.";
+$text['description-emergency_caller_id_name']['sv-se'] = "Enter the new emergency caller id name for the selected extensions.";
+$text['description-emergency_caller_id_name']['uk'] = "Enter the new emergency caller id name for the selected extensions.";
+$text['description-emergency_caller_id_name']['de-at'] = "Enter the new emergency caller id name for the selected extensions.";
+$text['description-emergency_caller_id_name']['it-it'] = "Enter the new emergency caller id name for the selected extensions.";
+
+$text['description-emergency_caller_id_number']['en-us'] = "Enter the new emergency caller id number for the selected extensions.";
+$text['description-emergency_caller_id_number']['es-cl'] = "Enter the new emergency caller id number for the selected extensions.";
+$text['description-emergency_caller_id_number']['pt-pt'] = "Enter the new emergency caller id number for the selected extensions.";
+$text['description-emergency_caller_id_number']['fr-fr'] = "Enter the new emergency caller id number for the selected extensions.";
+$text['description-emergency_caller_id_number']['pt-br'] = "Enter the new emergency caller id number for the selected extensions.";
+$text['description-emergency_caller_id_number']['pl'] = "Enter the new emergency caller id number for the selected extensions.";
+$text['description-emergency_caller_id_number']['sv-se'] = "Enter the new emergency caller id number for the selected extensions.";
+$text['description-emergency_caller_id_number']['uk'] = "Enter the new emergency caller id number for the selected extensions.";
+$text['description-emergency_caller_id_number']['de-at'] = "Enter the new emergency caller id number for the selected extensions.";
+$text['description-emergency_caller_id_number']['it-it'] = "Enter the new emergency caller id number for the selected extensions.";
+
+$text['description-hold_music']['en-us'] = "Select the new hold music for the selected extensions.";
+$text['description-hold_music']['es-cl'] = "Select the new hold music for the selected extensions.";
+$text['description-hold_music']['pt-pt'] = "Select the new hold music for the selected extensions.";
+$text['description-hold_music']['fr-fr'] = "Select the new hold music for the selected extensions.";
+$text['description-hold_music']['pt-br'] = "Select the new hold music for the selected extensions.";
+$text['description-hold_music']['pl'] = "Select the new hold music for the selected extensions.";
+$text['description-hold_music']['sv-se'] = "Select the new hold music for the selected extensions.";
+$text['description-hold_music']['uk'] = "Select the new hold music for the selected extensions.";
+$text['description-hold_music']['de-at'] = "Select the new hold music for the selected extensions.";
+$text['description-hold_music']['it-it'] = "Select the new hold music for the selected extensions.";
+
+$text['description-outbound_caller_id_name']['en-us'] = "Enter the new outbound caller id name for the selected extensions.";
+$text['description-outbound_caller_id_name']['es-cl'] = "Enter the new outbound caller id name for the selected extensions.";
+$text['description-outbound_caller_id_name']['pt-pt'] = "Enter the new outbound caller id name for the selected extensions.";
+$text['description-outbound_caller_id_name']['fr-fr'] = "Enter the new outbound caller id name for the selected extensions.";
+$text['description-outbound_caller_id_name']['pt-br'] = "Enter the new outbound caller id name for the selected extensions.";
+$text['description-outbound_caller_id_name']['pl'] = "Enter the new outbound caller id name for the selected extensions.";
+$text['description-outbound_caller_id_name']['sv-se'] = "Enter the new outbound caller id name for the selected extensions.";
+$text['description-outbound_caller_id_name']['uk'] = "Enter the new outbound caller id name for the selected extensions.";
+$text['description-outbound_caller_id_name']['de-at'] = "Enter the new outbound caller id name for the selected extensions.";
+$text['description-outbound_caller_id_name']['it-it'] = "Enter the new outbound caller id name for the selected extensions.";
+
+$text['description-outbound_caller_id_number']['en-us'] = "Enter the new outbound caller id number for the selected extensions.";
+$text['description-outbound_caller_id_number']['es-cl'] = "Enter the new outbound caller id number for the selected extensions.";
+$text['description-outbound_caller_id_number']['pt-pt'] = "Enter the new outbound caller id number for the selected extensions.";
+$text['description-outbound_caller_id_number']['fr-fr'] = "Enter the new outbound caller id number for the selected extensions.";
+$text['description-outbound_caller_id_number']['pt-br'] = "Enter the new outbound caller id number for the selected extensions.";
+$text['description-outbound_caller_id_number']['pl'] = "Enter the new outbound caller id number for the selected extensions.";
+$text['description-outbound_caller_id_number']['sv-se'] = "Enter the new outbound caller id number for the selected extensions.";
+$text['description-outbound_caller_id_number']['uk'] = "Enter the new outbound caller id number for the selected extensions.";
+$text['description-outbound_caller_id_number']['de-at'] = "Enter the new outbound caller id number for the selected extensions.";
+$text['description-outbound_caller_id_number']['it-it'] = "Enter the new outbound caller id number for the selected extensions.";
+
+$text['description-limit_max']['en-us'] = "Select the new limit max calls for the selected extensions.";
+$text['description-limit_max']['es-cl'] = "Select the new limit max calls for the selected extensions.";
+$text['description-limit_max']['pt-pt'] = "Select the new limit max calls for the selected extensions.";
+$text['description-limit_max']['fr-fr'] = "Select the new limit max calls for the selected extensions.";
+$text['description-limit_max']['pt-br'] = "Select the new limit max calls for the selected extensions.";
+$text['description-limit_max']['pl'] = "Select the new limit max calls for the selected extensions.";
+$text['description-limit_max']['sv-se'] = "Select the new limit max calls for the selected extensions.";
+$text['description-limit_max']['uk'] = "Select the new limit max calls for the selected extensions.";
+$text['description-limit_max']['de-at'] = "Select the new limit max calls for the selected extensions.";
+$text['description-limit_max']['it-it'] = "Select the new limit max calls for the selected extensions.";
+
+$text['description-toll_allow']['en-us'] = "Select the new toll allow for the selected extensions.";
+$text['description-toll_allow']['es-cl'] = "Select the new toll allow for the selected extensions.";
+$text['description-toll_allow']['pt-pt'] = "Select the new toll allow for the selected extensions.";
+$text['description-toll_allow']['fr-fr'] = "Select the new toll allow for the selected extensions.";
+$text['description-toll_allow']['pt-br'] = "Select the new toll allow for the selected extensions.";
+$text['description-toll_allow']['pl'] = "Select the new toll allow for the selected extensions.";
+$text['description-toll_allow']['sv-se'] = "Select the new toll allow for the selected extensions.";
+$text['description-toll_allow']['uk'] = "Select the new toll allow for the selected extensions.";
+$text['description-toll_allow']['de-at'] = "Select the new toll allow for the selected extensions.";
+$text['description-toll_allow']['it-it'] = "Select the new toll allow for the selected extensions.";
+
+$text['description-time_zone']['en-us'] = "Select the new timezone for the selected users.";
+$text['description-time_zone']['es-cl'] = "Select the new timezone for the selected users.";
+$text['description-time_zone']['pt-pt'] = "Select the new timezone for the selected users.";
+$text['description-time_zone']['fr-fr'] = "Select the new timezone for the selected users.";
+$text['description-time_zone']['pt-br'] = "Select the new timezone for the selected users.";
+$text['description-time_zone']['pl'] = "Select the new timezone for the selected users.";
+$text['description-time_zone']['sv-se'] = "Select the new timezone for the selected users.";
+$text['description-time_zone']['uk'] = "Select the new timezone for the selected users.";
+$text['description-time_zone']['de-at'] = "Select the new timezone for the selected users.";
+$text['description-time_zone']['it-it'] = "Select the new timezone for the selected users.";
+
+$text['description-user_enabled']['en-us'] = "Select the new enabled status for the selected users.";
+$text['description-user_enabled']['es-cl'] = "Select the new enabled status for the selected users.";
+$text['description-user_enabled']['pt-pt'] = "Select the new enabled status for the selected users.";
+$text['description-user_enabled']['fr-fr'] = "Select the new enabled status for the selected users.";
+$text['description-user_enabled']['pt-br'] = "Select the new enabled status for the selected users.";
+$text['description-user_enabled']['pl'] = "Select the new enabled status for the selected users.";
+$text['description-user_enabled']['sv-se'] = "Select the new enabled status for the selected users.";
+$text['description-user_enabled']['uk'] = "Select the new enabled status for the selected users.";
+$text['description-user_enabled']['de-at'] = "Select the new enabled status for the selected users.";
+$text['description-user_enabled']['it-it'] = "Select the new enabled status for the selected users.";
+
+$text['description-user_status']['en-us'] = "Select the new status for the selected users.";
+$text['description-user_status']['es-cl'] = "Select the new status for the selected users.";
+$text['description-user_status']['pt-pt'] = "Select the new status for the selected users.";
+$text['description-user_status']['fr-fr'] = "Select the new status for the selected users.";
+$text['description-user_status']['pt-br'] = "Select the new status for the selected users.";
+$text['description-user_status']['pl'] = "Select the new status for the selected users.";
+$text['description-user_status']['sv-se'] = "Select the new status for the selected users.";
+$text['description-user_status']['uk'] = "Select the new status for the selected users.";
+$text['description-user_status']['de-at'] = "Select the new status for the selected users.";
+$text['description-user_status']['it-it'] = "Select the new status for the selected users.";
+
+$text['description-user_settings_description']['en-us'] = "Choose the setting to modify.";
+$text['description-user_settings_description']['es-cl'] = "Choose the setting to modify.";
+$text['description-user_settings_description']['pt-pt'] = "Choose the setting to modify.";
+$text['description-user_settings_description']['fr-fr'] = "Choose the setting to modify.";
+$text['description-user_settings_description']['pt-br'] = "Choose the setting to modify.";
+$text['description-user_settings_description']['pl'] = "Choose the setting to modify.";
+$text['description-user_settings_description']['sv-se'] = "Choose the setting to modify.";
+$text['description-user_settings_description']['uk'] = "Choose the setting to modify.";
+$text['description-user_settings_description']['de-at'] = "Choose the setting to modify.";
+$text['description-user_settings_description']['it-it'] = "Choose the setting to modify.";
+
+$text['description-voicemail_settings_description']['en-us'] = "Choose the setting to modify.";
+$text['description-voicemail_settings_description']['es-cl'] = "Choose the setting to modify.";
+$text['description-voicemail_settings_description']['pt-pt'] = "Choose the setting to modify.";
+$text['description-voicemail_settings_description']['fr-fr'] = "Choose the setting to modify.";
+$text['description-voicemail_settings_description']['pt-br'] = "Choose the setting to modify.";
+$text['description-voicemail_settings_description']['pl'] = "Choose the setting to modify.";
+$text['description-voicemail_settings_description']['sv-se'] = "Choose the setting to modify.";
+$text['description-voicemail_settings_description']['uk'] = "Choose the setting to modify.";
+$text['description-voicemail_settings_description']['de-at'] = "Choose the setting to modify.";
+$text['description-voicemail_settings_description']['it-it'] = "Choose the setting to modify.";
+
+$text['header-bulk_account_settings']['en-us'] = "Bulk Account Settings";
+$text['header-bulk_account_settings']['es-cl'] = "Bulk Account Settings";
+$text['header-bulk_account_settings']['pt-pt'] = "Bulk Account Settings";
+$text['header-bulk_account_settings']['fr-fr'] = "Bulk Account Settings";
+$text['header-bulk_account_settings']['pt-br'] = "Bulk Account Settings";
+$text['header-bulk_account_settings']['pl'] = "Bulk Account Settings";
+$text['header-bulk_account_settings']['sv-se'] = "Bulk Account Settings";
+$text['header-bulk_account_settings']['uk'] = "Bulk Account Settings";
+$text['header-bulk_account_settings']['de-at'] = "Bulk Account Settings";
+$text['header-bulk_account_settings']['it-it'] = "Bulk Account Settings";
+
+$text['header-extensions']['en-us'] = "Extensions";
+$text['header-extensions']['es-cl'] = "Extensions";
+$text['header-extensions']['pt-pt'] = "Extensions";
+$text['header-extensions']['fr-fr'] = "Extensions";
+$text['header-extensions']['pt-br'] = "Extensions";
+$text['header-extensions']['pl'] = "Extensions";
+$text['header-extensions']['sv-se'] = "Extensions";
+$text['header-extensions']['uk'] = "Extensions";
+$text['header-extensions']['de-at'] = "Extensions";
+$text['header-extensions']['it-it'] = "Extensions";
+
+$text['header-users']['en-us'] = "Users";
+$text['header-users']['es-cl'] = "Users";
+$text['header-users']['pt-pt'] = "Users";
+$text['header-users']['fr-fr'] = "Users";
+$text['header-users']['pt-br'] = "Users";
+$text['header-users']['pl'] = "Users";
+$text['header-users']['sv-se'] = "Users";
+$text['header-users']['uk'] = "Users";
+$text['header-users']['de-at'] = "Users";
+$text['header-users']['it-it'] = "Users";
+
+$text['header-devices']['en-us'] = "Devices";
+$text['header-devices']['es-cl'] = "Devices";
+$text['header-devices']['pt-pt'] = "Devices";
+$text['header-devices']['fr-fr'] = "Devices";
+$text['header-devices']['pt-br'] = "Devices";
+$text['header-devices']['pl'] = "Devices";
+$text['header-devices']['sv-se'] = "Devices";
+$text['header-devices']['uk'] = "Devices";
+$text['header-devices']['de-at'] = "Devices";
+$text['header-devices']['it-it'] = "Devices";
+
+$text['header-voicemails']['en-us'] = "Voicemails";
+$text['header-voicemails']['es-cl'] = "Voicemails";
+$text['header-voicemails']['pt-pt'] = "Voicemails";
+$text['header-voicemails']['fr-fr'] = "Voicemails";
+$text['header-voicemails']['pt-br'] = "Voicemails";
+$text['header-voicemails']['pl'] = "Voicemails";
+$text['header-voicemails']['sv-se'] = "Voicemails";
+$text['header-voicemails']['uk'] = "Voicemails";
+$text['header-voicemails']['de-at'] = "Voicemails";
+$text['header-voicemails']['it-it'] = "Voicemails";
+
+$text['label-accountcode']['en-us'] = "Accountcode";
+$text['label-accountcode']['es-cl'] = "Accountcode";
+$text['label-accountcode']['pt-pt'] = "Accountcode";
+$text['label-accountcode']['fr-fr'] = "Accountcode";
+$text['label-accountcode']['pt-br'] = "Accountcode";
+$text['label-accountcode']['pl'] = "Accountcode";
+$text['label-accountcode']['sv-se'] = "Accountcode";
+$text['label-accountcode']['uk'] = "Accountcode";
+$text['label-accountcode']['de-at'] = "Accountcode";
+$text['label-accountcode']['it-it'] = "Accountcode";
+
+$text['label-call_group']['en-us'] = "Call Group";
+$text['label-call_group']['es-cl'] = "Call Group";
+$text['label-call_group']['pt-pt'] = "Call Group";
+$text['label-call_group']['fr-fr'] = "Call Group";
+$text['label-call_group']['pt-br'] = "Call Group";
+$text['label-call_group']['pl'] = "Call Group";
+$text['label-call_group']['sv-se'] = "Call Group";
+$text['label-call_group']['uk'] = "Call Group";
+$text['label-call_group']['de-at'] = "Call Group";
+$text['label-call_group']['it-it'] = "Call Group";
+
+$text['label-confirm_password']['en-us'] = "Confirm Password";
+$text['label-confirm_password']['es-cl'] = "Confirm Password";
+$text['label-confirm_password']['pt-pt'] = "Confirm Password";
+$text['label-confirm_password']['fr-fr'] = "Confirm Password";
+$text['label-confirm_password']['pt-br'] = "Confirm Password";
+$text['label-confirm_password']['pl'] = "Confirm Password";
+$text['label-confirm_password']['sv-se'] = "Confirm Password";
+$text['label-confirm_password']['uk'] = "Confirm Password";
+$text['label-confirm_password']['de-at'] = "Confirm Password";
+$text['label-confirm_password']['it-it'] = "Confirm Password";
+
+$text['label-extension']['en-us'] = "Extension";
+$text['label-extension']['es-cl'] = "Extension";
+$text['label-extension']['pt-pt'] = "Extension";
+$text['label-extension']['fr-fr'] = "Extension";
+$text['label-extension']['pt-br'] = "Extension";
+$text['label-extension']['pl'] = "Extension";
+$text['label-extension']['sv-se'] = "Extension";
+$text['label-extension']['uk'] = "Extension";
+$text['label-extension']['de-at'] = "Extension";
+$text['label-extension']['it-it'] = "Extension";
+
+$text['label-call_timeout']['en-us'] = "Call Timeout";
+$text['label-call_timeout']['es-cl'] = "Call Timeout";
+$text['label-call_timeout']['pt-pt'] = "Call Timeout";
+$text['label-call_timeout']['fr-fr'] = "Call Timeout";
+$text['label-call_timeout']['pt-br'] = "Call Timeout";
+$text['label-call_timeout']['pl'] = "Call Timeout";
+$text['label-call_timeout']['sv-se'] = "Call Timeout";
+$text['label-call_timeout']['uk'] = "Call Timeout";
+$text['label-call_timeout']['de-at'] = "Call Timeout";
+$text['label-call_timeout']['it-it'] = "Call Timeout";
+
+$text['label-group']['en-us'] = "Group";
+$text['label-group']['es-cl'] = "Group";
+$text['label-group']['pt-pt'] = "Group";
+$text['label-group']['fr-fr'] = "Group";
+$text['label-group']['pt-br'] = "Group";
+$text['label-group']['pl'] = "Group";
+$text['label-group']['sv-se'] = "Group";
+$text['label-group']['uk'] = "Group";
+$text['label-group']['de-at'] = "Group";
+$text['label-group']['it-it'] = "Group";
+
+$text['label-hold_music']['en-us'] = "Hold Music";
+$text['label-hold_music']['es-cl'] = "Hold Music";
+$text['label-hold_music']['pt-pt'] = "Hold Music";
+$text['label-hold_music']['fr-fr'] = "Hold Music";
+$text['label-hold_music']['pt-br'] = "Hold Music";
+$text['label-hold_music']['pl'] = "Hold Music";
+$text['label-hold_music']['sv-se'] = "Hold Music";
+$text['label-hold_music']['uk'] = "Hold Music";
+$text['label-hold_music']['de-at'] = "Hold Music";
+$text['label-hold_music']['it-it'] = "Hold Music";
+
+$text['label-outbound_caller_id_name']['en-us'] = "Outbound Caller ID Name";
+$text['label-outbound_caller_id_name']['es-cl'] = "Outbound Caller ID Name";
+$text['label-outbound_caller_id_name']['pt-pt'] = "Outbound Caller ID Name";
+$text['label-outbound_caller_id_name']['fr-fr'] = "Outbound Caller ID Name";
+$text['label-outbound_caller_id_name']['pt-br'] = "Outbound Caller ID Name";
+$text['label-outbound_caller_id_name']['pl'] = "Outbound Caller ID Name";
+$text['label-outbound_caller_id_name']['sv-se'] = "Outbound Caller ID Name";
+$text['label-outbound_caller_id_name']['uk'] = "Outbound Caller ID Name";
+$text['label-outbound_caller_id_name']['de-at'] = "Outbound Caller ID Name";
+$text['label-outbound_caller_id_name']['it-it'] = "Outbound Caller ID Name";
+
+$text['label-outbound_caller_id_number']['en-us'] = "Outbound Caller ID Number";
+$text['label-outbound_caller_id_number']['es-cl'] = "Outbound Caller ID Number";
+$text['label-outbound_caller_id_number']['pt-pt'] = "Outbound Caller ID Number";
+$text['label-outbound_caller_id_number']['fr-fr'] = "Outbound Caller ID Number";
+$text['label-outbound_caller_id_number']['pt-br'] = "Outbound Caller ID Number";
+$text['label-outbound_caller_id_number']['pl'] = "Outbound Caller ID Number";
+$text['label-outbound_caller_id_number']['sv-se'] = "Outbound Caller ID Number";
+$text['label-outbound_caller_id_number']['uk'] = "Outbound Caller ID Number";
+$text['label-outbound_caller_id_number']['de-at'] = "Outbound Caller ID Number";
+$text['label-outbound_caller_id_number']['it-it'] = "Outbound Caller ID Number";
+
+$text['label-password']['en-us'] = "Password";
+$text['label-password']['es-cl'] = "Password";
+$text['label-password']['pt-pt'] = "Password";
+$text['label-password']['fr-fr'] = "Password";
+$text['label-password']['pt-br'] = "Password";
+$text['label-password']['pl'] = "Password";
+$text['label-password']['sv-se'] = "Password";
+$text['label-password']['uk'] = "Password";
+$text['label-password']['de-at'] = "Password";
+$text['label-password']['it-it'] = "Password";
+
+$text['label-user_status']['en-us'] = "Status";
+$text['label-user_status']['es-cl'] = "Status";
+$text['label-user_status']['pt-pt'] = "Status";
+$text['label-user_status']['fr-fr'] = "Status";
+$text['label-user_status']['pt-br'] = "Status";
+$text['label-user_status']['pl'] = "Status";
+$text['label-user_status']['sv-se'] = "Status";
+$text['label-user_status']['uk'] = "Status";
+$text['label-user_status']['de-at'] = "Status";
+$text['label-user_status']['it-it'] = "Status";
+
+$text['label-time_zone']['en-us'] = "Timezone";
+$text['label-time_zone']['es-cl'] = "Timezone";
+$text['label-time_zone']['pt-pt'] = "Timezone";
+$text['label-time_zone']['fr-fr'] = "Timezone";
+$text['label-time_zone']['pt-br'] = "Timezone";
+$text['label-time_zone']['pl'] = "Timezone";
+$text['label-time_zone']['sv-se'] = "Timezone";
+$text['label-time_zone']['uk'] = "Timezone";
+$text['label-time_zone']['de-at'] = "Timezone";
+$text['label-time_zone']['it-it'] = "Timezone";
+
+$text['label-emergency_caller_id_name']['en-us'] = "Emergency Caller ID Name";
+$text['label-emergency_caller_id_name']['es-cl'] = "Emergency Caller ID Name";
+$text['label-emergency_caller_id_name']['pt-pt'] = "Emergency Caller ID Name";
+$text['label-emergency_caller_id_name']['fr-fr'] = "Emergency Caller ID Name";
+$text['label-emergency_caller_id_name']['pt-br'] = "Emergency Caller ID Name";
+$text['label-emergency_caller_id_name']['pl'] = "Emergency Caller ID Name";
+$text['label-emergency_caller_id_name']['sv-se'] = "Emergency Caller ID Name";
+$text['label-emergency_caller_id_name']['uk'] = "Emergency Caller ID Name";
+$text['label-emergency_caller_id_name']['de-at'] = "Emergency Caller ID Name";
+$text['label-emergency_caller_id_name']['it-it'] = "Emergency Caller ID Name";
+
+$text['label-emergency_caller_id_number']['en-us'] = "Emergency Caller ID Number";
+$text['label-emergency_caller_id_number']['es-cl'] = "Emergency Caller ID Number";
+$text['label-emergency_caller_id_number']['pt-pt'] = "Emergency Caller ID Number";
+$text['label-emergency_caller_id_number']['fr-fr'] = "Emergency Caller ID Number";
+$text['label-emergency_caller_id_number']['pt-br'] = "Emergency Caller ID Number";
+$text['label-emergency_caller_id_number']['pl'] = "Emergency Caller ID Number";
+$text['label-emergency_caller_id_number']['sv-se'] = "Emergency Caller ID Number";
+$text['label-emergency_caller_id_number']['uk'] = "Emergency Caller ID Number";
+$text['label-emergency_caller_id_number']['de-at'] = "Emergency Caller ID Number";
+$text['label-emergency_caller_id_number']['it-it'] = "Emergency Caller ID Number";
+
+$text['label-limit_max']['en-us'] = "Limit Max";
+$text['label-limit_max']['es-cl'] = "Limit Max";
+$text['label-limit_max']['pt-pt'] = "Limit Max";
+$text['label-limit_max']['fr-fr'] = "Limit Max";
+$text['label-limit_max']['pt-br'] = "Limit Max";
+$text['label-limit_max']['pl'] = "Limit Max";
+$text['label-limit_max']['sv-se'] = "Limit Max";
+$text['label-limit_max']['uk'] = "Limit Max";
+$text['label-limit_max']['de-at'] = "Limit Max";
+$text['label-limit_max']['it-it'] = "Limit Max";
+
+$text['label-toll_allow']['en-us'] = "Toll Allow";
+$text['label-toll_allow']['es-cl'] = "Toll Allow";
+$text['label-toll_allow']['pt-pt'] = "Toll Allow";
+$text['label-toll_allow']['fr-fr'] = "Toll Allow";
+$text['label-toll_allow']['pt-br'] = "Toll Allow";
+$text['label-toll_allow']['pl'] = "Toll Allow";
+$text['label-toll_allow']['sv-se'] = "Toll Allow";
+$text['label-toll_allow']['uk'] = "Toll Allow";
+$text['label-toll_allow']['de-at'] = "Toll Allow";
+$text['label-toll_allow']['it-it'] = "Toll Allow";
+
+$text['label-username']['en-us'] = "Username";
+$text['label-username']['es-cl'] = "Username";
+$text['label-username']['pt-pt'] = "Username";
+$text['label-username']['fr-fr'] = "Username";
+$text['label-username']['pt-br'] = "Username";
+$text['label-username']['pl'] = "Username";
+$text['label-username']['sv-se'] = "Username";
+$text['label-username']['uk'] = "Username";
+$text['label-username']['de-at'] = "Username";
+$text['label-username']['it-it'] = "Username";
+
+$text['label-user_enabled']['en-us'] = "Enabled";
+$text['label-user_enabled']['es-cl'] = "Enabled";
+$text['label-user_enabled']['pt-pt'] = "Enabled";
+$text['label-user_enabled']['fr-fr'] = "Enabled";
+$text['label-user_enabled']['pt-br'] = "Enabled";
+$text['label-user_enabled']['pl'] = "Enabled";
+$text['label-user_enabled']['sv-se'] = "Enabled";
+$text['label-user_enabled']['uk'] = "Enabled";
+$text['label-user_enabled']['de-at'] = "Enabled";
+$text['label-user_enabled']['it-it'] = "Enabled";
+
+$text['label-device_label']['en-us'] = "Label";
+$text['label-device_label']['es-cl'] = "Label";
+$text['label-device_label']['pt-pt'] = "Label";
+$text['label-device_label']['fr-fr'] = "Label";
+$text['label-device_label']['pt-br'] = "Label";
+$text['label-device_label']['pl'] = "Label";
+$text['label-device_label']['sv-se'] = "Label";
+$text['label-device_label']['uk'] = "Label";
+$text['label-device_label']['de-at'] = "Label";
+$text['label-device_label']['it-it'] = "Label";
+
+$text['label-device_vendor']['en-us'] = "Vendor";
+$text['label-device_vendor']['es-cl'] = "Vendor";
+$text['label-device_vendor']['pt-pt'] = "Vendor";
+$text['label-device_vendor']['fr-fr'] = "Vendor";
+$text['label-device_vendor']['pt-br'] = "Vendor";
+$text['label-device_vendor']['pl'] = "Vendor";
+$text['label-device_vendor']['sv-se'] = "Vendor";
+$text['label-device_vendor']['uk'] = "Vendor";
+$text['label-device_vendor']['de-at'] = "Vendor";
+$text['label-device_vendor']['it-it'] = "Vendor";
+
+$text['label-device_template']['en-us'] = "Template";
+$text['label-device_template']['es-cl'] = "Template";
+$text['label-device_template']['pt-pt'] = "Template";
+$text['label-device_template']['fr-fr'] = "Template";
+$text['label-device_template']['pt-br'] = "Template";
+$text['label-device_template']['pl'] = "Template";
+$text['label-device_template']['sv-se'] = "Template";
+$text['label-device_template']['uk'] = "Template";
+$text['label-device_template']['de-at'] = "Template";
+$text['label-device_template']['it-it'] = "Template";
+
+$text['label-device_profile']['en-us'] = "Profile";
+$text['label-device_profile']['es-cl'] = "Profile";
+$text['label-device_profile']['pt-pt'] = "Profile";
+$text['label-device_profile']['fr-fr'] = "Profile";
+$text['label-device_profile']['pt-br'] = "Profile";
+$text['label-device_profile']['pl'] = "Profile";
+$text['label-device_profile']['sv-se'] = "Profile";
+$text['label-device_profile']['uk'] = "Profile";
+$text['label-device_profile']['de-at'] = "Profile";
+$text['label-device_profile']['it-it'] = "Profile";
+
+$text['label-device_enabled']['en-us'] = "Enabled";
+$text['label-device_enabled']['es-cl'] = "Enabled";
+$text['label-device_enabled']['pt-pt'] = "Enabled";
+$text['label-device_enabled']['fr-fr'] = "Enabled";
+$text['label-device_enabled']['pt-br'] = "Enabled";
+$text['label-device_enabled']['pl'] = "Enabled";
+$text['label-device_enabled']['sv-se'] = "Enabled";
+$text['label-device_enabled']['uk'] = "Enabled";
+$text['label-device_enabled']['de-at'] = "Enabled";
+$text['label-device_enabled']['it-it'] = "Enabled";
+
+$text['label-device_description']['en-us'] = "Description";
+$text['label-device_description']['es-cl'] = "Description";
+$text['label-device_description']['pt-pt'] = "Description";
+$text['label-device_description']['fr-fr'] = "Description";
+$text['label-device_description']['pt-br'] = "Description";
+$text['label-device_description']['pl'] = "Description";
+$text['label-device_description']['sv-se'] = "Description";
+$text['label-device_description']['uk'] = "Description";
+$text['label-device_description']['de-at'] = "Description";
+$text['label-device_description']['it-it'] = "Description";
+
+$text['label-device_mac_address']['en-us'] = "MAC Address";
+$text['label-device_mac_address']['es-cl'] = "MAC Address";
+$text['label-device_mac_address']['pt-pt'] = "MAC Address";
+$text['label-device_mac_address']['fr-fr'] = "MAC Address";
+$text['label-device_mac_address']['pt-br'] = "MAC Address";
+$text['label-device_mac_address']['pl'] = "MAC Address";
+$text['label-device_mac_address']['sv-se'] = "MAC Address";
+$text['label-device_mac_address']['uk'] = "MAC Address";
+$text['label-device_mac_address']['de-at'] = "MAC Address";
+$text['label-device_mac_address']['it-it'] = "MAC Address";
+
+$text['label-voicemail_file']['en-us'] = "Voicemail File";
+$text['label-voicemail_file']['es-cl'] = "Voicemail File";
+$text['label-voicemail_file']['pt-pt'] = "Voicemail File";
+$text['label-voicemail_file']['fr-fr'] = "Voicemail File";
+$text['label-voicemail_file']['pt-br'] = "Voicemail File";
+$text['label-voicemail_file']['pl'] = "Voicemail File";
+$text['label-voicemail_file']['sv-se'] = "Voicemail File";
+$text['label-voicemail_file']['uk'] = "Voicemail File";
+$text['label-voicemail_file']['de-at'] = "Voicemail File";
+$text['label-voicemail_file']['it-it'] = "Voicemail File";
+
+$text['label-voicemail_description']['en-us'] = "Description";
+$text['label-voicemail_description']['es-cl'] = "Description";
+$text['label-voicemail_description']['pt-pt'] = "Description";
+$text['label-voicemail_description']['fr-fr'] = "Description";
+$text['label-voicemail_description']['pt-br'] = "Description";
+$text['label-voicemail_description']['pl'] = "Description";
+$text['label-voicemail_description']['sv-se'] = "Description";
+$text['label-voicemail_description']['uk'] = "Description";
+$text['label-voicemail_description']['de-at'] = "Description";
+$text['label-voicemail_description']['it-it'] = "Description";
+
+$text['label-voicemail_null']['en-us'] = " ";
+$text['label-voicemail_null']['es-cl'] = " ";
+$text['label-voicemail_null']['pt-pt'] = " ";
+$text['label-voicemail_null']['fr-fr'] = " ";
+$text['label-voicemail_null']['pt-br'] = " ";
+$text['label-voicemail_null']['pl'] = " ";
+$text['label-voicemail_null']['sv-se'] = " ";
+$text['label-voicemail_null']['uk'] = " ";
+$text['label-voicemail_null']['de-at'] = " ";
+$text['label-voicemail_null']['it-it'] = " ";
+
+$text['label-voicemail_enabled']['en-us'] = "Enabled";
+$text['label-voicemail_enabled']['es-cl'] = "Enabled";
+$text['label-voicemail_enabled']['pt-pt'] = "Enabled";
+$text['label-voicemail_enabled']['fr-fr'] = "Enabled";
+$text['label-voicemail_enabled']['pt-br'] = "Enabled";
+$text['label-voicemail_enabled']['pl'] = "Enabled";
+$text['label-voicemail_enabled']['sv-se'] = "Enabled";
+$text['label-voicemail_enabled']['uk'] = "Enabled";
+$text['label-voicemail_enabled']['de-at'] = "Enabled";
+$text['label-voicemail_enabled']['it-it'] = "Enabled";
+
+$text['label-voicemail_id']['en-us'] = "Voicemail ID";
+$text['label-voicemail_id']['es-cl'] = "Voicemail ID";
+$text['label-voicemail_id']['pt-pt'] = "Voicemail ID";
+$text['label-voicemail_id']['fr-fr'] = "Voicemail ID";
+$text['label-voicemail_id']['pt-br'] = "Voicemail ID";
+$text['label-voicemail_id']['pl'] = "Voicemail ID";
+$text['label-voicemail_id']['sv-se'] = "Voicemail ID";
+$text['label-voicemail_id']['uk'] = "Voicemail ID";
+$text['label-voicemail_id']['de-at'] = "Voicemail ID";
+$text['label-voicemail_id']['it-it'] = "Voicemail ID";
+
+$text['label-voicemail_local_after_email']['en-us'] = "Keep Local";
+$text['label-voicemail_local_after_email']['es-cl'] = "Keep Local";
+$text['label-voicemail_local_after_email']['pt-pt'] = "Keep Local";
+$text['label-voicemail_local_after_email']['fr-fr'] = "Keep Local";
+$text['label-voicemail_local_after_email']['pt-br'] = "Keep Local";
+$text['label-voicemail_local_after_email']['pl'] = "Keep Local";
+$text['label-voicemail_local_after_email']['sv-se'] = "Keep Local";
+$text['label-voicemail_local_after_email']['uk'] = "Keep Local";
+$text['label-voicemail_local_after_email']['de-at'] = "Keep Local";
+$text['label-voicemail_local_after_email']['it-it'] = "Keep Local";
+
+$text['label-voicemail_password']['en-us'] = "Voicemail Password";
+$text['label-voicemail_password']['es-cl'] = "Voicemail Password";
+$text['label-voicemail_password']['pt-pt'] = "Voicemail Password";
+$text['label-voicemail_password']['fr-fr'] = "Voicemail Password";
+$text['label-voicemail_password']['pt-br'] = "Voicemail Password";
+$text['label-voicemail_password']['pl'] = "Voicemail Password";
+$text['label-voicemail_password']['sv-se'] = "Voicemail Password";
+$text['label-voicemail_password']['uk'] = "Voicemail Password";
+$text['label-voicemail_password']['de-at'] = "Voicemail Password";
+$text['label-voicemail_password']['it-it'] = "Voicemail Password";
+
+$text['label-voicemail_transcription_enabled']['en-us'] = "Transcription Enabled";
+$text['label-voicemail_transcription_enabled']['es-cl'] = "Transcription Enabled";
+$text['label-voicemail_transcription_enabled']['pt-pt'] = "Transcription Enabled";
+$text['label-voicemail_transcription_enabled']['fr-fr'] = "Transcription Enabled";
+$text['label-voicemail_transcription_enabled']['pt-br'] = "Transcription Enabled";
+$text['label-voicemail_transcription_enabled']['pl'] = "Transcription Enabled";
+$text['label-voicemail_transcription_enabled']['sv-se'] = "Transcription Enabled";
+$text['label-voicemail_transcription_enabled']['uk'] = "Transcription Enabled";
+$text['label-voicemail_transcription_enabled']['de-at'] = "Transcription Enabled";
+$text['label-voicemail_transcription_enabled']['it-it'] = "Transcription Enabled";
+
+$text['option-available']['en-us'] = "Available";
+$text['option-available']['es-cl'] = "Available";
+$text['option-available']['pt-pt'] = "Available";
+$text['option-available']['fr-fr'] = "Available";
+$text['option-available']['pt-br'] = "Available";
+$text['option-available']['pl'] = "Available";
+$text['option-available']['sv-se'] = "Available";
+$text['option-available']['uk'] = "Available";
+$text['option-available']['de-at'] = "Available";
+$text['option-available']['it-it'] = "Available";
+
+$text['option-available_on_demand']['en-us'] = "Available (On Demand)";
+$text['option-available_on_demand']['es-cl'] = "Available (On Demand)";
+$text['option-available_on_demand']['pt-pt'] = "Available (On Demand)";
+$text['option-available_on_demand']['fr-fr'] = "Available (On Demand)";
+$text['option-available_on_demand']['pt-br'] = "Available (On Demand)";
+$text['option-available_on_demand']['pl'] = "Available (On Demand)";
+$text['option-available_on_demand']['sv-se'] = "Available (On Demand)";
+$text['option-available_on_demand']['uk'] = "Available (On Demand)";
+$text['option-available_on_demand']['de-at'] = "Available (On Demand)";
+$text['option-available_on_demand']['it-it'] = "Available (On Demand)";
+
+$text['option-logged_out']['en-us'] = "Logged Out";
+$text['option-logged_out']['es-cl'] = "Logged Out";
+$text['option-logged_out']['pt-pt'] = "Logged Out";
+$text['option-logged_out']['fr-fr'] = "Logged Out";
+$text['option-logged_out']['pt-br'] = "Logged Out";
+$text['option-logged_out']['pl'] = "Logged Out";
+$text['option-logged_out']['sv-se'] = "Logged Out";
+$text['option-logged_out']['uk'] = "Logged Out";
+$text['option-logged_out']['de-at'] = "Logged Out";
+$text['option-logged_out']['it-it'] = "Logged Out";
+
+$text['option-on_break']['en-us'] = "On Break";
+$text['option-on_break']['es-cl'] = "On Break";
+$text['option-on_break']['pt-pt'] = "On Break";
+$text['option-on_break']['fr-fr'] = "On Break";
+$text['option-on_break']['pt-br'] = "On Break";
+$text['option-on_break']['pl'] = "On Break";
+$text['option-on_break']['sv-se'] = "On Break";
+$text['option-on_break']['uk'] = "On Break";
+$text['option-on_break']['de-at'] = "On Break";
+$text['option-on_break']['it-it'] = "On Break";
+
+$text['option-do_not_disturb']['en-us'] = "Do Not Disturb";
+$text['option-do_not_disturb']['es-cl'] = "Do Not Disturb";
+$text['option-do_not_disturb']['pt-pt'] = "Do Not Disturb";
+$text['option-do_not_disturb']['fr-fr'] = "Do Not Disturb";
+$text['option-do_not_disturb']['pt-br'] = "Do Not Disturb";
+$text['option-do_not_disturb']['pl'] = "Do Not Disturb";
+$text['option-do_not_disturb']['sv-se'] = "Do Not Disturb";
+$text['option-do_not_disturb']['uk'] = "Do Not Disturb";
+$text['option-do_not_disturb']['de-at'] = "Do Not Disturb";
+$text['option-do_not_disturb']['it-it'] = "Do Not Disturb";
+
+$text['option-voicemail_file_listen']['en-us'] = "Listen Link (Login Required)";
+$text['option-voicemail_file_listen']['es-cl'] = "Listen Link (Login Required)";
+$text['option-voicemail_file_listen']['pt-pt'] = "Listen Link (Login Required)";
+$text['option-voicemail_file_listen']['fr-fr'] = "Listen Link (Login Required)";
+$text['option-voicemail_file_listen']['pt-br'] = "Listen Link (Login Required)";
+$text['option-voicemail_file_listen']['pl'] = "Listen Link (Login Required)";
+$text['option-voicemail_file_listen']['sv-se'] = "Listen Link (Login Required)";
+$text['option-voicemail_file_listen']['uk'] = "Listen Link (Login Required)";
+$text['option-voicemail_file_listen']['de-at'] = "Listen Link (Login Required)";
+$text['option-voicemail_file_listen']['it-it'] = "Listen Link (Login Required)";
+
+$text['option-voicemail_file_link']['en-us'] = "Download Link (No Login Required)";
+$text['option-voicemail_file_link']['es-cl'] = "Download Link (No Login Required)";
+$text['option-voicemail_file_link']['pt-pt'] = "Download Link (No Login Required)";
+$text['option-voicemail_file_link']['fr-fr'] = "Download Link (No Login Required)";
+$text['option-voicemail_file_link']['pt-br'] = "Download Link (No Login Required)";
+$text['option-voicemail_file_link']['pl'] = "Download Link (No Login Required)";
+$text['option-voicemail_file_link']['sv-se'] = "Download Link (No Login Required)";
+$text['option-voicemail_file_link']['uk'] = "Download Link (No Login Required)";
+$text['option-voicemail_file_link']['de-at'] = "Download Link (No Login Required)";
+$text['option-voicemail_file_link']['it-it'] = "Download Link (No Login Required)";
+
+$text['option-voicemail_file_attach']['en-us'] = "Audio File Attachment";
+$text['option-voicemail_file_attach']['es-cl'] = "Audio File Attachment";
+$text['option-voicemail_file_attach']['pt-pt'] = "Audio File Attachment";
+$text['option-voicemail_file_attach']['fr-fr'] = "Audio File Attachment";
+$text['option-voicemail_file_attach']['pt-br'] = "Audio File Attachment";
+$text['option-voicemail_file_attach']['pl'] = "Audio File Attachment";
+$text['option-voicemail_file_attach']['sv-se'] = "Audio File Attachment";
+$text['option-voicemail_file_attach']['uk'] = "Audio File Attachment";
+$text['option-voicemail_file_attach']['de-at'] = "Audio File Attachment";
+$text['option-voicemail_file_attach']['it-it'] = "Audio File Attachment";
+
+$text['title-users_settings']['en-us'] = "User Settings";
+$text['title-users_settings']['es-cl'] = "User Settings";
+$text['title-users_settings']['pt-pt'] = "User Settings";
+$text['title-users_settings']['fr-fr'] = "User Settings";
+$text['title-users_settings']['pt-br'] = "User Settings";
+$text['title-users_settings']['pl'] = "User Settings";
+$text['title-users_settings']['sv-se'] = "User Settings";
+$text['title-users_settings']['uk'] = "User Settings";
+$text['title-users_settings']['de-at'] = "User Settings";
+$text['title-users_settings']['it-it'] = "User Settings";
+
+$text['title-devices_settings']['en-us'] = "Device Settings";
+$text['title-devices_settings']['es-cl'] = "Device Settings";
+$text['title-devices_settings']['pt-pt'] = "Device Settings";
+$text['title-devices_settings']['fr-fr'] = "Device Settings";
+$text['title-devices_settings']['pt-br'] = "Device Settings";
+$text['title-devices_settings']['pl'] = "Device Settings";
+$text['title-devices_settings']['sv-se'] = "Device Settings";
+$text['title-devices_settings']['uk'] = "Device Settings";
+$text['title-devices_settings']['de-at'] = "Device Settings";
+$text['title-devices_settings']['it-it'] = "Device Settings";
+?>

+ 11 - 0
bulk_account_settings/app_menu.php

@@ -0,0 +1,11 @@
+<?php
+
+$apps[$x]['menu'][0]['title']['en-us'] = "Bulk Account Settings";
+$apps[$x]['menu'][0]['uuid'] = "cdfd8c74-d086-4a49-a7e6-3b702953d554";
+$apps[$x]['menu'][0]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
+$apps[$x]['menu'][0]['category'] = "internal";
+$apps[$x]['menu'][0]['path'] = "/app/bulk_account_settings/bulk_account_settings.php";
+$apps[$x]['menu'][0]['groups'][] = "superadmin";
+
+
+?>

+ 71 - 0
bulk_account_settings/bulk_account_settings.php

@@ -0,0 +1,71 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2016
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	KonradSC <[email protected]>
+*/
+
+//includes
+	include "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+	require_once "resources/paging.php";
+
+//include the class
+	require_once "resources/check_auth.php";
+
+//check permissions
+	require_once "resources/check_auth.php";
+	if (permission_exists('bulk_account_settings_view')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+	
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+	
+	
+//show the content
+	echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
+	echo "  <tr>\n";
+	echo "	<td align='left' width='100%'>\n";
+	echo "		<b>".$text['header-bulk_account_settings']." </b><br>\n";
+	echo "	</td>\n";
+	echo "		<td align='right' width='100%' style='vertical-align: top;'>";
+	echo "		<form method='get' action=''>\n";
+	echo "			<td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
+	echo 				"<input type='button' class='btn' alt='".$text['button-devices']."' onclick=\"window.location='bulk_account_settings_devices.php'\" value='".$text['button-devices']."'>\n";
+	echo 				"<input type='button' class='btn' alt='".$text['button-extensions']."' onclick=\"window.location='bulk_account_settings_extensions.php'\" value='".$text['button-extensions']."'>\n";
+	echo 				"<input type='button' class='btn' alt='".$text['button-users']."' onclick=\"window.location='bulk_account_settings_users.php'\" value='".$text['button-users']."'>\n";
+	echo 				"<input type='button' class='btn' alt='".$text['button-voicemails']."' onclick=\"window.location='bulk_account_settings_voicemails.php'\" value='".$text['button-voicemails']."'>\n";
+//	echo 				"<input type='button' class='btn' alt='".$text['button-call_routing']."' onclick=\"window.location='bulk_account_settings_call_routing.php'\" value='".$text['button-call_routing']."'>\n";
+	echo "			</td>\n";
+	echo "		</form>\n";	
+	echo "  </tr>\n";
+	echo "  </table>\n";
+//show the footer
+	require_once "resources/footer.php";
+?>

+ 355 - 0
bulk_account_settings/bulk_account_settings_devices.php

@@ -0,0 +1,355 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2016
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	KonradSC <[email protected]>
+*/
+
+//includes
+	include "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+	require_once "resources/paging.php";
+
+//include the class
+	require_once "resources/check_auth.php";
+
+//check permissions
+	require_once "resources/check_auth.php";
+	if (permission_exists('bulk_account_settings_devices')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+	
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get the http values and set them as variables
+	$order_by = check_str($_GET["order_by"]);
+	$order = check_str($_GET["order"]);
+	$option_selected = check_str($_GET["option_selected"]);
+	
+//	if (count($_POST)>0) {
+//		$option_selected = check_str($_POST["option_selected"]);
+//	}
+	
+//handle search term
+	$search = check_str($_GET["search"]);
+	if (strlen($search) > 0) {
+		$sql_mod = "and ( ";
+		$sql_mod .= "device_mac_address ILIKE '%".$search."%' ";
+		$sql_mod .= "or device_label ILIKE '%".$search."%' ";		
+		$sql_mod .= "or device_vendor ILIKE '%".$search."%' ";
+		$sql_mod .= "or device_model ILIKE '%".$search."%' ";
+		$sql_mod .= "or device_description ILIKE '%".$search."%' ";
+		$sql_mod .= "or device_template ILIKE '%".$search."%' ";		
+		$sql_mod .= ") ";
+	}
+	if (strlen($order_by) < 1) {
+		$order_by = "device_label";
+		$order = "ASC";
+	}
+
+	$domain_uuid = $_SESSION['domain_uuid'];
+	
+
+//get total device count from the database
+	$sql = "select count(*) as num_rows from v_devices where domain_uuid = '".$_SESSION['domain_uuid']."' ".$sql_mod." ";
+	$prep_statement = $db->prepare($sql);
+	if ($prep_statement) {
+		$prep_statement->execute();
+		$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
+		$total_devices = $row['num_rows'];
+		if (($db_type == "pgsql") or ($db_type == "mysql")) {
+			$numeric_devices = $row['num_rows'];
+		}
+	}
+	unset($prep_statement, $row);
+
+//prepare to page the results
+	$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+	$param = "&search=".$search."&option_selected=".$option_selected;
+	if (!isset($_GET['page'])) { $_GET['page'] = 0; }
+	$_GET['page'] = check_str($_GET['page']);
+	list($paging_controls_mini, $rows_per_page, $var_3) = paging($total_devices, $param, $rows_per_page, true); //top
+	list($paging_controls, $rows_per_page, $var_3) = paging($total_devices, $param, $rows_per_page); //bottom
+	$offset = $rows_per_page * $_GET['page'];
+
+//get all the devices from the database
+	$sql = "SELECT \n";
+	$sql .= "d.device_uuid, \n";
+	$sql .= "d.device_label, \n";
+	$sql .= "d.device_mac_address, \n";
+	$sql .= "d.device_vendor, \n";
+	$sql .= "d.device_template, \n";
+	$sql .= "d.device_enabled, \n";
+	$sql .= "d.device_description, \n";
+	$sql .= "(\n";
+	$sql .= "select dp.device_profile_name from v_device_profiles as dp \n";
+	$sql .= "where d.device_profile_uuid = dp.device_profile_uuid \n";
+	$sql .= ") as device_profile_name \n";
+	$sql .= "FROM v_devices as d \n";
+	$sql .= "WHERE domain_uuid = '$domain_uuid' \n";
+	$sql .= $sql_mod; //add search mod from above
+	$sql .= "ORDER BY ".$order_by." ".$order." \n";
+	$sql .= "limit $rows_per_page offset $offset ";
+	$database = new database;
+	$database->select($sql);
+	$directory = $database->result;
+	unset($database,$result);
+
+//additional includes
+	require_once "resources/header.php";
+	$document['title'] = $text['title-devices_settings'];
+
+//set the alternating styles
+	$c = 0;
+	$row_style["0"] = "row_style0";
+	$row_style["1"] = "row_style1";
+	
+//show the content
+	echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
+	echo "  <tr>\n";
+	echo "	<td align='left' width='100%'>\n";
+	echo "		<b>".$text['header-devices']." (".$numeric_devices.")</b><br>\n";
+
+//options list
+		echo "<form name='frm' method='get' id=option_selected>\n";
+		echo "    <select class='formfld' name='option_selected'  onchange=\"this.form.submit();\">\n";
+		echo "    <option value=''>".$text['label-devices_null']."</option>\n";
+		if ($option_selected == "device_enabled") {
+			echo "    <option value='device_enabled' selected='selected'>".$text['label-enabled']."</option>\n";
+		}
+		else {
+			echo "    <option value='device_enabled'>".$text['label-enabled']."</option>\n";
+		}
+		if ($option_selected == "device_profile_uuid") {
+			echo "    <option value='device_profile_uuid' selected='selected'>".$text['label-device_profile']."</option>\n";
+		}
+		else {
+			echo "    <option value='device_profile_uuid'>".$text['label-device_profile']."</option>\n";
+		}
+		if ($option_selected == "device_template") {
+			echo "    <option value='device_template' selected='selected'>".$text['label-device_template']."</option>\n";
+		}
+		else {
+			echo "    <option value='device_template'>".$text['label-device_template']."</option>\n";
+		}
+
+		echo "    </select>\n";
+		echo "    </form>\n";
+		echo "<br />\n";
+		echo $text['description-device_settings_description']."\n";
+		echo "</td>\n";
+	
+	
+	
+	echo "		<td align='right' width='100%' style='vertical-align: top;'>";
+	echo "		<form method='get' action=''>\n";
+	echo "			<td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
+	echo "				<input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='bulk_account_settings.php'\" value='".$text['button-back']."'>\n";	
+	echo "				<input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>";
+	echo "				<input type='hidden' class='txt' style='width: 150px' name='option_selected' id='option_selected' value='".$option_selected."'>";
+	echo "				<input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
+	if ($paging_controls_mini != '') {
+		echo 			"<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
+	}
+	echo "			</td>\n";
+	echo "		</form>\n";	
+	echo "  </tr>\n";
+	
+	
+	echo "	<tr>\n";
+	echo "		<td colspan='2'>\n";
+	echo "			".$text['description-devices_settings']."\n";
+	echo "		</td>\n";
+	echo "	</tr>\n";
+	echo "</table>\n";
+	echo "<br />";
+
+	if (strlen($option_selected) > 0) {
+		echo "<form name='devices' method='post' action='bulk_account_settings_devices_update.php'>\n";
+		echo "<input class='formfld' type='hidden' name='option_selected' maxlength='255' value=\"$option_selected\">\n";
+		echo "<table width='auto' border='0' cellpadding='0' cellspacing='0'>\n";
+		echo "<tr>\n";
+		//option is Enabled
+		if($option_selected == 'device_enabled') {
+			echo "<td class='vtable' align='left'>\n";
+			echo "    <select class='formfld' name='new_setting'>\n";
+			echo "    <option value='true'>".$text['label-true']."</option>\n";
+			echo "    <option value='false'>".$text['label-false']."</option>\n";
+			echo "    </select>\n";
+			echo "    <br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+
+		//option is Device Profile
+		if($option_selected == 'device_profile_uuid' && permission_exists('device_profile_edit')) {
+			$sql = "select * from v_device_profiles ";
+			$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
+			$sql .= "order by device_profile_name asc ";
+			$prep_statement = $db->prepare(check_sql($sql));
+			$prep_statement->execute();
+			$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+			$result_count = count($result);
+			unset ($prep_statement, $sql);
+			if ($result_count > 0) {
+			echo "<td class='vtable' align='left'>\n";
+			echo "    <select class='formfld' name='new_setting'>\n";
+			echo "				<option value=''></option>\n";
+			foreach($result as $row) {
+				echo "			<option value='".$row['device_profile_uuid']."' ".(($row['device_profile_uuid'] == $device_profile_uuid) ? "selected='selected'" : null).">".$row['device_profile_name']." ".(($row['domain_uuid'] == '') ? "&nbsp;&nbsp;(".$text['select-global'].")" : null)."</option>\n";
+			}
+			//echo "			</select>\n";
+			echo "    </select>\n";
+			echo "    <br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+			}
+		}
+
+		//option is Device Templates
+		if($option_selected == 'device_template' && permission_exists('device_template')) {
+			$device = new device;
+			$template_dir = $device->get_template_dir();
+			
+			echo "<td class='vtable' align='left'>\n";
+			echo "    <select class='formfld' name='new_setting'>\n";
+			echo "<option value=''></option>\n";
+			if (is_dir($template_dir)) {
+					$templates = scandir($template_dir);
+					foreach($templates as $dir) {
+						if($file != "." && $dir != ".." && $dir[0] != '.') {
+							if(is_dir($template_dir . "/" . $dir)) {
+								echo "<optgroup label='$dir'>";
+								$dh_sub=$template_dir . "/" . $dir;
+								if(is_dir($dh_sub)) {
+									$templates_sub = scandir($dh_sub);
+									foreach($templates_sub as $dir_sub) {
+										if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') {
+											if(is_dir($template_dir . '/' . $dir .'/'. $dir_sub)) {
+												if ($device_template == $dir."/".$dir_sub) {
+													echo "<option value='".$dir."/".$dir_sub."' selected='selected'>".$dir."/".$dir_sub."</option>\n";
+												}
+												else {
+													echo "<option value='".$dir."/".$dir_sub."'>".$dir."/".$dir_sub."</option>\n";
+												}
+											}
+										}
+									}
+								}
+								echo "</optgroup>";
+							}
+						}
+					}
+				}
+			echo "</select>\n";
+			echo "    <br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+
+		echo "<td align='left'>\n";
+		echo "<input type='button' class='btn' alt='".$text['button-submit']."' onclick=\"if (confirm('".$text['confirm-update']."')) { document.forms.devices.submit(); }\" value='".$text['button-submit']."'>\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+		echo "</table>";
+		echo "<br />";
+	}
+	echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+	echo "<tr>\n";
+	if (is_array($directory)) {
+		echo "<th style='width: 30px; text-align: center; padding: 0px;'><input type='checkbox' id='chk_all' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
+	}
+	echo th_order_by('device_mac_address', $text['label-device_mac_address'], $order_by,$order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('device_label', $text['label-device_label'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");	
+	echo th_order_by('device_vendor', $text['label-device_vendor'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('device_template', $text['label-device_template'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('device_label', $text['label-device_profile'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('device_enabled', $text['label-device_enabled'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('device_description', $text['label-device_description'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo "</tr>\n";
+
+
+
+if (is_array($directory)) {
+
+		foreach($directory as $key => $row) {
+			$tr_link = (permission_exists('device_edit')) ? " href='/app/devices/device_edit.php?id=".$row['device_uuid']."'" : null;
+			echo "<tr ".$tr_link.">\n";
+
+			echo "	<td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; vertical-align: middle; padding: 0px;'>";
+			echo "		<input type='checkbox' name='id[]' id='checkbox_".$row['device_uuid']."' value='".$row['device_uuid']."' onclick=\"if (!this.checked) { document.getElementById('chk_all').checked = false; }\">";
+			echo "	</td>";
+			$device_ids[] = 'checkbox_'.$row['device_uuid'];
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['device_mac_address']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['device_label']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['device_vendor']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['device_template']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['device_profile_name']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['device_enabled']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['device_description']."&nbsp;</td>\n";
+			echo "</tr>\n";
+			$c = ($c) ? 0 : 1;
+		}
+
+		unset($directory, $row);
+	}
+
+	echo "</table>";
+	echo "</form>";
+
+	if (strlen($paging_controls) > 0) {
+		echo "<br />";
+		echo $paging_controls."\n";
+	}
+
+	echo "<br /><br />".((is_array($directory)) ? "<br /><br />" : null);
+
+	// check or uncheck all checkboxes
+	if (sizeof($device_ids) > 0) {
+		echo "<script>\n";
+		echo "	function check(what) {\n";
+		echo "		document.getElementById('chk_all').checked = (what == 'all') ? true : false;\n";
+		foreach ($device_ids as $device_id) {
+			echo "		document.getElementById('".$device_id."').checked = (what == 'all') ? true : false;\n";
+		}
+		echo "	}\n";
+		echo "</script>\n";
+	}
+
+	if (is_array($directory)) {
+		// check all checkboxes
+		key_press('ctrl+a', 'down', 'document', null, null, "check('all');", true);
+
+		// delete checked
+		key_press('delete', 'up', 'document', array('#search'), $text['confirm-delete'], 'document.forms.frm.submit();', true);
+	}
+
+//show the footer
+	require_once "resources/footer.php";
+?>

+ 93 - 0
bulk_account_settings/bulk_account_settings_devices_update.php

@@ -0,0 +1,93 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2016
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	KonradSC <[email protected]>
+*/
+
+//includes
+	include "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+
+//check permissions
+	if (permission_exists('bulk_account_settings_devices')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//check for the ids
+	if (is_array($_REQUEST) && sizeof($_REQUEST) > 0) {
+
+		$device_uuids = $_REQUEST["id"];
+		$option_selected = $_REQUEST["option_selected"];
+		$new_setting = $_REQUEST["new_setting"];
+		foreach($device_uuids as $device_uuid) {
+			$device_uuid = check_str($device_uuid);
+			if ($device_uuid != '') {
+				//get the devices array
+					$sql = "select * from v_devices ";
+					$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+					$sql .= "and device_uuid = '".$device_uuid."' ";
+					$database = new database;
+					$database->select($sql);
+					$devices = $database->result;
+					if (is_array($devices)) { 
+						foreach ($devices as &$row) {
+							$device = $row["device"];
+							//$user_context = $row["user_context"];
+						}
+						unset ($prep_statement);
+					}
+
+						$array["devices"][$i]["domain_uuid"] = $domain_uuid;
+						$array["devices"][$i]["device_uuid"] = $device_uuid;
+						$array["devices"][$i][$option_selected] = $new_setting;
+
+				
+					$database = new database;
+					$database->app_name = 'bulk_account_settings';
+					$database->app_uuid = null;
+					$database->save($array);
+					$message = $database->message;
+				
+					//echo "<pre>".print_r($message, true)."<pre>\n";
+					//exit;
+					
+					unset($database,$array,$i);
+			}
+		}
+	}
+
+//redirect the browser
+	$_SESSION["message"] = $text['message-update'];
+	header("Location: bulk_account_settings_devices.php?option_selected=".$option_selected."");
+	return;
+
+?>

+ 355 - 0
bulk_account_settings/bulk_account_settings_extensions.php

@@ -0,0 +1,355 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2016
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	KonradSC <[email protected]>
+*/
+
+//includes
+	include "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+	require_once "resources/paging.php";
+
+//include the class
+	require_once "resources/check_auth.php";
+
+//check permissions
+	require_once "resources/check_auth.php";
+	if (permission_exists('bulk_account_settings_extensions')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+	
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get the http values and set them as variables
+	$order_by = check_str($_GET["order_by"]);
+	$order = check_str($_GET["order"]);
+	$option_selected = check_str($_GET["option_selected"]);
+	
+//handle search term
+	$search = check_str($_GET["search"]);
+	if (strlen($search) > 0) {
+		$sql_mod = "and ( ";
+		$sql_mod .= "extension ILIKE '%".$search."%' ";
+		$sql_mod .= "or accountcode ILIKE '%".$search."%' ";		
+		$sql_mod .= "or call_group ILIKE '%".$search."%' ";
+		$sql_mod .= "or description ILIKE '%".$search."%' ";
+		if (($option_selected == "") or ($option_selected == 'call_group') or ($option_selected == 'accountcode')) {} else {
+			$sql_mod .= "or ".$option_selected." ILIKE '%".$search."%' ";
+		}
+		$sql_mod .= ") ";
+	}
+	if (strlen($order_by) < 1) {
+		$order_by = "extension";
+		$order = "ASC";
+	}
+
+	$domain_uuid = $_SESSION['domain_uuid'];
+	
+
+//get total extension count from the database
+	$sql = "select count(*) as num_rows from v_extensions where domain_uuid = '".$_SESSION['domain_uuid']."' ".$sql_mod." ";
+	$prep_statement = $db->prepare($sql);
+	if ($prep_statement) {
+		$prep_statement->execute();
+		$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
+		$total_extensions = $row['num_rows'];
+		if (($db_type == "pgsql") or ($db_type == "mysql")) {
+			$numeric_extensions = $row['num_rows'];
+		}
+	}
+	unset($prep_statement, $row);
+
+//prepare to page the results
+	$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+	$param = "&search=".$search."&option_selected=".$option_selected;
+	if (!isset($_GET['page'])) { $_GET['page'] = 0; }
+	$_GET['page'] = check_str($_GET['page']);
+	list($paging_controls_mini, $rows_per_page, $var_3) = paging($total_extensions, $param, $rows_per_page, true); //top
+	list($paging_controls, $rows_per_page, $var_3) = paging($total_extensions, $param, $rows_per_page); //bottom
+	$offset = $rows_per_page * $_GET['page'];
+
+//get all the extensions from the database
+	$sql = "SELECT \n";
+	$sql .= "description, \n";
+	$sql .= "extension, \n";
+	$sql .= "extension_uuid, \n";
+	if (($option_selected == "") or ($option_selected == 'call_group') or ($option_selected == 'accountcode')) {} else {
+		$sql .= "".$option_selected.", \n";
+	}
+	$sql .= "accountcode, \n";
+	$sql .= "call_group \n";
+	$sql .= "FROM v_extensions \n";
+	$sql .= "WHERE domain_uuid = '$domain_uuid' \n";
+	$sql .= $sql_mod; //add search mod from above
+	$sql .= "ORDER BY ".$order_by." ".$order." \n";
+	$sql .= "limit $rows_per_page offset $offset ";
+	$database = new database;
+	$database->select($sql);
+	$directory = $database->result;
+	unset($database,$result);
+
+
+//additional includes
+	require_once "resources/header.php";
+	$document['title'] = $text['title-extensions_settings'];
+
+//set the alternating styles
+	$c = 0;
+	$row_style["0"] = "row_style0";
+	$row_style["1"] = "row_style1";
+	
+//show the content
+	echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
+	echo "  <tr>\n";
+	echo "	<td align='left' width='100%'>\n";
+	echo "		<b>".$text['header-extensions']." (".$numeric_extensions.")</b><br>\n";
+
+//options list
+		echo "<form name='frm' method='get' id=option_selected>\n";
+		echo "    <select class='formfld' name='option_selected'  onchange=\"this.form.submit();\">\n";
+		echo "    <option value=''>".$text['label-extension_null']."</option>\n";
+		if ($option_selected == "accountcode") {
+			echo "    <option value='accountcode' selected='selected'>".$text['label-accountcode']."</option>\n";
+		}
+		else {
+			echo "    <option value='accountcode'>".$text['label-accountcode']."</option>\n";
+		}
+		if ($option_selected == "call_group") {
+			echo "    <option value='call_group' selected='selected'>".$text['label-call_group']."</option>\n";
+		}
+		else {
+			echo "    <option value='call_group'>".$text['label-call_group']."</option>\n";
+		}
+		if ($option_selected == "call_timeout") {
+			echo "    <option value='call_timeout' selected='selected'>".$text['label-call_timeout']."</option>\n";
+		}
+		else {
+			echo "    <option value='call_timeout'>".$text['label-call_timeout']."</option>\n";
+		}
+		if ($option_selected == "emergency_caller_id_name") {
+			echo "    <option value='emergency_caller_id_name' selected='selected'>".$text['label-emergency_caller_id_name']."</option>\n";
+		}
+		else {
+			echo "    <option value='emergency_caller_id_name'>".$text['label-emergency_caller_id_name']."</option>\n";
+		}
+		if ($option_selected == "emergency_caller_id_number") {
+			echo "    <option value='emergency_caller_id_number' selected='selected'>".$text['label-emergency_caller_id_number']."</option>\n";
+		}
+		else {
+			echo "    <option value='emergency_caller_id_number'>".$text['label-emergency_caller_id_number']."</option>\n";
+		}
+		if ($option_selected == "enabled") {
+			echo "    <option value='enabled' selected='selected'>".$text['label-enabled']."</option>\n";
+		}
+		else {
+			echo "    <option value='enabled'>".$text['label-enabled']."</option>\n";
+		}
+		if ($option_selected == "hold_music") {
+			echo "    <option value='hold_music' selected='selected'>".$text['label-hold_music']."</option>\n";
+		}
+		else {
+			echo "    <option value='hold_music'>".$text['label-hold_music']."</option>\n";
+		}
+		if ($option_selected == "limit_max") {
+			echo "    <option value='limit_max' selected='selected'>".$text['label-limit_max']."</option>\n";
+		}
+		else {
+			echo "    <option value='limit_max'>".$text['label-limit_max']."</option>\n";
+		}
+		if ($option_selected == "outbound_caller_id_name") {
+			echo "    <option value='outbound_caller_id_name' selected='selected'>".$text['label-outbound_caller_id_name']."</option>\n";
+		}
+		else {
+			echo "    <option value='outbound_caller_id_name'>".$text['label-outbound_caller_id_name']."</option>\n";
+		}
+		if ($option_selected == "outbound_caller_id_number") {
+			echo "    <option value='outbound_caller_id_number' selected='selected'>".$text['label-outbound_caller_id_number']."</option>\n";
+		}
+		else {
+			echo "    <option value='outbound_caller_id_number'>".$text['label-outbound_caller_id_number']."</option>\n";
+		}
+		if ($option_selected == "toll_allow") {
+			echo "    <option value='toll_allow' selected='selected'>".$text['label-toll_allow']."</option>\n";
+		}
+		else {
+			echo "    <option value='toll_allow'>".$text['label-toll_allow']."</option>\n";
+		}
+
+		echo "    </select>\n";
+		echo "    </form>\n";
+		echo "<br />\n";
+		echo $text['description-extension_settings_description']."\n";
+		echo "</td>\n";
+	
+	
+	
+	echo "		<td align='right' width='100%' style='vertical-align: top;'>";
+	echo "		<form method='get' action=''>\n";
+	echo "			<td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
+	echo "				<input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='bulk_account_settings.php'\" value='".$text['button-back']."'>\n";	
+	echo "				<input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>";
+	echo "				<input type='hidden' class='txt' style='width: 150px' name='option_selected' id='option_selected' value='".$option_selected."'>";
+	echo "				<input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
+	if ($paging_controls_mini != '') {
+		echo 			"<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
+	}
+	echo "			</td>\n";
+	echo "		</form>\n";	
+	echo "  </tr>\n";
+	
+	
+	echo "	<tr>\n";
+	echo "		<td colspan='2'>\n";
+	echo "			".$text['description-extensions_settings']."\n";
+	echo "		</td>\n";
+	echo "	</tr>\n";
+	echo "</table>\n";
+	echo "<br />";
+
+	if (strlen($option_selected) > 0) {
+		echo "<form name='extensions' method='post' action='bulk_account_settings_extensions_update.php'>\n";
+		echo "<input class='formfld' type='hidden' name='option_selected' maxlength='255' value=\"$option_selected\">\n";
+		echo "<table width='auto' border='0' cellpadding='0' cellspacing='0'>\n";
+		echo "<tr>\n";
+		//options with a free form input
+		if($option_selected == 'accountcode' || $option_selected == 'call_group' || $option_selected == 'call_timeout' || $option_selected == 'emergency_caller_id_name' || $option_selected == 'emergency_caller_id_number' || $option_selected == 'limit_max' || $option_selected == 'outbound_caller_id_name' || $option_selected == 'outbound_caller_id_number' || $option_selected == 'toll_allow') {
+			echo "<td class='vtable' align='left'>\n";
+			echo "    <input class='formfld' type='text' name='new_setting' maxlength='255' value=\"$new_setting\">\n";
+			echo "<br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+		//option is Enabled
+		if($option_selected == 'enabled') {
+			echo "<td class='vtable' align='left'>\n";
+			echo "    <select class='formfld' name='new_setting'>\n";
+			echo "    <option value='true'>".$text['label-true']."</option>\n";
+			echo "    <option value='false'>".$text['label-false']."</option>\n";
+			echo "    </select>\n";
+			echo "    <br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+		//option is hold_music
+		if($option_selected == 'hold_music') {
+			echo "<td class='vtable' align='left'>\n";
+			if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/music_on_hold')) {
+				require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php";
+				$options = '';
+				$moh = new switch_music_on_hold;
+				echo $moh->select('new_setting', $hold_music, $options);
+			}
+			$new_setting = $hold_music;
+			echo "    <br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+		echo "<td align='left'>\n";
+		echo "<input type='button' class='btn' alt='".$text['button-submit']."' onclick=\"if (confirm('".$text['confirm-update']."')) { document.forms.extensions.submit(); }\" value='".$text['button-submit']."'>\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+		echo "</table>";
+		echo "<br />";
+	}
+	echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+	echo "<tr>\n";
+	if (is_array($directory)) {
+		echo "<th style='width: 30px; text-align: center; padding: 0px;'><input type='checkbox' id='chk_all' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
+	}
+	echo th_order_by('extension', $text['label-extension'], $order_by,$order,'','',"option_selected=".$option_selected."&search=".$search."");
+	if (($option_selected == "") or ($option_selected == 'call_group') or ($option_selected == 'accountcode')) {
+		} else {
+			echo th_order_by($option_selected, $text["label-".$option_selected.""], $order_by,$order,'','',"option_selected=".$option_selected."&search=".$search."");
+		}
+	echo th_order_by('accountcode', $text['label-accountcode'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");	
+	echo th_order_by('call_group', $text['label-call_group'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('description', $text['label-description'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo "</tr>\n";
+
+
+
+if (is_array($directory)) {
+
+		foreach($directory as $key => $row) {
+			$tr_link = (permission_exists('extension_edit')) ? " href='/app/extensions/extension_edit.php?id=".$row['extension_uuid']."'" : null;
+			echo "<tr ".$tr_link.">\n";
+
+			echo "	<td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; vertical-align: middle; padding: 0px;'>";
+			echo "		<input type='checkbox' name='id[]' id='checkbox_".$row['extension_uuid']."' value='".$row['extension_uuid']."' onclick=\"if (!this.checked) { document.getElementById('chk_all').checked = false; }\">";
+			echo "	</td>";
+			$ext_ids[] = 'checkbox_'.$row['extension_uuid'];
+
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['extension']."&nbsp;</td>\n";
+			if (($option_selected == "") or ($option_selected == 'call_group') or ($option_selected == 'accountcode')) {
+			} else {
+				echo "	<td valign='top' class='".$row_style[$c]."'> ".$row[$option_selected]."&nbsp;</td>\n";
+			}
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['accountcode']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['call_group']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['description']."</td>\n";
+			echo "</tr>\n";
+			$c = ($c) ? 0 : 1;
+		}
+
+		unset($directory, $row);
+	}
+
+	echo "</table>";
+	echo "</form>";
+
+	if (strlen($paging_controls) > 0) {
+		echo "<br />";
+		echo $paging_controls."\n";
+	}
+	echo "<br /><br />".((is_array($directory)) ? "<br /><br />" : null);
+
+	// check or uncheck all checkboxes
+	if (sizeof($ext_ids) > 0) {
+		echo "<script>\n";
+		echo "	function check(what) {\n";
+		echo "		document.getElementById('chk_all').checked = (what == 'all') ? true : false;\n";
+		foreach ($ext_ids as $ext_id) {
+			echo "		document.getElementById('".$ext_id."').checked = (what == 'all') ? true : false;\n";
+		}
+		echo "	}\n";
+		echo "</script>\n";
+	}
+
+	if (is_array($directory)) {
+		// check all checkboxes
+		key_press('ctrl+a', 'down', 'document', null, null, "check('all');", true);
+
+		// delete checked
+		key_press('delete', 'up', 'document', array('#search'), $text['confirm-delete'], 'document.forms.frm.submit();', true);
+	}
+
+//show the footer
+	require_once "resources/footer.php";
+?>

+ 92 - 0
bulk_account_settings/bulk_account_settings_extensions_update.php

@@ -0,0 +1,92 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2016
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	KonradSC <[email protected]>
+*/
+
+//includes
+	include "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+
+//check permissions
+	if (permission_exists('bulk_account_settings_extensions')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//check for the ids
+	if (is_array($_REQUEST) && sizeof($_REQUEST) > 0) {
+
+		$extension_uuids = $_REQUEST["id"];
+		$option_selected = $_REQUEST["option_selected"];
+		$new_setting = $_REQUEST["new_setting"];
+		foreach($extension_uuids as $extension_uuid) {
+			$extension_uuid = check_str($extension_uuid);
+			if ($extension_uuid != '') {
+				//get the extensions array
+					$sql = "select * from v_extensions ";
+					$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+					$sql .= "and extension_uuid = '".$extension_uuid."' ";
+					$database = new database;
+					$database->select($sql);
+					$extensions = $database->result;
+					if (is_array($extensions)) { 
+						foreach ($extensions as &$row) {
+							$extension = $row["extension"];
+							//$user_context = $row["user_context"];
+						}
+						unset ($prep_statement);
+					}
+
+					$array["extensions"][$i]["domain_uuid"] = $domain_uuid;
+					$array["extensions"][$i]["extension_uuid"] = $extension_uuid;
+					$array["extensions"][$i][$option_selected] = $new_setting;
+
+					$database = new database;
+					$database->app_name = 'bulk_account_settings';
+					$database->app_uuid = null;
+					$database->save($array);
+					$message = $database->message;
+				
+					//echo "<pre>".print_r($message, true)."<pre>\n";
+					//exit;
+					
+					unset($database,$array,$i);
+			}
+		}
+	}
+
+//redirect the browser
+	$_SESSION["message"] = $text['message-update'];
+	header("Location: bulk_account_settings_extensions.php?option_selected=".$option_selected."");
+	return;
+
+?>

+ 485 - 0
bulk_account_settings/bulk_account_settings_users.php

@@ -0,0 +1,485 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2016
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	KonradSC <[email protected]>
+*/
+
+//includes
+	include "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+	require_once "resources/paging.php";
+
+//include the class
+	require_once "resources/check_auth.php";
+
+//check permissions
+	require_once "resources/check_auth.php";
+	if (permission_exists('bulk_account_settings_users')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+	
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get the http values and set them as variables
+	$order_by = check_str($_GET["order_by"]);
+	$order = check_str($_GET["order"]);
+	$option_selected = check_str($_GET["option_selected"]);
+	
+//handle search term
+	$search = check_str($_GET["search"]);
+	if (strlen($search) > 0) {
+		$sql_mod = "and ( ";
+		$sql_mod .= "username ILIKE '%".$search."%' ";
+		$sql_mod .= "or user_enabled ILIKE '%".$search."%' ";		
+		$sql_mod .= "or user_status ILIKE '%".$search."%' ";
+		$sql_mod .= ") ";
+	}
+	if (strlen($order_by) < 1) {
+		$order_by = "username";
+		$order = "ASC";
+	}
+
+	$domain_uuid = $_SESSION['domain_uuid'];
+	
+//get total extension count from the database
+	$sql = "select count(*) as num_rows from v_users where domain_uuid = '".$_SESSION['domain_uuid']."' ".$sql_mod." ";
+	$prep_statement = $db->prepare($sql);
+	if ($prep_statement) {
+		$prep_statement->execute();
+		$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
+		$total_users = $row['num_rows'];
+		if (($db_type == "pgsql") or ($db_type == "mysql")) {
+			$numberic_users = $row['num_rows'];
+		}
+	}
+	unset($prep_statement, $row);
+
+//prepare to page the results
+	$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+	$param = "&search=".$search."&option_selected=".$option_selected;
+	if (!isset($_GET['page'])) { $_GET['page'] = 0; }
+	$_GET['page'] = check_str($_GET['page']);
+	list($paging_controls_mini, $rows_per_page, $var_3) = paging($total_users, $param, $rows_per_page, true); //top
+	list($paging_controls, $rows_per_page, $var_3) = paging($total_users, $param, $rows_per_page); //bottom
+	$offset = $rows_per_page * $_GET['page'];
+
+//get all the users from the database
+	$sql = "SELECT \n";
+	$sql .= "username, \n";
+	$sql .= "user_uuid, \n";
+	$sql .= "user_status, \n";
+	$sql .= "user_enabled \n";
+	$sql .= "FROM v_users \n";
+	$sql .= "WHERE domain_uuid = '$domain_uuid' and 1 = 1 \n";
+	$sql .= $sql_mod; //add search mod from above
+	$sql .= "ORDER BY ".$order_by." ".$order." \n";
+	$sql .= "limit $rows_per_page offset $offset ";
+	$database = new database;
+	$database->select($sql);
+	$directory = $database->result;
+	unset($database,$result);
+
+//get all the users' groups from the database
+	$sql = "select ";
+	$sql .= "	gu.*, g.domain_uuid as group_domain_uuid ";
+	$sql .= "from ";
+	$sql .= "	v_group_users as gu, ";
+	$sql .= "	v_groups as g ";
+	$sql .= "where ";
+	$sql .= "	gu.group_uuid = g.group_uuid ";
+	if (!(permission_exists('user_all') && $_GET['showall'] == 'true')) {
+		$sql .= "	and gu.domain_uuid = '".$domain_uuid."' ";
+	}
+	$sql .= "order by ";
+	$sql .= "	g.domain_uuid desc, ";
+	$sql .= "	g.group_name asc ";
+	$database = new database;
+	$database->select($sql);
+	$result = $database->result;
+
+	if (count($result) > 0) {
+		foreach($result as $row) {
+			$user_groups[$row['user_uuid']][] = $row['group_name'].(($row['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$row['group_domain_uuid']]['domain_name'] : null);
+		}
+	}
+	unset($database,$result);
+
+//get all the users' timezones from the database
+	$sql = "select ";
+	$sql .= "	us.*, u.domain_uuid as setting_domain_uuid ";
+	$sql .= "from ";
+	$sql .= "	v_user_settings as us, ";
+	$sql .= "	v_users as u ";
+	$sql .= "where ";
+	$sql .= "	us.user_uuid = u.user_uuid ";
+	$sql .= "	and user_setting_subcategory = 'time_zone' ";
+	$sql .= "order by ";
+	$sql .= "	u.domain_uuid desc, ";
+	$sql .= "	u.username asc ";
+	$database = new database;
+	$database->select($sql);
+	$result = $database->result;
+
+	if (count($result) > 0) {
+		foreach($result as $row) {
+			$user_time_zone[$row['user_uuid']][] = $row['user_setting_value'];
+		}
+	}
+	unset($database,$result);
+
+		
+//additional includes
+	require_once "resources/header.php";
+	$document['title'] = $text['title-users_settings'];
+
+//set the alternating styles
+	$c = 0;
+	$row_style["0"] = "row_style0";
+	$row_style["1"] = "row_style1";
+
+//javascript for password
+	echo "<script>\n";
+	echo "	function compare_passwords() {\n";
+	echo "		if (document.getElementById('password') === document.activeElement || document.getElementById('password_confirm') === document.activeElement) {\n";
+	echo "			if ($('#password').val() != '' || $('#password_confirm').val() != '') {\n";
+	echo "				if ($('#password').val() != $('#password_confirm').val()) {\n";
+	echo "					$('#password').removeClass('formfld_highlight_good');\n";
+	echo "					$('#password_confirm').removeClass('formfld_highlight_good');\n";
+	echo "					$('#password').addClass('formfld_highlight_bad');\n";
+	echo "					$('#password_confirm').addClass('formfld_highlight_bad');\n";
+	echo "				}\n";
+	echo "				else {\n";
+	echo "					$('#password').removeClass('formfld_highlight_bad');\n";
+	echo "					$('#password_confirm').removeClass('formfld_highlight_bad');\n";
+	echo "					$('#password').addClass('formfld_highlight_good');\n";
+	echo "					$('#password_confirm').addClass('formfld_highlight_good');\n";
+	echo "				}\n";
+	echo "			}\n";
+	echo "		}\n";
+	echo "		else {\n";
+	echo "			$('#password').removeClass('formfld_highlight_bad');\n";
+	echo "			$('#password_confirm').removeClass('formfld_highlight_bad');\n";
+	echo "			$('#password').removeClass('formfld_highlight_good');\n";
+	echo "			$('#password_confirm').removeClass('formfld_highlight_good');\n";
+	echo "		}\n";
+	echo "	}\n";
+
+	$req['length'] = $_SESSION['security']['password_length']['numeric'];
+	$req['number'] = ($_SESSION['security']['password_number']['boolean'] == 'true') ? true : false;
+	$req['lowercase'] = ($_SESSION['security']['password_lowercase']['boolean'] == 'true') ? true : false;
+	$req['uppercase'] = ($_SESSION['security']['password_uppercase']['boolean'] == 'true') ? true : false;
+	$req['special'] = ($_SESSION['security']['password_special']['boolean'] == 'true') ? true : false;
+
+	echo "	function check_password_strength(pwd) {\n";
+	echo "		if ($('#password').val() != '' || $('#password_confirm').val() != '') {\n";
+	echo "			var msg_errors = [];\n";
+	if (is_numeric($req['length']) && $req['length'] != 0) {
+		echo "		var re = /.{".$req['length'].",}/;\n"; //length
+		echo "		if (!re.test(pwd)) { msg_errors.push('".$req['length']."+ ".$text['label-characters']."'); }\n";
+	}
+	if ($req['number']) {
+		echo "		var re = /(?=.*[\d])/;\n";  //number
+		echo "		if (!re.test(pwd)) { msg_errors.push('1+ ".$text['label-numbers']."'); }\n";
+	}
+	if ($req['lowercase']) {
+		echo "		var re = /(?=.*[a-z])/;\n";  //lowercase
+		echo "		if (!re.test(pwd)) { msg_errors.push('1+ ".$text['label-lowercase_letters']."'); }\n";
+	}
+	if ($req['uppercase']) {
+		echo "		var re = /(?=.*[A-Z])/;\n";  //uppercase
+		echo "		if (!re.test(pwd)) { msg_errors.push('1+ ".$text['label-uppercase_letters']."'); }\n";
+	}
+	if ($req['special']) {
+		echo "		var re = /(?=.*[\W])/;\n";  //special
+		echo "		if (!re.test(pwd)) { msg_errors.push('1+ ".$text['label-special_characters']."'); }\n";
+	}
+	echo "			if (msg_errors.length > 0) {\n";
+	echo "				var msg = '".$text['message-password_requirements'].": ' + msg_errors.join(', ');\n";
+	echo "				display_message(msg, 'negative', '6000');\n";
+	echo "				return false;\n";
+	echo "			}\n";
+	echo "			else {\n";
+	echo "				return true;\n";
+	echo "			}\n";
+	echo "		}\n";
+	echo "		else {\n";
+	echo "			return true;\n";
+	echo "		}\n";
+	echo "	}\n";
+
+	echo "	function show_strenth_meter() {\n";
+	echo "		$('#pwstrength_progress').slideDown();\n";
+	echo "	}\n";
+	echo "</script>\n";
+
+	
+//show the content
+	echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
+	echo "  <tr>\n";
+	echo "	<td align='left' width='100%'>\n";
+	echo "		<b>".$text['header-users']." (".$numberic_users.")</b><br>\n";
+
+//options list
+	echo "<form name='frm' method='get' id=option_selected>\n";
+	echo "    <select class='formfld' name='option_selected'  onchange=\"this.form.submit();\">\n";
+	echo "    <option value=''>".$text['label-extension_null']."</option>\n";
+	if ($option_selected == "user_enabled") {
+		echo "    <option value='user_enabled' selected='selected'>".$text['label-user_enabled']."</option>\n";
+	}
+	else {
+		echo "    <option value='user_enabled'>".$text['label-user_enabled']."</option>\n";
+	}
+	if ($option_selected == "group") {
+		echo "    <option value='group' selected='selected'>".$text['label-group']."</option>\n";
+	}
+	if ($option_selected == "password") {
+		echo "    <option value='password' selected='selected'>".$text['label-password']."</option>\n";
+	}
+	else {
+		echo "    <option value='password'>".$text['label-password']."</option>\n";
+	}
+	if ($option_selected == "user_status") {
+		echo "    <option value='user_status' selected='selected'>".$text['label-user_status']."</option>\n";
+	}
+	else {
+		echo "    <option value='user_status'>".$text['label-user_status']."</option>\n";
+	}
+	if ($option_selected == "time_zone") {
+		echo "    <option value='time_zone' selected='selected'>".$text['label-time_zone']."</option>\n";
+	}
+	else {
+		echo "    <option value='time_zone'>".$text['label-time_zone']."</option>\n";
+	}
+	echo "    </select>\n";
+	echo "    </form>\n";
+	echo "<br />\n";
+	echo $text['description-user_settings_description']."\n";
+	echo "</td>\n";
+
+	echo "		<td align='right' width='100%' style='vertical-align: top;'>";
+	echo "		<form method='get' action=''>\n";
+	echo "			<td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
+	echo "				<input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='bulk_account_settings.php'\" value='".$text['button-back']."'>\n";	
+	echo "				<input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>";
+	echo "				<input type='hidden' class='txt' style='width: 150px' name='option_selected' id='option_selected' value='".$option_selected."'>";
+	echo "				<input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
+	if ($paging_controls_mini != '') {
+		echo 			"<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
+	}
+	echo "			</td>\n";
+	echo "		</form>\n";	
+	echo "  </tr>\n";
+	
+	
+	echo "	<tr>\n";
+	echo "		<td colspan='2'>\n";
+	echo "			".$text['description-users_settings']."\n";
+	echo "		</td>\n";
+	echo "	</tr>\n";
+	echo "</table>\n";
+	echo "<br />";
+
+	if (strlen($option_selected) > 0) {
+		echo "<form name='users' method='post' action='bulk_account_settings_users_update.php'>\n";
+		echo "<input class='formfld' type='hidden' name='option_selected' maxlength='255' value=\"$option_selected\">\n";
+		echo "<table width='auto' border='0' cellpadding='0' cellspacing='0'>\n";
+		echo "<tr>\n";
+		//option is Password
+		if($option_selected == 'password') {
+			echo "<td class='vtable' align='left'>\n";
+			echo "    <input class='formfld' type='password' name='new_setting' maxlength='255' value=\"$new_setting\">\n";
+			echo "<br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+		
+		//option is Enabled
+		if($option_selected == 'user_enabled') {
+			echo "<td class='vtable' align='left'>\n";
+			echo "    <select class='formfld' name='new_setting'>\n";
+			echo "    <option value='true'>".$text['label-true']."</option>\n";
+			echo "    <option value='false'>".$text['label-false']."</option>\n";
+			echo "    </select>\n";
+			echo "    <br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+		//option is user_status
+		if($option_selected == 'user_status') {
+			echo "<td class='vtable' align='left'>\n";
+			echo "		<select name='new_setting' class='formfld' style=''>\n";
+			echo "			<option value=''></option>\n";
+			echo "			<option value='Available'>".$text['option-available']."</option>\n";
+			echo "			<option value='Available (On Demand)'>".$text['option-available_on_demand']."</option>\n";
+			echo "			<option value='Logged Out'>".$text['option-logged_out']."</option>\n";
+			echo "			<option value='On Break'>".$text['option-on_break']."</option>\n";
+			echo "			<option value='Do Not Disturb'>".$text['option-do_not_disturb']."</option>\n";
+			echo "		</select>\n";
+			echo "    <br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+		//option is user_time_zone
+		if($option_selected == 'time_zone') {
+			echo "<td class='vtable' align='left'>\n";
+			echo "		<select name='new_setting' class='formfld' style=''>\n";
+			echo "		<option value=''></option>\n";
+				//$list = DateTimeZone::listAbbreviations();
+			    $time_zone_identifiers = DateTimeZone::listIdentifiers();
+				$previous_category = '';
+				$x = 0;
+				foreach ($time_zone_identifiers as $key => $row) {
+					$time_zone = explode("/", $row);
+					$category = $time_zone[0];
+					if ($category != $previous_category) {
+						if ($x > 0) {
+							echo "		</optgroup>\n";
+						}
+						echo "		<optgroup label='".$category."'>\n";
+					}
+
+						echo "			<option value='".$row."'>".$row."</option>\n";
+
+					$previous_category = $category;
+					$x++;
+				}
+				echo "		</select>\n";
+			echo "    <br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+		//option is group
+		if($option_selected == 'group') {
+			echo "		<td class='vtable'>";
+			$sql = "select * from v_groups ";
+			$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
+			$sql .= "order by domain_uuid desc, group_name asc ";
+			$database = new database;
+			$database->select($sql);
+			$result = $database->result;
+			$result_count = count($result);
+			if ($result_count > 0) {
+				if (isset($assigned_groups)) { echo "<br />\n"; }
+				echo "<select name='group_uuid_name' class='formfld' style='width: auto; margin-right: 3px;'>\n";
+				echo "	<option value=''></option>\n";
+				foreach($result as $field) {
+					if ($field['group_name'] == "superadmin" && !if_group("superadmin")) { continue; }	//only show the superadmin group to other superadmins
+					if ($field['group_name'] == "admin" && (!if_group("superadmin") && !if_group("admin") )) { continue; }	//only show the admin group to other admins
+					if ( !isset($assigned_groups) || (isset($assigned_groups) && !in_array($field["group_uuid"], $assigned_groups)) ) {
+						echo "	<option value='".$field['group_uuid']."|".$field['group_name']."'>".$field['group_name'].(($field['domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['domain_uuid']]['domain_name'] : null)."</option>\n";
+					}
+				}
+				echo "</select>";
+				if ($action == 'edit') {
+					echo "<input type='button' class='btn' value=\"".$text['button-add']."\" onclick=\"document.getElementById('action').value = '".$text['button-add']."'; submit_form();\">\n";
+				}
+			}
+			unset($sql, $prep_statement, $result);
+			echo "		</td>";
+		}
+		echo "<td align='left'>\n";
+		echo "<input type='button' class='btn' alt='".$text['button-submit']."' onclick=\"if (confirm('".$text['confirm-update']."')) { document.forms.users.submit(); }\" value='".$text['button-submit']."'; if (check_password_strength(document.getElementById('password').value)) { submit_form(); }>\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+		echo "</table>";
+		echo "<br />";
+	}
+	echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+	echo "<tr>\n";
+	if (is_array($directory)) {
+		echo "<th style='width: 30px; text-align: center; padding: 0px;'><input type='checkbox' id='chk_all' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
+	}
+	echo th_order_by('username', $text['label-username'], $order_by,$order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('user_status', $text['label-user_status'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('username', $text['label-group'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('username', $text['label-time_zone'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('user_enabled', $text['label-user_enabled'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo "</tr>\n";
+
+if (is_array($directory)) {
+
+		foreach($directory as $key => $row) {
+			$tr_link = (permission_exists('extension_edit')) ? " href='/core/users/user_edit.php?id=".$row['user_uuid']."'" : null;
+			echo "<tr ".$tr_link.">\n";
+			echo "	<td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; vertical-align: middle; padding: 0px;'>";
+			echo "		<input type='checkbox' name='id[]' id='checkbox_".$row['user_uuid']."' value='".$row['user_uuid']."' onclick=\"if (!this.checked) { document.getElementById('chk_all').checked = false; }\">";
+			echo "	</td>";
+			$user_ids[] = 'checkbox_'.$row['user_uuid'];
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['username']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['user_status']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>";
+				if (sizeof($user_groups[$row['user_uuid']]) > 0) {
+					echo implode(', ', $user_groups[$row['user_uuid']]);
+				}
+				echo "&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>";
+				if (sizeof($user_time_zone[$row['user_uuid']]) > 0) {
+					echo implode(', ', $user_time_zone[$row['user_uuid']]);
+				}
+				echo "&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['user_enabled']."&nbsp;</td>\n";
+			echo "</tr>\n";
+			$c = ($c) ? 0 : 1;
+		}
+		unset($directory, $row);
+	}
+	echo "</table>";
+	echo "</form>";
+
+	if (strlen($paging_controls) > 0) {
+		echo "<br />";
+		echo $paging_controls."\n";
+	}
+
+	echo "<br /><br />".((is_array($directory)) ? "<br /><br />" : null);
+
+	// check or uncheck all checkboxes
+	if (sizeof($user_ids) > 0) {
+		echo "<script>\n";
+		echo "	function check(what) {\n";
+		echo "		document.getElementById('chk_all').checked = (what == 'all') ? true : false;\n";
+		foreach ($user_ids as $user_id) {
+			echo "		document.getElementById('".$user_id."').checked = (what == 'all') ? true : false;\n";
+		}
+		echo "	}\n";
+		echo "</script>\n";
+	}
+
+	if (is_array($directory)) {
+		// check all checkboxes
+		key_press('ctrl+a', 'down', 'document', null, null, "check('all');", true);
+
+		// delete checked
+		key_press('delete', 'up', 'document', array('#search'), $text['confirm-delete'], 'document.forms.frm.submit();', true);
+	}
+
+//show the footer
+	require_once "resources/footer.php";
+?>

+ 124 - 0
bulk_account_settings/bulk_account_settings_users_update.php

@@ -0,0 +1,124 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2016
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	KonradSC <[email protected]>
+*/
+
+//includes
+	include "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+
+//check permissions
+	if (permission_exists('bulk_account_settings_users')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+
+
+//check for the ids
+	if (is_array($_REQUEST) && sizeof($_REQUEST) > 0) {
+
+		$user_uuids = $_REQUEST["id"];
+		$option_selected = $_REQUEST["option_selected"];
+		$new_setting = $_REQUEST["new_setting"];
+		foreach($user_uuids as $user_uuid) {
+			$user_uuid = check_str($user_uuid);
+			if ($user_uuid != '') {
+			//get the users array
+				$sql = "select * from v_users ";
+				$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+				$sql .= "and user_uuid = '".$user_uuid."' ";
+				$database = new database;
+				$database->select($sql);
+				$users = $database->result;
+				if (is_array($users)) { 
+					foreach ($users as &$row) {
+						$user = $row["user"];
+					}
+					unset ($prep_statement);
+				}
+				
+				//user_status or user_enabled
+				if($option_selected == "user_status" || $option_selected == "user_enabled"){
+					$array["users"][$i]["domain_uuid"] = $domain_uuid;
+					$array["users"][$i]["user_uuid"] = $user_uuid;
+					$array["users"][$i][$option_selected] = $new_setting;
+				}
+
+				//password
+				if($option_selected == "password"){
+					$salt = uuid();
+					$array["users"][$i]["domain_uuid"] = $domain_uuid;
+					$array["users"][$i]["user_uuid"] = $user_uuid;
+					$array['users'][$i]['password'] = md5($salt.$new_setting);
+					$array['users'][$i]['salt'] = $salt;				
+
+				}
+
+				//timezone
+				if($option_selected == "time_zone"){
+					$sql = "select * from v_user_settings ";
+					$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+					$sql .= "and user_uuid = '".$user_uuid."' ";
+					$sql .= "and user_setting_subcategory = 'time_zone' ";
+					$database = new database;
+					$database->select($sql);
+					$users = $database->result;
+					if (is_array($users)) { 
+						foreach ($users as &$row) {
+							$user_setting_uuid = $row["user_setting_uuid"];
+						}
+						unset ($prep_statement);
+					}
+				
+					$array["user_settings"][$i]["domain_uuid"] = $domain_uuid;
+					$array["user_settings"][$i]["user_uuid"] = $user_uuid;
+					$array["user_settings"][$i]["user_setting_uuid"] = $user_setting_uuid;
+					$array["user_settings"][$i]["user_setting_value"] = $new_setting;
+
+				}
+
+				$database = new database;
+				$database->app_name = 'bulk_account_settings';
+				$database->app_uuid = null;
+				$database->save($array);
+				$message = $database->message;
+				unset($database,$array,$i);
+			}
+		}
+	}
+
+//redirect the browser
+	$_SESSION["message"] = $text['message-update'];
+	header("Location: bulk_account_settings_users.php?option_selected=".$option_selected."");
+	return;
+?>

+ 310 - 0
bulk_account_settings/bulk_account_settings_voicemails.php

@@ -0,0 +1,310 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2016
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	KonradSC <[email protected]>
+*/
+
+//includes
+	include "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+	require_once "resources/paging.php";
+
+//include the class
+	require_once "resources/check_auth.php";
+
+//check permissions
+	require_once "resources/check_auth.php";
+	if (permission_exists('bulk_account_settings_voicemails')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+	
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get the http values and set them as variables
+	$order_by = check_str($_GET["order_by"]);
+	$order = check_str($_GET["order"]);
+	$option_selected = check_str($_GET["option_selected"]);
+	
+//handle search term
+	$search = check_str($_GET["search"]);
+	if (strlen($search) > 0) {
+		$sql_mod = "and ( ";
+		$sql_mod .= "CAST(voicemail_id AS TEXT) LIKE '%".$search."%' ";
+		$sql_mod .= "or voicemail_description ILIKE '%".$search."%' ";		
+		$sql_mod .= ") ";
+	}
+	if (strlen($order_by) < 1) {
+		$order_by = "voicemail_id";
+		$order = "ASC";
+	}
+
+	$domain_uuid = $_SESSION['domain_uuid'];
+	
+
+//get total voicemail count from the database
+	$sql = "select count(*) as num_rows from v_voicemails where domain_uuid = '".$_SESSION['domain_uuid']."' ".$sql_mod." ";
+	$prep_statement = $db->prepare($sql);
+	if ($prep_statement) {
+		$prep_statement->execute();
+		$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
+		$total_voicemails = $row['num_rows'];
+		if (($db_type == "pgsql") or ($db_type == "mysql")) {
+			$numeric_voicemails = $row['num_rows'];
+		}
+	}
+	unset($prep_statement, $row);
+
+//prepare to page the results
+	$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+	$param = "&search=".$search."&option_selected=".$option_selected;
+	if (!isset($_GET['page'])) { $_GET['page'] = 0; }
+	$_GET['page'] = check_str($_GET['page']);
+	list($paging_controls_mini, $rows_per_page, $var_3) = paging($total_voicemails, $param, $rows_per_page, true); //top
+	list($paging_controls, $rows_per_page, $var_3) = paging($total_voicemails, $param, $rows_per_page); //bottom
+	$offset = $rows_per_page * $_GET['page'];
+
+//get all the voicemails from the database
+	$sql = "SELECT \n";
+	$sql .= "voicemail_description, \n";
+	$sql .= "voicemail_id, \n";
+	$sql .= "voicemail_uuid, \n";
+	$sql .= "voicemail_file, \n";
+	$sql .= "voicemail_enabled, \n";	
+	$sql .= "voicemail_local_after_email, \n";
+	$sql .= "voicemail_transcription_enabled \n";
+	$sql .= "FROM v_voicemails \n";
+	$sql .= "WHERE domain_uuid = '$domain_uuid' \n";
+	$sql .= $sql_mod; //add search mod from above
+	$sql .= "ORDER BY ".$order_by." ".$order." \n";
+	$sql .= "limit $rows_per_page offset $offset ";
+	$database = new database;
+	$database->select($sql);
+	$directory = $database->result;
+	unset($database,$result);
+
+
+//additional includes
+	require_once "resources/header.php";
+	$document['title'] = $text['title-voicemails_settings'];
+
+//set the alternating styles
+	$c = 0;
+	$row_style["0"] = "row_style0";
+	$row_style["1"] = "row_style1";
+
+//show the content
+	echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
+	echo "  <tr>\n";
+	echo "	<td align='left' width='100%'>\n";
+	echo "		<b>".$text['header-voicemails']." (".$numeric_voicemails.")</b><br>\n";
+
+//options list
+	echo "<form name='frm' method='get' id=option_selected>\n";
+	echo "    <select class='formfld' name='option_selected'  onchange=\"this.form.submit();\">\n";
+	echo "    <option value=''>".$text['label-voicemail_null']."</option>\n";
+	if ($option_selected == "voicemail_file") {
+		echo "    <option value='voicemail_file' selected='selected'>".$text['label-voicemail_file']."</option>\n";
+	}
+	else {
+		echo "    <option value='voicemail_file'>".$text['label-voicemail_file']."</option>\n";
+	}
+	if ($option_selected == "voicemail_enabled") {
+		echo "    <option value='voicemail_enabled' selected='selected'>".$text['label-voicemail_enabled']."</option>\n";
+	}
+	else {
+		echo "    <option value='voicemail_enabled'>".$text['label-voicemail_enabled']."</option>\n";
+	}
+	if ($option_selected == "voicemail_local_after_email") {
+		echo "    <option value='voicemail_local_after_email' selected='selected'>".$text['label-voicemail_local_after_email']."</option>\n";
+	}
+	else {
+		echo "    <option value='voicemail_local_after_email'>".$text['label-voicemail_local_after_email']."</option>\n";
+	}
+	if ($option_selected == "voicemail_password") {
+		echo "    <option value='voicemail_password' selected='selected'>".$text['label-voicemail_password']."</option>\n";
+	}
+	else {
+		echo "    <option value='voicemail_password'>".$text['label-voicemail_password']."</option>\n";
+	}
+	if($_SESSION['voicemail']['transcribe_enabled']['boolean'] == "true") {
+		if ($option_selected == "voicemail_transcription_enabled") {
+			echo "    <option value='voicemail_transcription_enabled' selected='selected'>".$text['label-voicemail_transcription_enabled']."</option>\n";
+		}
+		else {
+			echo "    <option value='voicemail_transcription_enabled'>".$text['label-voicemail_transcription_enabled']."</option>\n";
+		}
+	}
+	echo "    </select>\n";
+	echo "    </form>\n";
+	echo "<br />\n";
+	echo $text['description-voicemail_settings_description']."\n";
+	echo "</td>\n";
+	
+	echo "		<td align='right' width='100%' style='vertical-align: top;'>";
+	echo "		<form method='get' action=''>\n";
+	echo "			<td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
+	echo "				<input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='bulk_account_settings.php'\" value='".$text['button-back']."'>\n";	
+	echo "				<input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>";
+	echo "				<input type='hidden' class='txt' style='width: 150px' name='option_selected' id='option_selected' value='".$option_selected."'>";
+	echo "				<input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
+	if ($paging_controls_mini != '') {
+		echo 			"<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
+	}
+	echo "			</td>\n";
+	echo "		</form>\n";	
+	echo "  </tr>\n";
+	
+	echo "	<tr>\n";
+	echo "		<td colspan='2'>\n";
+	echo "			".$text['description-voicemails_settings']."\n";
+	echo "		</td>\n";
+	echo "	</tr>\n";
+	echo "</table>\n";
+	echo "<br />";
+
+	if (strlen($option_selected) > 0) {
+		echo "<form name='voicemails' method='post' action='bulk_account_settings_voicemails_update.php'>\n";
+		echo "<input class='formfld' type='hidden' name='option_selected' maxlength='255' value=\"$option_selected\">\n";
+		echo "<table width='auto' border='0' cellpadding='0' cellspacing='0'>\n";
+		echo "<tr>\n";
+		//option is Password
+		if($option_selected == 'voicemail_password') {
+			echo "<td class='vtable' align='left'>\n";
+			echo "    <input class='formfld' type='password' name='new_setting' id='password' autocomplete='off' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" autocomplete='off' maxlength='50' value=\"$new_setting\">\n";
+			
+			echo "<br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+		//option is voicemail_enabled or voicemail_local_after_email or voicemail_transcription_enabled
+		if($option_selected == 'voicemail_enabled' || $option_selected == 'voicemail_local_after_email' || $option_selected == 'voicemail_transcription_enabled') {
+			echo "<td class='vtable' align='left'>\n";
+			echo "    <select class='formfld' name='new_setting'>\n";
+			echo "    <option value='true'>".$text['label-true']."</option>\n";
+			echo "    <option value='false'>".$text['label-false']."</option>\n";
+			echo "    </select>\n";
+			echo "    <br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+		//option is voicemail_file
+		if($option_selected == 'voicemail_file') {
+			echo "<td class='vtable' align='left'>\n";
+			echo "    <select class='formfld' name='new_setting'>\n";
+			echo "    <option value='listen'>".$text['option-voicemail_file_listen']."</option>\n";
+			echo "    <option value='link'>".$text['option-voicemail_file_link']."</option>\n";
+			echo "    <option value='attach'>".$text['option-voicemail_file_attach']."</option>\n";
+			echo "    </select>\n";
+			echo "    <br />\n";
+			echo $text["description-".$option_selected.""]."\n";
+			echo "</td>\n";
+		}
+		echo "<td align='left'>\n";
+		echo "<input type='button' class='btn' alt='".$text['button-submit']."' onclick=\"if (confirm('".$text['confirm-update']."')) { document.forms.voicemails.submit(); }\" value='".$text['button-submit']."'>\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+		echo "</table>";
+		echo "<br />";
+	}
+	echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+	echo "<tr>\n";
+	if (is_array($directory)) {
+		echo "<th style='width: 30px; text-align: center; padding: 0px;'><input type='checkbox' id='chk_all' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
+	}
+	echo th_order_by('voicemail_id', $text['label-voicemail_id'], $order_by,$order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('voicemail_id', $text['label-voicemail_file'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo th_order_by('voicemail_id', $text['label-voicemail_local_after_email'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	if($_SESSION['voicemail']['transcribe_enabled']['boolean'] == "true") {
+		echo th_order_by('voicemail_id', $text['label-voicemail_transcription_enabled'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");	
+	}
+	echo th_order_by('voicemail_id', $text['label-voicemail_enabled'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");	
+	echo th_order_by('voicemail_id', $text['label-voicemail_description'], $order_by, $order,'','',"option_selected=".$option_selected."&search=".$search."");
+	echo "</tr>\n";
+
+
+
+if (is_array($directory)) {
+
+		foreach($directory as $key => $row) {
+			$tr_link = (permission_exists('voicemail_edit')) ? " href='/app/voicemails/voicemail_edit.php?id=".$row['voicemail_uuid']."'" : null;
+			echo "<tr ".$tr_link.">\n";
+
+			echo "	<td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; vertical-align: middle; padding: 0px;'>";
+			echo "		<input type='checkbox' name='id[]' id='checkbox_".$row['voicemail_uuid']."' value='".$row['voicemail_uuid']."' onclick=\"if (!this.checked) { document.getElementById('chk_all').checked = false; }\">";
+			echo "	</td>";
+			$ext_ids[] = 'checkbox_'.$row['voicemail_uuid'];
+
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['voicemail_id']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['voicemail_file']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['voicemail_local_after_email']."&nbsp;</td>\n";
+			if($_SESSION['voicemail']['transcribe_enabled']['boolean'] == "true") {
+				echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['voicemail_transcription_enabled']."&nbsp;</td>\n";			
+			}
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['voicemail_enabled']."&nbsp;</td>\n";			
+			echo "	<td valign='top' class='".$row_style[$c]."'> ".$row['voicemail_description']."</td>\n";
+			echo "</tr>\n";
+			$c = ($c) ? 0 : 1;
+		}
+
+		unset($directory, $row);
+	}
+
+	echo "</table>";
+	echo "</form>";
+
+	if (strlen($paging_controls) > 0) {
+		echo "<br />";
+		echo $paging_controls."\n";
+	}
+	echo "<br /><br />".((is_array($directory)) ? "<br /><br />" : null);
+
+	// check or uncheck all checkboxes
+	if (sizeof($ext_ids) > 0) {
+		echo "<script>\n";
+		echo "	function check(what) {\n";
+		echo "		document.getElementById('chk_all').checked = (what == 'all') ? true : false;\n";
+		foreach ($ext_ids as $ext_id) {
+			echo "		document.getElementById('".$ext_id."').checked = (what == 'all') ? true : false;\n";
+		}
+		echo "	}\n";
+		echo "</script>\n";
+	}
+
+	if (is_array($directory)) {
+		// check all checkboxes
+		key_press('ctrl+a', 'down', 'document', null, null, "check('all');", true);
+
+		// delete checked
+		key_press('delete', 'up', 'document', array('#search'), $text['confirm-delete'], 'document.forms.frm.submit();', true);
+	}
+
+//show the footer
+	require_once "resources/footer.php";
+?>

+ 92 - 0
bulk_account_settings/bulk_account_settings_voicemails_update.php

@@ -0,0 +1,92 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2016
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	KonradSC <[email protected]>
+*/
+
+//includes
+	include "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+
+//check permissions
+	if (permission_exists('bulk_account_settings_voicemails')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//check for the ids
+	if (is_array($_REQUEST) && sizeof($_REQUEST) > 0) {
+
+		$voicemail_uuids = $_REQUEST["id"];
+		$option_selected = $_REQUEST["option_selected"];
+		$new_setting = $_REQUEST["new_setting"];
+		foreach($voicemail_uuids as $voicemail_uuid) {
+			$voicemail_uuid = check_str($voicemail_uuid);
+			if ($voicemail_uuid != '') {
+				//get the voicemails array
+					$sql = "select * from v_voicemails ";
+					$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+					$sql .= "and voicemail_uuid = '".$voicemail_uuid."' ";
+					$database = new database;
+					$database->select($sql);
+					$voicemails = $database->result;
+					if (is_array($voicemails)) { 
+						foreach ($voicemails as &$row) {
+							$voicemail = $row["voicemail"];
+							//$user_context = $row["user_context"];
+						}
+						unset ($prep_statement);
+					}
+
+					$array["voicemails"][$i]["domain_uuid"] = $domain_uuid;
+					$array["voicemails"][$i]["voicemail_uuid"] = $voicemail_uuid;
+					$array["voicemails"][$i][$option_selected] = $new_setting;
+
+					$database = new database;
+					$database->app_name = 'bulk_account_settings';
+					$database->app_uuid = null;
+					$database->save($array);
+					$message = $database->message;
+				
+					//echo "<pre>".print_r($message, true)."<pre>\n";
+					//exit;
+					
+					unset($database,$array,$i);
+			}
+		}
+	}
+
+//redirect the browser
+	$_SESSION["message"] = $text['message-update'];
+	header("Location: bulk_account_settings_voicemails.php?option_selected=".$option_selected."");
+	return;
+
+?>

+ 90 - 0
bulk_account_settings/root.php

@@ -0,0 +1,90 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+// make sure the PATH_SEPARATOR is defined
+	umask(2);
+	if (!defined("PATH_SEPARATOR")) {
+		if (strpos($_ENV["OS"], "Win") !== false) {
+			define("PATH_SEPARATOR", ";");
+		} else {
+			define("PATH_SEPARATOR", ":");
+		}
+	}
+
+	if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
+
+	// make sure the document_root is set
+	$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
+	if(PHP_SAPI == 'cli'){
+		chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
+		$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
+		$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
+		if (file_exists('/project_root.php')) {
+			$path = '/';
+		} else {
+			$i    = 1;
+			$path = '';
+			while ($i < count($dirs)) {
+				$path .= '/' . $dirs[$i];
+				if (file_exists($path. '/project_root.php')) {
+					break;
+				}
+				$i++;
+			}
+		}
+		$_SERVER["DOCUMENT_ROOT"] = $path;
+	}else{
+		$_SERVER["DOCUMENT_ROOT"]   = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
+	}
+	$_SERVER["DOCUMENT_ROOT"]   = realpath($_SERVER["DOCUMENT_ROOT"]);
+// try to detect if a project path is being used
+	if (!defined('PROJECT_PATH')) {
+		if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
+			define('PROJECT_PATH', '/fusionpbx');
+		} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
+			define('PROJECT_PATH', '');
+		} else {
+			$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
+			$i    = 1;
+			$path = $_SERVER["DOCUMENT_ROOT"];
+			while ($i < count($dirs)) {
+				$path .= '/' . $dirs[$i];
+				if (file_exists($path. '/project_root.php')) {
+					break;
+				}
+				$i++;
+			}
+			if(!file_exists($path. '/project_root.php')){
+				die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
+			}
+			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
+			define('PROJECT_PATH', $project_path);
+		}
+		$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
+		set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
+	}
+
+?>