From d50bcb476a89b8663bd34a84bac2515a1a5fb08e Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 10 Oct 2022 16:35:14 -0600 Subject: [PATCH] Replace root.php --- app/access_controls/access_control_edit.php | 7 +- app/access_controls/access_controls.php | 7 +- app/access_controls/root.php | 90 ------------------- app/basic_operator_panel/autocomplete.php | 7 +- app/basic_operator_panel/exec.php | 7 +- app/basic_operator_panel/index.php | 7 +- .../resources/content.php | 6 +- app/basic_operator_panel/resources/root.php | 90 ------------------- app/basic_operator_panel/root.php | 90 ------------------- app/bridges/bridge_edit.php | 7 +- app/bridges/bridges.php | 7 +- app/bridges/root.php | 90 ------------------- app/call_block/call_block.php | 7 +- app/call_block/call_block_edit.php | 7 +- app/call_block/root.php | 90 ------------------- app/call_broadcast/call_broadcast.php | 7 +- app/call_broadcast/call_broadcast_edit.php | 7 +- app/call_broadcast/call_broadcast_send.php | 7 +- app/call_broadcast/call_broadcast_stop.php | 6 +- app/call_broadcast/root.php | 90 ------------------- app/call_center_active/call_center_active.php | 7 +- .../call_center_active_inc.php | 7 +- app/call_center_active/call_center_exec.php | 7 +- app/call_center_active/call_center_queue.php | 7 +- app/call_center_active/root.php | 90 ------------------- app/call_centers/call_center_agent_edit.php | 7 +- app/call_centers/call_center_agent_status.php | 7 +- app/call_centers/call_center_agents.php | 7 +- app/call_centers/call_center_queue_edit.php | 7 +- app/call_centers/call_center_queues.php | 7 +- app/call_centers/cmd.php | 7 +- .../dashboard/call_center_agents.php | 7 +- app/call_centers/root.php | 90 ------------------- app/call_flows/call_flow_edit.php | 7 +- app/call_flows/call_flows.php | 7 +- app/call_flows/root.php | 90 ------------------- app/call_forward/call_forward.php | 7 +- app/call_forward/call_forward_edit.php | 7 +- .../resources/classes/call_forward.php | 1 - .../resources/classes/do_not_disturb.php | 1 - .../classes/feature_event_notify.php | 1 - .../resources/classes/follow_me.php | 1 - .../resources/dashboard/call_forward.php | 7 +- app/call_forward/resources/jobs/dnd.php | 15 ++-- app/call_forward/root.php | 90 ------------------- app/call_recordings/call_recordings.php | 7 +- app/call_recordings/download.php | 7 +- app/call_recordings/root.php | 90 ------------------- app/calls_active/calls_active.php | 7 +- app/calls_active/calls_active_inc.php | 7 +- app/calls_active/calls_exec.php | 7 +- app/calls_active/root.php | 90 ------------------- app/click_to_call/click_to_call.php | 7 +- app/click_to_call/root.php | 90 ------------------- .../conference_center_edit.php | 7 +- app/conference_centers/conference_centers.php | 7 +- .../conference_room_edit.php | 7 +- app/conference_centers/conference_rooms.php | 7 +- .../conference_session_details.php | 7 +- .../conference_sessions.php | 7 +- app/conference_centers/download.php | 7 +- .../resources/classes/call_center_notify.php | 1 - app/conference_centers/root.php | 90 ------------------- .../conference_control_detail_edit.php | 7 +- .../conference_control_details.php | 7 +- .../conference_control_edit.php | 7 +- .../conference_controls.php | 7 +- app/conference_controls/root.php | 90 ------------------- .../conference_profile_edit.php | 7 +- .../conference_profile_param_edit.php | 7 +- .../conference_profile_params.php | 7 +- .../conference_profiles.php | 7 +- app/conference_profiles/root.php | 90 ------------------- app/conferences/conference_edit.php | 7 +- app/conferences/conferences.php | 7 +- app/conferences/root.php | 90 ------------------- app/conferences_active/conference_exec.php | 1 - .../conference_interactive.php | 7 +- .../conference_interactive_inc.php | 7 +- app/conferences_active/conferences_active.php | 7 +- .../conferences_active_inc.php | 7 +- app/conferences_active/root.php | 90 ------------------- app/contacts/contact_address_edit.php | 7 +- app/contacts/contact_addresses.php | 7 +- app/contacts/contact_addresses_view.php | 7 +- app/contacts/contact_attachment.php | 7 +- app/contacts/contact_attachment_edit.php | 7 +- app/contacts/contact_attachments.php | 7 +- app/contacts/contact_attachments_view.php | 7 +- app/contacts/contact_auth.php | 6 +- app/contacts/contact_edit.php | 7 +- app/contacts/contact_email_edit.php | 7 +- app/contacts/contact_emails.php | 7 +- app/contacts/contact_emails_view.php | 7 +- app/contacts/contact_extensions.php | 7 +- app/contacts/contact_extensions_view.php | 7 +- app/contacts/contact_import.php | 7 +- app/contacts/contact_import_google.php | 7 +- app/contacts/contact_note_edit.php | 7 +- app/contacts/contact_notes.php | 7 +- app/contacts/contact_notes_view.php | 7 +- app/contacts/contact_phone_edit.php | 7 +- app/contacts/contact_phones.php | 7 +- app/contacts/contact_phones_view.php | 7 +- app/contacts/contact_relation_edit.php | 7 +- app/contacts/contact_relations.php | 7 +- app/contacts/contact_relations_view.php | 7 +- app/contacts/contact_setting_edit.php | 7 +- app/contacts/contact_settings.php | 7 +- app/contacts/contact_time_edit.php | 7 +- app/contacts/contact_timer.php | 12 ++- app/contacts/contact_timer_inc.php | 12 ++- app/contacts/contact_times.php | 7 +- app/contacts/contact_times_view.php | 7 +- app/contacts/contact_url_edit.php | 7 +- app/contacts/contact_urls.php | 7 +- app/contacts/contact_urls_view.php | 7 +- app/contacts/contact_view.php | 7 +- app/contacts/contacts.php | 7 +- app/contacts/contacts_vcard.php | 7 +- app/contacts/root.php | 90 ------------------- .../database_transaction_edit.php | 7 +- .../database_transactions.php | 7 +- app/database_transactions/root.php | 90 ------------------- app/destinations/destination_download.php | 7 +- app/destinations/destination_edit.php | 7 +- app/destinations/destination_imports.php | 7 +- app/destinations/destinations.php | 7 +- app/destinations/resources/root.php | 90 ------------------- app/destinations/root.php | 90 ------------------- app/devices/cmd.php | 7 +- app/devices/device_copy.php | 7 +- app/devices/device_download.php | 7 +- app/devices/device_edit.php | 7 +- app/devices/device_imports.php | 7 +- app/devices/device_profile_copy.php | 7 +- app/devices/device_profile_edit.php | 7 +- app/devices/device_profiles.php | 7 +- app/devices/device_vendor_edit.php | 7 +- app/devices/device_vendor_function_edit.php | 7 +- app/devices/device_vendor_functions.php | 7 +- app/devices/device_vendor_restore.php | 7 +- app/devices/device_vendors.php | 7 +- app/devices/devices.php | 7 +- app/devices/resources/classes/device.php | 1 - .../resources/dashboard/device_keys.php | 7 +- app/devices/root.php | 90 ------------------- app/dialplan_inbound/dialplan_inbound_add.php | 7 +- app/dialplan_inbound/root.php | 90 ------------------- .../dialplan_outbound_add.php | 7 +- app/dialplan_outbound/root.php | 90 ------------------- app/dialplans/root.php | 90 ------------------- .../resources/dashboard/domain_limits.php | 7 +- app/email_logs/email_log_cron.php | 10 +-- app/email_logs/email_log_view.php | 7 +- app/email_logs/email_logs.php | 7 +- app/email_logs/email_test.php | 7 +- app/email_logs/root.php | 90 ------------------- app/email_queue/email_queue.php | 7 +- app/email_queue/email_queue_delete.php | 7 +- app/email_queue/email_queue_edit.php | 7 +- .../resources/jobs/email_queue.php | 13 ++- app/email_queue/resources/jobs/email_send.php | 13 ++- .../resources/service/email_queue.php | 13 ++- app/email_queue/root.php | 66 -------------- app/email_templates/email_template_edit.php | 7 +- app/email_templates/email_templates.php | 7 +- app/email_templates/root.php | 90 ------------------- app/event_guard/event_guard_log_edit.php | 7 +- app/event_guard/event_guard_logs.php | 7 +- .../resources/service/event_guard.php | 13 ++- app/event_guard/root.php | 90 ------------------- app/extension_settings/app_config.php | 0 app/extension_settings/app_defaults.php | 0 app/extension_settings/app_languages.php | 0 .../extension_setting_edit.php | 7 +- app/extension_settings/extension_settings.php | 7 +- .../resources/classes/extension_settings.php | 0 app/extension_settings/root.php | 90 ------------------- app/extensions/extension_copy.php | 7 +- app/extensions/extension_download.php | 7 +- app/extensions/extension_edit.php | 7 +- app/extensions/extension_imports.php | 7 +- .../resources/dashboard/caller_id.php | 7 +- app/extensions/root.php | 90 ------------------- app/fax/fax.php | 7 +- app/fax/fax_active.php | 26 +++--- app/fax/fax_active_exec.php | 26 +++--- app/fax/fax_active_inc.php | 34 ++++--- app/fax/fax_copy.php | 7 +- app/fax/fax_edit.php | 7 +- app/fax/fax_emails.php | 7 +- app/fax/fax_files.php | 7 +- app/fax/fax_files_remote.php | 7 +- app/fax/fax_log_view.php | 7 +- app/fax/fax_logs.php | 7 +- app/fax/fax_outbox.php | 7 +- app/fax/fax_send.php | 7 +- app/fax/root.php | 90 ------------------- app/fax_queue/fax_queue.php | 7 +- app/fax_queue/fax_queue_delete.php | 7 +- app/fax_queue/fax_queue_edit.php | 7 +- app/fax_queue/resources/job/fax_queue.php | 13 ++- app/fax_queue/resources/job/fax_send.php | 13 ++- app/fax_queue/resources/service/fax_queue.php | 13 ++- app/fax_queue/root.php | 66 -------------- app/fifo/fifo_add.php | 7 +- app/fifo/root.php | 90 ------------------- app/fifo_list/fifo_exec.php | 7 +- app/fifo_list/fifo_interactive.php | 7 +- app/fifo_list/fifo_interactive_inc.php | 7 +- app/fifo_list/fifo_list.php | 26 +++--- app/fifo_list/fifo_list_inc.php | 7 +- app/fifo_list/root.php | 90 ------------------- app/follow_me/root.php | 90 ------------------- app/gateways/gateway_copy.php | 7 +- app/gateways/gateway_edit.php | 7 +- app/gateways/gateways.php | 7 +- app/gateways/root.php | 90 ------------------- app/gswave/index.php | 7 +- app/gswave/root.php | 90 ------------------- app/ivr_menus/ivr_menu_copy.php | 7 +- app/ivr_menus/ivr_menu_edit.php | 7 +- app/ivr_menus/ivr_menus.php | 7 +- app/ivr_menus/root.php | 90 ------------------- app/log_viewer/log_viewer.php | 7 +- app/log_viewer/root.php | 90 ------------------- app/modules/module_edit.php | 7 +- app/modules/modules.php | 7 +- app/modules/root.php | 90 ------------------- app/music_on_hold/music_on_hold.php | 7 +- app/music_on_hold/music_on_hold_edit.php | 7 +- .../classes/switch_music_on_hold.php | 1 - app/music_on_hold/root.php | 90 ------------------- app/number_translations/cmd.php | 7 +- .../number_translation_edit.php | 7 +- .../number_translations.php | 7 +- app/number_translations/root.php | 90 ------------------- app/phrases/phrase_edit.php | 7 +- app/phrases/phrases.php | 7 +- app/phrases/root.php | 90 ------------------- app/pin_numbers/pin_download.php | 7 +- app/pin_numbers/pin_number_edit.php | 7 +- app/pin_numbers/pin_numbers.php | 7 +- app/pin_numbers/root.php | 90 ------------------- app/provision/index.php | 7 +- app/provision/resources/classes/provision.php | 1 - app/provision/root.php | 90 ------------------- app/recordings/recording_edit.php | 7 +- app/recordings/recording_play.php | 7 +- app/recordings/recordings.php | 7 +- app/recordings/root.php | 90 ------------------- app/registrations/registration_reload.php | 7 +- app/registrations/registrations.php | 7 +- app/registrations/root.php | 90 ------------------- .../dashboard/ring_group_forward.php | 7 +- app/ring_groups/resources/dashboard/root.php | 90 ------------------- app/ring_groups/ring_group_edit.php | 7 +- app/ring_groups/ring_groups.php | 7 +- app/ring_groups/root.php | 90 ------------------- app/settings/root.php | 90 ------------------- app/settings/setting_edit.php | 7 +- app/sip_profiles/root.php | 90 ------------------- app/sip_profiles/sip_profile_copy.php | 7 +- app/sip_profiles/sip_profile_edit.php | 7 +- app/sip_profiles/sip_profiles.php | 7 +- app/sip_status/cmd.php | 7 +- app/sip_status/root.php | 90 ------------------- app/sip_status/sip_status.php | 8 +- app/sofia_global_settings/root.php | 90 ------------------- .../sofia_global_setting_edit.php | 7 +- .../sofia_global_settings.php | 7 +- app/streams/root.php | 90 ------------------- app/streams/stream_edit.php | 7 +- app/streams/streams.php | 7 +- .../resources/dashboard/switch_status.php | 7 +- .../resources/dashboard/system_cpu_status.php | 7 +- .../resources/dashboard/system_status.php | 7 +- app/system/root.php | 90 ------------------- app/system/system.php | 7 +- app/time_conditions/root.php | 90 ------------------- app/time_conditions/time_condition_edit.php | 7 +- app/time_conditions/time_conditions.php | 7 +- app/vars/root.php | 90 ------------------- app/vars/var_edit.php | 7 +- app/vars/vars.php | 8 +- app/voicemail_greetings/root.php | 90 ------------------- .../voicemail_greeting_edit.php | 7 +- .../voicemail_greetings.php | 7 +- .../resources/dashboard/voicemails.php | 7 +- app/voicemails/root.php | 90 ------------------- app/voicemails/voicemail_edit.php | 7 +- app/voicemails/voicemail_imports.php | 7 +- app/voicemails/voicemail_message_toggle.php | 27 +++--- app/voicemails/voicemail_messages.php | 7 +- app/voicemails/voicemails.php | 7 +- app/xml_cdr/download.php | 7 +- app/xml_cdr/report.php | 6 +- .../resources/dashboard/missed_calls.php | 7 +- .../resources/dashboard/recent_calls.php | 7 +- app/xml_cdr/resources/dashboard/root.php | 90 ------------------- app/xml_cdr/root.php | 90 ------------------- app/xml_cdr/xml_cdr.php | 7 +- app/xml_cdr/xml_cdr_archive.php | 7 +- app/xml_cdr/xml_cdr_details.php | 7 +- app/xml_cdr/xml_cdr_export.php | 7 +- app/xml_cdr/xml_cdr_extension_summary.php | 7 +- app/xml_cdr/xml_cdr_import.php | 7 +- app/xml_cdr/xml_cdr_inc.php | 7 +- app/xml_cdr/xml_cdr_search.php | 7 +- app/xml_cdr/xml_cdr_statistics.php | 7 +- app/xml_cdr/xml_cdr_statistics_csv.php | 7 +- app/xml_cdr/xml_cdr_statistics_inc.php | 7 +- core/authentication/root.php | 90 ------------------- core/dashboard/dashboard.php | 7 +- core/dashboard/dashboard_edit.php | 7 +- core/dashboard/index.php | 5 +- core/dashboard/root.php | 90 ------------------- core/databases/database_edit.php | 7 +- core/databases/databases.php | 7 +- core/databases/root.php | 90 ------------------- .../default_settings/default_setting_edit.php | 7 +- .../default_setting_toggle.php | 7 +- core/default_settings/default_settings.php | 7 +- .../default_settings_reload.php | 11 ++- core/default_settings/root.php | 90 ------------------- core/domain_settings/domain_setting_edit.php | 7 +- core/domain_settings/domain_settings.php | 7 +- core/domain_settings/root.php | 90 ------------------- core/domains/domain_edit.php | 7 +- core/domains/domains.php | 7 +- core/domains/root.php | 90 ------------------- core/events/resources/classes/events.php | 6 +- core/groups/group_edit.php | 7 +- core/groups/group_members.php | 7 +- core/groups/group_permissions.php | 7 +- core/groups/groupmemberadd.php | 7 +- core/groups/groupmemberdelete.php | 7 +- core/groups/groups.php | 7 +- core/groups/permissions_copy.php | 7 +- core/groups/permissions_default.php | 6 +- core/groups/root.php | 90 ------------------- core/install/install.php | 7 +- core/install/root.php | 90 ------------------- core/menu/menu.php | 7 +- core/menu/menu_edit.php | 7 +- core/menu/menu_item_edit.php | 7 +- core/menu/menu_item_list.php | 7 +- core/menu/menu_item_move_down.php | 27 +++--- core/menu/menu_item_move_up.php | 26 +++--- core/menu/menu_reload.php | 7 +- core/menu/menu_restore_default.php | 6 +- core/menu/root.php | 90 ------------------- core/notifications/notification_edit.php | 26 +++--- core/notifications/root.php | 90 ------------------- core/upgrade/index.php | 7 +- core/upgrade/root.php | 90 ------------------- core/upgrade/upgrade_domains.php | 15 ++-- core/upgrade/upgrade_schema.php | 16 ++-- core/user_logs/root.php | 90 ------------------- core/user_logs/user_log_edit.php | 7 +- core/user_logs/user_logs.php | 7 +- core/user_settings/root.php | 90 ------------------- core/user_settings/user_dashboard.php | 8 +- core/user_settings/user_setting_edit.php | 7 +- core/user_settings/user_setting_set.php | 7 +- core/user_settings/user_settings.php | 7 +- core/users/root.php | 90 ------------------- core/users/user_edit.php | 7 +- core/users/user_imports.php | 7 +- core/users/users.php | 7 +- index.php | 7 +- login.php | 7 +- logout.php | 7 +- project_root.php | 0 resources/captcha/root.php | 90 ------------------- resources/classes/captcha.php | 8 +- resources/classes/config.php | 8 +- resources/classes/database.php | 10 ++- resources/classes/directory.php | 1 - resources/classes/domains.php | 11 +-- resources/classes/events.php | 9 +- resources/classes/root.php | 90 ------------------- resources/classes/schema.php | 9 +- resources/classes/template.php | 1 - resources/fonts/root.php | 90 ------------------- resources/fonts/web_font_loader.php | 6 +- resources/footer.php | 7 +- resources/header.php | 7 +- resources/pdo.php | 7 +- resources/pdo_vm.php | 9 +- resources/root.php | 90 ------------------- resources/switch.php | 7 +- resources/uuid.php | 12 ++- root.php | 90 ------------------- secure/fax_to_email.php | 7 +- secure/index.php | 8 +- secure/root.php | 90 ------------------- themes/default/css.php | 6 +- themes/default/root.php | 90 ------------------- 400 files changed, 1627 insertions(+), 8255 deletions(-) delete mode 100644 app/access_controls/root.php delete mode 100644 app/basic_operator_panel/resources/root.php delete mode 100644 app/basic_operator_panel/root.php delete mode 100644 app/bridges/root.php delete mode 100644 app/call_block/root.php delete mode 100644 app/call_broadcast/root.php delete mode 100644 app/call_center_active/root.php delete mode 100644 app/call_centers/root.php delete mode 100644 app/call_flows/root.php delete mode 100644 app/call_forward/root.php delete mode 100644 app/call_recordings/root.php delete mode 100644 app/calls_active/root.php delete mode 100644 app/click_to_call/root.php delete mode 100644 app/conference_centers/root.php delete mode 100644 app/conference_controls/root.php delete mode 100644 app/conference_profiles/root.php delete mode 100644 app/conferences/root.php delete mode 100644 app/conferences_active/root.php delete mode 100644 app/contacts/root.php delete mode 100644 app/database_transactions/root.php delete mode 100644 app/destinations/resources/root.php delete mode 100644 app/destinations/root.php delete mode 100644 app/devices/root.php delete mode 100644 app/dialplan_inbound/root.php delete mode 100644 app/dialplan_outbound/root.php delete mode 100644 app/dialplans/root.php delete mode 100644 app/email_logs/root.php delete mode 100644 app/email_queue/root.php delete mode 100644 app/email_templates/root.php delete mode 100644 app/event_guard/root.php mode change 100755 => 100644 app/extension_settings/app_config.php mode change 100755 => 100644 app/extension_settings/app_defaults.php mode change 100755 => 100644 app/extension_settings/app_languages.php mode change 100755 => 100644 app/extension_settings/extension_setting_edit.php mode change 100755 => 100644 app/extension_settings/extension_settings.php mode change 100755 => 100644 app/extension_settings/resources/classes/extension_settings.php delete mode 100755 app/extension_settings/root.php delete mode 100644 app/extensions/root.php delete mode 100644 app/fax/root.php delete mode 100644 app/fax_queue/root.php delete mode 100644 app/fifo/root.php delete mode 100644 app/fifo_list/root.php delete mode 100644 app/follow_me/root.php delete mode 100644 app/gateways/root.php delete mode 100644 app/gswave/root.php delete mode 100644 app/ivr_menus/root.php delete mode 100644 app/log_viewer/root.php delete mode 100644 app/modules/root.php delete mode 100644 app/music_on_hold/root.php delete mode 100644 app/number_translations/root.php delete mode 100644 app/phrases/root.php delete mode 100644 app/pin_numbers/root.php delete mode 100644 app/provision/root.php delete mode 100644 app/recordings/root.php delete mode 100644 app/registrations/root.php delete mode 100644 app/ring_groups/resources/dashboard/root.php delete mode 100644 app/ring_groups/root.php delete mode 100644 app/settings/root.php delete mode 100644 app/sip_profiles/root.php delete mode 100644 app/sip_status/root.php delete mode 100644 app/sofia_global_settings/root.php delete mode 100644 app/streams/root.php delete mode 100644 app/system/root.php delete mode 100644 app/time_conditions/root.php delete mode 100644 app/vars/root.php delete mode 100644 app/voicemail_greetings/root.php delete mode 100644 app/voicemails/root.php delete mode 100644 app/xml_cdr/resources/dashboard/root.php delete mode 100644 app/xml_cdr/root.php delete mode 100644 core/authentication/root.php delete mode 100644 core/dashboard/root.php delete mode 100644 core/databases/root.php delete mode 100644 core/default_settings/root.php delete mode 100644 core/domain_settings/root.php delete mode 100644 core/domains/root.php delete mode 100644 core/groups/root.php delete mode 100644 core/install/root.php delete mode 100644 core/menu/root.php delete mode 100644 core/notifications/root.php delete mode 100644 core/upgrade/root.php delete mode 100644 core/user_logs/root.php delete mode 100644 core/user_settings/root.php delete mode 100644 core/users/root.php delete mode 100644 project_root.php delete mode 100644 resources/captcha/root.php delete mode 100644 resources/classes/root.php delete mode 100644 resources/fonts/root.php delete mode 100644 resources/root.php delete mode 100644 root.php delete mode 100644 secure/root.php delete mode 100644 themes/default/root.php diff --git a/app/access_controls/access_control_edit.php b/app/access_controls/access_control_edit.php index 559638d18c..53a8d5cb6f 100644 --- a/app/access_controls/access_control_edit.php +++ b/app/access_controls/access_control_edit.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/access_controls/access_controls.php b/app/access_controls/access_controls.php index 78423c0ec9..d31be599dd 100644 --- a/app/access_controls/access_controls.php +++ b/app/access_controls/access_controls.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/access_controls/root.php b/app/access_controls/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/access_controls/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/basic_operator_panel/autocomplete.php b/app/basic_operator_panel/autocomplete.php index d8b5db76f2..34397c2a14 100644 --- a/app/basic_operator_panel/autocomplete.php +++ b/app/basic_operator_panel/autocomplete.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/basic_operator_panel/exec.php b/app/basic_operator_panel/exec.php index 43428d737d..7a78c893c3 100644 --- a/app/basic_operator_panel/exec.php +++ b/app/basic_operator_panel/exec.php @@ -27,8 +27,11 @@ POSSIBILITY OF SUCH DAMAGE. */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/basic_operator_panel/index.php b/app/basic_operator_panel/index.php index b7fc652700..7cff60b6f4 100644 --- a/app/basic_operator_panel/index.php +++ b/app/basic_operator_panel/index.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/basic_operator_panel/resources/content.php b/app/basic_operator_panel/resources/content.php index c96268f2ac..7e759e190c 100644 --- a/app/basic_operator_panel/resources/content.php +++ b/app/basic_operator_panel/resources/content.php @@ -25,7 +25,11 @@ */ //includes -include "root.php"; +//set the include path +$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); +set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/basic_operator_panel/resources/root.php b/app/basic_operator_panel/resources/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/basic_operator_panel/resources/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/basic_operator_panel/root.php b/app/basic_operator_panel/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/basic_operator_panel/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/bridges/bridge_edit.php b/app/bridges/bridge_edit.php index 49f2a7483d..f057bd6aef 100644 --- a/app/bridges/bridge_edit.php +++ b/app/bridges/bridge_edit.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/bridges/bridges.php b/app/bridges/bridges.php index c8e0b8302b..007c6f4e90 100644 --- a/app/bridges/bridges.php +++ b/app/bridges/bridges.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/bridges/root.php b/app/bridges/root.php deleted file mode 100644 index 1ff8f7927e..0000000000 --- a/app/bridges/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2018 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> diff --git a/app/call_block/call_block.php b/app/call_block/call_block.php index c8e3d08caf..09c6af8d0a 100644 --- a/app/call_block/call_block.php +++ b/app/call_block/call_block.php @@ -27,8 +27,11 @@ All of it has been rewritten over years. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/call_block/call_block_edit.php b/app/call_block/call_block_edit.php index 1705e30168..7280c027c5 100644 --- a/app/call_block/call_block_edit.php +++ b/app/call_block/call_block_edit.php @@ -27,8 +27,11 @@ Original version of Call Block was written by Gerrit Visser */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_block/root.php b/app/call_block/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/call_block/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/call_broadcast/call_broadcast.php b/app/call_broadcast/call_broadcast.php index 15bba09512..ca5c2a64dc 100644 --- a/app/call_broadcast/call_broadcast.php +++ b/app/call_broadcast/call_broadcast.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/call_broadcast/call_broadcast_edit.php b/app/call_broadcast/call_broadcast_edit.php index 5ef15a863a..b5d6cf5f6d 100644 --- a/app/call_broadcast/call_broadcast_edit.php +++ b/app/call_broadcast/call_broadcast_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_broadcast/call_broadcast_send.php b/app/call_broadcast/call_broadcast_send.php index 8fdb40ee05..6fed9b5e59 100644 --- a/app/call_broadcast/call_broadcast_send.php +++ b/app/call_broadcast/call_broadcast_send.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_broadcast/call_broadcast_stop.php b/app/call_broadcast/call_broadcast_stop.php index 12269811bc..8a17813eeb 100644 --- a/app/call_broadcast/call_broadcast_stop.php +++ b/app/call_broadcast/call_broadcast_stop.php @@ -23,7 +23,11 @@ Contributor(s): Mark J Crane */ -include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('call_broadcast_send')) { diff --git a/app/call_broadcast/root.php b/app/call_broadcast/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/call_broadcast/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/call_center_active/call_center_active.php b/app/call_center_active/call_center_active.php index 5e89d220b5..0f8537711b 100644 --- a/app/call_center_active/call_center_active.php +++ b/app/call_center_active/call_center_active.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_center_active/call_center_active_inc.php b/app/call_center_active/call_center_active_inc.php index 7084c5ff45..ff12884c63 100644 --- a/app/call_center_active/call_center_active_inc.php +++ b/app/call_center_active/call_center_active_inc.php @@ -25,8 +25,11 @@ James Rose */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_center_active/call_center_exec.php b/app/call_center_active/call_center_exec.php index 8cd0ad0ece..094f2a243f 100644 --- a/app/call_center_active/call_center_exec.php +++ b/app/call_center_active/call_center_exec.php @@ -27,8 +27,11 @@ POSSIBILITY OF SUCH DAMAGE. */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_center_active/call_center_queue.php b/app/call_center_active/call_center_queue.php index d03033b0b8..6a5da5416d 100644 --- a/app/call_center_active/call_center_queue.php +++ b/app/call_center_active/call_center_queue.php @@ -23,8 +23,11 @@ Contributor(s): Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/call_center_active/root.php b/app/call_center_active/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/call_center_active/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/call_centers/call_center_agent_edit.php b/app/call_centers/call_center_agent_edit.php index 1568727f38..008355574a 100644 --- a/app/call_centers/call_center_agent_edit.php +++ b/app/call_centers/call_center_agent_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_centers/call_center_agent_status.php b/app/call_centers/call_center_agent_status.php index b9251ea1d3..8912a63db5 100644 --- a/app/call_centers/call_center_agent_status.php +++ b/app/call_centers/call_center_agent_status.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/call_centers/call_center_agents.php b/app/call_centers/call_center_agents.php index bae686ba4f..3c2328e39a 100644 --- a/app/call_centers/call_center_agents.php +++ b/app/call_centers/call_center_agents.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index b5e1fa3ef9..aba9949ab4 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_centers/call_center_queues.php b/app/call_centers/call_center_queues.php index 84252b359b..1ae062f0d2 100644 --- a/app/call_centers/call_center_queues.php +++ b/app/call_centers/call_center_queues.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/call_centers/cmd.php b/app/call_centers/cmd.php index 1dea6139b0..82777642ad 100644 --- a/app/call_centers/cmd.php +++ b/app/call_centers/cmd.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_centers/resources/dashboard/call_center_agents.php b/app/call_centers/resources/dashboard/call_center_agents.php index dc6388f957..39b9c0e365 100644 --- a/app/call_centers/resources/dashboard/call_center_agents.php +++ b/app/call_centers/resources/dashboard/call_center_agents.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_centers/root.php b/app/call_centers/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/call_centers/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index d7b4cc6f21..7869931092 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_edit.php @@ -25,8 +25,11 @@ Lewis Hallam */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //check permissions diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index 0a899828c9..3a8c3e6441 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/paging.php"; require_once "resources/check_auth.php"; diff --git a/app/call_flows/root.php b/app/call_flows/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/call_flows/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/call_forward/call_forward.php b/app/call_forward/call_forward.php index 7c935d94c1..2b1dcaa8bf 100644 --- a/app/call_forward/call_forward.php +++ b/app/call_forward/call_forward.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/call_forward/call_forward_edit.php b/app/call_forward/call_forward_edit.php index fb4470ad2b..089cee9637 100644 --- a/app/call_forward/call_forward_edit.php +++ b/app/call_forward/call_forward_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_forward/resources/classes/call_forward.php b/app/call_forward/resources/classes/call_forward.php index b69bfd7930..0fdf152605 100644 --- a/app/call_forward/resources/classes/call_forward.php +++ b/app/call_forward/resources/classes/call_forward.php @@ -26,7 +26,6 @@ Errol Samuels */ -include "root.php"; //define the call_forward class class call_forward { diff --git a/app/call_forward/resources/classes/do_not_disturb.php b/app/call_forward/resources/classes/do_not_disturb.php index bcb1975df7..f178bc15ba 100644 --- a/app/call_forward/resources/classes/do_not_disturb.php +++ b/app/call_forward/resources/classes/do_not_disturb.php @@ -23,7 +23,6 @@ Contributor(s): Mark J Crane */ -include "root.php"; //define the dnd class class do_not_disturb { diff --git a/app/call_forward/resources/classes/feature_event_notify.php b/app/call_forward/resources/classes/feature_event_notify.php index b7efff6196..936a12b803 100644 --- a/app/call_forward/resources/classes/feature_event_notify.php +++ b/app/call_forward/resources/classes/feature_event_notify.php @@ -24,7 +24,6 @@ Mark J Crane KonradSC */ -include "root.php"; //define the feature_event_notify class class feature_event_notify { diff --git a/app/call_forward/resources/classes/follow_me.php b/app/call_forward/resources/classes/follow_me.php index eeac0e308b..fe1fd462ed 100644 --- a/app/call_forward/resources/classes/follow_me.php +++ b/app/call_forward/resources/classes/follow_me.php @@ -27,7 +27,6 @@ Riccardo Granchi Errol Samuels */ -include "root.php"; //define the follow me class class follow_me { diff --git a/app/call_forward/resources/dashboard/call_forward.php b/app/call_forward/resources/dashboard/call_forward.php index 2034b93392..ba93dd63dd 100644 --- a/app/call_forward/resources/dashboard/call_forward.php +++ b/app/call_forward/resources/dashboard/call_forward.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - //require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_forward/resources/jobs/dnd.php b/app/call_forward/resources/jobs/dnd.php index fe6410687e..f3c082305a 100644 --- a/app/call_forward/resources/jobs/dnd.php +++ b/app/call_forward/resources/jobs/dnd.php @@ -2,20 +2,15 @@ //check the permission if (defined('STDIN')) { - $document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]); - preg_match("/^(.*)\/app\/.*$/", $document_root, $matches); - if (isset($matches[1])) { - $document_root = $matches[1]; - set_include_path($document_root); - $_SERVER["DOCUMENT_ROOT"] = $document_root; - } + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/require.php"; } else { exit; - include "root.php"; - require_once "resources/require.php"; - require_once "resources/pdo.php"; } //increase limits diff --git a/app/call_forward/root.php b/app/call_forward/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/call_forward/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/call_recordings/call_recordings.php b/app/call_recordings/call_recordings.php index 27d68499de..39bd5c2e3c 100644 --- a/app/call_recordings/call_recordings.php +++ b/app/call_recordings/call_recordings.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/call_recordings/download.php b/app/call_recordings/download.php index 8c54ffbba5..ad61ef73e7 100644 --- a/app/call_recordings/download.php +++ b/app/call_recordings/download.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/call_recordings/root.php b/app/call_recordings/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/call_recordings/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/calls_active/calls_active.php b/app/calls_active/calls_active.php index 48f222a580..b39f6ff893 100644 --- a/app/calls_active/calls_active.php +++ b/app/calls_active/calls_active.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/calls_active/calls_active_inc.php b/app/calls_active/calls_active_inc.php index 10a326a620..b3315e020d 100644 --- a/app/calls_active/calls_active_inc.php +++ b/app/calls_active/calls_active_inc.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/calls_active/calls_exec.php b/app/calls_active/calls_exec.php index cb3f220ca7..bb34421d81 100644 --- a/app/calls_active/calls_exec.php +++ b/app/calls_active/calls_exec.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes fileshp"; require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/calls_active/root.php b/app/calls_active/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/calls_active/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/click_to_call/click_to_call.php b/app/click_to_call/click_to_call.php index 18e31bb3d6..b0b0e1bdd3 100644 --- a/app/click_to_call/click_to_call.php +++ b/app/click_to_call/click_to_call.php @@ -30,8 +30,11 @@ James Rose */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/click_to_call/root.php b/app/click_to_call/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/click_to_call/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index fe8b29769e..4c7c976be5 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //check permissions diff --git a/app/conference_centers/conference_centers.php b/app/conference_centers/conference_centers.php index 6747fbc31d..a731eceaac 100644 --- a/app/conference_centers/conference_centers.php +++ b/app/conference_centers/conference_centers.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/conference_centers/conference_room_edit.php b/app/conference_centers/conference_room_edit.php index f7913f07c8..759ecab22e 100644 --- a/app/conference_centers/conference_room_edit.php +++ b/app/conference_centers/conference_room_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/conference_centers/conference_rooms.php b/app/conference_centers/conference_rooms.php index f398f72ae2..75a666dffc 100644 --- a/app/conference_centers/conference_rooms.php +++ b/app/conference_centers/conference_rooms.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/conference_centers/conference_session_details.php b/app/conference_centers/conference_session_details.php index c20398e7ea..7fb9fc87cb 100644 --- a/app/conference_centers/conference_session_details.php +++ b/app/conference_centers/conference_session_details.php @@ -23,8 +23,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/conference_centers/conference_sessions.php b/app/conference_centers/conference_sessions.php index eca8b8fc25..4c293edd90 100644 --- a/app/conference_centers/conference_sessions.php +++ b/app/conference_centers/conference_sessions.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/conference_centers/download.php b/app/conference_centers/download.php index 8bfbeb2186..a6f6408d45 100644 --- a/app/conference_centers/download.php +++ b/app/conference_centers/download.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //check permisions diff --git a/app/conference_centers/resources/classes/call_center_notify.php b/app/conference_centers/resources/classes/call_center_notify.php index 8626d09a80..2923c407ad 100644 --- a/app/conference_centers/resources/classes/call_center_notify.php +++ b/app/conference_centers/resources/classes/call_center_notify.php @@ -24,7 +24,6 @@ Mark J Crane KonradSC */ -include "root.php"; //define the blf_notify class class call_center_notify { diff --git a/app/conference_centers/root.php b/app/conference_centers/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/conference_centers/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/conference_controls/conference_control_detail_edit.php b/app/conference_controls/conference_control_detail_edit.php index 172e64305a..b16c6847e5 100644 --- a/app/conference_controls/conference_control_detail_edit.php +++ b/app/conference_controls/conference_control_detail_edit.php @@ -1,7 +1,10 @@ */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/conference_controls/conference_control_edit.php b/app/conference_controls/conference_control_edit.php index 9f81d16042..ddf9531c2a 100644 --- a/app/conference_controls/conference_control_edit.php +++ b/app/conference_controls/conference_control_edit.php @@ -1,7 +1,10 @@ */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/conference_controls/root.php b/app/conference_controls/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/conference_controls/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/conference_profiles/conference_profile_edit.php b/app/conference_profiles/conference_profile_edit.php index 156ee1481b..bbb26f3591 100644 --- a/app/conference_profiles/conference_profile_edit.php +++ b/app/conference_profiles/conference_profile_edit.php @@ -1,7 +1,10 @@ */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/conference_profiles/root.php b/app/conference_profiles/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/conference_profiles/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/conferences/conference_edit.php b/app/conferences/conference_edit.php index 4d5c30212e..a9322e3d81 100644 --- a/app/conferences/conference_edit.php +++ b/app/conferences/conference_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/conferences/conferences.php b/app/conferences/conferences.php index 38a6add73c..9e2b205b8f 100644 --- a/app/conferences/conferences.php +++ b/app/conferences/conferences.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/conferences/root.php b/app/conferences/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/conferences/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/conferences_active/conference_exec.php b/app/conferences_active/conference_exec.php index 2ec35d775b..fc1da29407 100644 --- a/app/conferences_active/conference_exec.php +++ b/app/conferences_active/conference_exec.php @@ -37,7 +37,6 @@ */ //includes - include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/conferences_active/conference_interactive.php b/app/conferences_active/conference_interactive.php index b17f59a17d..6b04c99333 100644 --- a/app/conferences_active/conference_interactive.php +++ b/app/conferences_active/conference_interactive.php @@ -25,8 +25,11 @@ James Rose */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/conferences_active/conference_interactive_inc.php b/app/conferences_active/conference_interactive_inc.php index 1f83c483e5..c7c15db10a 100644 --- a/app/conferences_active/conference_interactive_inc.php +++ b/app/conferences_active/conference_interactive_inc.php @@ -25,8 +25,11 @@ James Rose */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/conferences_active/conferences_active.php b/app/conferences_active/conferences_active.php index 128e80d7e9..c05c92ba2e 100644 --- a/app/conferences_active/conferences_active.php +++ b/app/conferences_active/conferences_active.php @@ -25,8 +25,11 @@ James Rose */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/conferences_active/conferences_active_inc.php b/app/conferences_active/conferences_active_inc.php index 8128694832..0ee4683dfb 100644 --- a/app/conferences_active/conferences_active_inc.php +++ b/app/conferences_active/conferences_active_inc.php @@ -25,8 +25,11 @@ James Rose */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/conferences_active/root.php b/app/conferences_active/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/conferences_active/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/contacts/contact_address_edit.php b/app/contacts/contact_address_edit.php index 60ffa02049..1e371c0aa7 100644 --- a/app/contacts/contact_address_edit.php +++ b/app/contacts/contact_address_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_addresses.php b/app/contacts/contact_addresses.php index 4cbb30dd76..033af7efa1 100644 --- a/app/contacts/contact_addresses.php +++ b/app/contacts/contact_addresses.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_addresses_view.php b/app/contacts/contact_addresses_view.php index 0ff619f9ee..a6d6bb7b19 100644 --- a/app/contacts/contact_addresses_view.php +++ b/app/contacts/contact_addresses_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_attachment.php b/app/contacts/contact_attachment.php index 573974595f..245e153f24 100644 --- a/app/contacts/contact_attachment.php +++ b/app/contacts/contact_attachment.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //add multi-lingual support diff --git a/app/contacts/contact_attachment_edit.php b/app/contacts/contact_attachment_edit.php index 8009d0300e..e5bcdf32e3 100644 --- a/app/contacts/contact_attachment_edit.php +++ b/app/contacts/contact_attachment_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_attachments.php b/app/contacts/contact_attachments.php index 9c1386675c..3a0aa3bb8d 100644 --- a/app/contacts/contact_attachments.php +++ b/app/contacts/contact_attachments.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_attachments_view.php b/app/contacts/contact_attachments_view.php index 7d9f556ec5..5e1bc2551c 100644 --- a/app/contacts/contact_attachments_view.php +++ b/app/contacts/contact_attachments_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_auth.php b/app/contacts/contact_auth.php index c40e41a69e..9b52277050 100644 --- a/app/contacts/contact_auth.php +++ b/app/contacts/contact_auth.php @@ -23,7 +23,11 @@ Contributor(s): Mark J Crane */ -require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('contact_add')) { diff --git a/app/contacts/contact_edit.php b/app/contacts/contact_edit.php index cbbed05092..9435de422c 100644 --- a/app/contacts/contact_edit.php +++ b/app/contacts/contact_edit.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_email_edit.php b/app/contacts/contact_email_edit.php index 6d41d4fec8..eac459ba15 100644 --- a/app/contacts/contact_email_edit.php +++ b/app/contacts/contact_email_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_emails.php b/app/contacts/contact_emails.php index 589923e48f..8ed5d15903 100644 --- a/app/contacts/contact_emails.php +++ b/app/contacts/contact_emails.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_emails_view.php b/app/contacts/contact_emails_view.php index e3e03a0bec..e0d8f996e6 100644 --- a/app/contacts/contact_emails_view.php +++ b/app/contacts/contact_emails_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_extensions.php b/app/contacts/contact_extensions.php index 992f957e20..7282108bb2 100644 --- a/app/contacts/contact_extensions.php +++ b/app/contacts/contact_extensions.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_extensions_view.php b/app/contacts/contact_extensions_view.php index 9eef8e8c77..dc859bd32d 100644 --- a/app/contacts/contact_extensions_view.php +++ b/app/contacts/contact_extensions_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_import.php b/app/contacts/contact_import.php index a3460bde54..4b4f3e4bfd 100644 --- a/app/contacts/contact_import.php +++ b/app/contacts/contact_import.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_import_google.php b/app/contacts/contact_import_google.php index 51372e9a3e..67c06eed00 100644 --- a/app/contacts/contact_import_google.php +++ b/app/contacts/contact_import_google.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/functions/google_get_groups.php"; diff --git a/app/contacts/contact_note_edit.php b/app/contacts/contact_note_edit.php index e5c8b83192..70db8a0741 100644 --- a/app/contacts/contact_note_edit.php +++ b/app/contacts/contact_note_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_notes.php b/app/contacts/contact_notes.php index e4cb202d3f..f72d161bde 100644 --- a/app/contacts/contact_notes.php +++ b/app/contacts/contact_notes.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_notes_view.php b/app/contacts/contact_notes_view.php index e06eda4059..90ca978cd7 100644 --- a/app/contacts/contact_notes_view.php +++ b/app/contacts/contact_notes_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_phone_edit.php b/app/contacts/contact_phone_edit.php index 938973ca7c..44cb81010e 100644 --- a/app/contacts/contact_phone_edit.php +++ b/app/contacts/contact_phone_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_phones.php b/app/contacts/contact_phones.php index ab2e5688c5..7b38a03369 100644 --- a/app/contacts/contact_phones.php +++ b/app/contacts/contact_phones.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_phones_view.php b/app/contacts/contact_phones_view.php index 4eac592e82..d820e2f652 100644 --- a/app/contacts/contact_phones_view.php +++ b/app/contacts/contact_phones_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_relation_edit.php b/app/contacts/contact_relation_edit.php index a0a856ea3f..d7010dbb48 100644 --- a/app/contacts/contact_relation_edit.php +++ b/app/contacts/contact_relation_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_relations.php b/app/contacts/contact_relations.php index c2c5f4b86a..1aa5b63cf3 100644 --- a/app/contacts/contact_relations.php +++ b/app/contacts/contact_relations.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_relations_view.php b/app/contacts/contact_relations_view.php index d17556cb33..ca4a8c2f5f 100644 --- a/app/contacts/contact_relations_view.php +++ b/app/contacts/contact_relations_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_setting_edit.php b/app/contacts/contact_setting_edit.php index 118a1a51ad..16c0fb2911 100644 --- a/app/contacts/contact_setting_edit.php +++ b/app/contacts/contact_setting_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_settings.php b/app/contacts/contact_settings.php index 915f989350..ddaf9a2457 100644 --- a/app/contacts/contact_settings.php +++ b/app/contacts/contact_settings.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_time_edit.php b/app/contacts/contact_time_edit.php index 32715bab05..6a140cc159 100644 --- a/app/contacts/contact_time_edit.php +++ b/app/contacts/contact_time_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_timer.php b/app/contacts/contact_timer.php index 15a61dbfe7..3b594805dc 100644 --- a/app/contacts/contact_timer.php +++ b/app/contacts/contact_timer.php @@ -23,10 +23,14 @@ Contributor(s): Mark J Crane */ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (!permission_exists('contact_time_add')) { echo "access denied"; exit; } +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + if (!permission_exists('contact_time_add')) { echo "access denied"; exit; } //add multi-lingual support $language = new text; diff --git a/app/contacts/contact_timer_inc.php b/app/contacts/contact_timer_inc.php index 4e9ed64385..18fc484cee 100644 --- a/app/contacts/contact_timer_inc.php +++ b/app/contacts/contact_timer_inc.php @@ -23,10 +23,14 @@ Contributor(s): Mark J Crane */ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (!permission_exists('contact_time_add')) { echo "access denied"; exit; } +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + if (!permission_exists('contact_time_add')) { echo "access denied"; exit; } //get contact and time uuids $domain_uuid = $_REQUEST['domain_uuid']; diff --git a/app/contacts/contact_times.php b/app/contacts/contact_times.php index 121ff8ff8e..62f6205e08 100644 --- a/app/contacts/contact_times.php +++ b/app/contacts/contact_times.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_times_view.php b/app/contacts/contact_times_view.php index 532e39ea5a..5d33f73a2d 100644 --- a/app/contacts/contact_times_view.php +++ b/app/contacts/contact_times_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_url_edit.php b/app/contacts/contact_url_edit.php index c7bf4a9515..b577cae21f 100644 --- a/app/contacts/contact_url_edit.php +++ b/app/contacts/contact_url_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_urls.php b/app/contacts/contact_urls.php index 530e976c25..8f14207ed3 100644 --- a/app/contacts/contact_urls.php +++ b/app/contacts/contact_urls.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_urls_view.php b/app/contacts/contact_urls_view.php index 7fd941c0eb..cd39241845 100644 --- a/app/contacts/contact_urls_view.php +++ b/app/contacts/contact_urls_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contact_view.php b/app/contacts/contact_view.php index aca5b6a432..c501800fda 100644 --- a/app/contacts/contact_view.php +++ b/app/contacts/contact_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/contacts/contacts.php b/app/contacts/contacts.php index fda8de102d..9e2ad83809 100644 --- a/app/contacts/contacts.php +++ b/app/contacts/contacts.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/contacts/contacts_vcard.php b/app/contacts/contacts_vcard.php index eb844b20ff..65a045e8f4 100644 --- a/app/contacts/contacts_vcard.php +++ b/app/contacts/contacts_vcard.php @@ -23,7 +23,12 @@ Contributor(s): Mark J Crane */ -include "root.php"; + +//set the include path +$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); +set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('contact_view')) { diff --git a/app/contacts/root.php b/app/contacts/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/contacts/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/database_transactions/database_transaction_edit.php b/app/database_transactions/database_transaction_edit.php index 18f816449a..74b97aa04f 100644 --- a/app/database_transactions/database_transaction_edit.php +++ b/app/database_transactions/database_transaction_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/database_transactions/database_transactions.php b/app/database_transactions/database_transactions.php index a7086169ec..02a76c3117 100644 --- a/app/database_transactions/database_transactions.php +++ b/app/database_transactions/database_transactions.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/database_transactions/root.php b/app/database_transactions/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/database_transactions/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/destinations/destination_download.php b/app/destinations/destination_download.php index f833e92003..da7a389368 100644 --- a/app/destinations/destination_download.php +++ b/app/destinations/destination_download.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 7b73146ced..b462cad371 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/destinations/destination_imports.php b/app/destinations/destination_imports.php index a1be437a86..c43767e1df 100644 --- a/app/destinations/destination_imports.php +++ b/app/destinations/destination_imports.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index c2ebf118be..b22f5e9059 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/destinations/resources/root.php b/app/destinations/resources/root.php deleted file mode 100644 index 22735436d0..0000000000 --- a/app/destinations/resources/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> diff --git a/app/destinations/root.php b/app/destinations/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/destinations/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/devices/cmd.php b/app/devices/cmd.php index 56abca9a6e..d79d75f689 100644 --- a/app/devices/cmd.php +++ b/app/devices/cmd.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/devices/device_copy.php b/app/devices/device_copy.php index a383e4f871..7d6a726601 100644 --- a/app/devices/device_copy.php +++ b/app/devices/device_copy.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/devices/device_download.php b/app/devices/device_download.php index f3569ae1be..ebdc058c56 100644 --- a/app/devices/device_download.php +++ b/app/devices/device_download.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 7771ecb939..d7dce45f8f 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -22,8 +22,11 @@ */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //check permissions diff --git a/app/devices/device_imports.php b/app/devices/device_imports.php index def7e7cdcb..050d3dbfd0 100644 --- a/app/devices/device_imports.php +++ b/app/devices/device_imports.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/devices/device_profile_copy.php b/app/devices/device_profile_copy.php index 021d183be9..4c791366c7 100644 --- a/app/devices/device_profile_copy.php +++ b/app/devices/device_profile_copy.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files"; require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/devices/device_profile_edit.php b/app/devices/device_profile_edit.php index 495b156534..a0a52d2808 100644 --- a/app/devices/device_profile_edit.php +++ b/app/devices/device_profile_edit.php @@ -23,8 +23,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //check permissions diff --git a/app/devices/device_profiles.php b/app/devices/device_profiles.php index 023983e145..d8752f3884 100644 --- a/app/devices/device_profiles.php +++ b/app/devices/device_profiles.php @@ -23,8 +23,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/devices/device_vendor_edit.php b/app/devices/device_vendor_edit.php index 9bef049368..bcef853a22 100644 --- a/app/devices/device_vendor_edit.php +++ b/app/devices/device_vendor_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //check permissions diff --git a/app/devices/device_vendor_function_edit.php b/app/devices/device_vendor_function_edit.php index d35f5b91a7..dbc07d4217 100644 --- a/app/devices/device_vendor_function_edit.php +++ b/app/devices/device_vendor_function_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //delete the group from the menu item diff --git a/app/devices/device_vendor_functions.php b/app/devices/device_vendor_functions.php index 0b92d55204..f2d7a96f59 100644 --- a/app/devices/device_vendor_functions.php +++ b/app/devices/device_vendor_functions.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files"; require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/devices/device_vendor_restore.php b/app/devices/device_vendor_restore.php index 0c8a302fad..0d1bf4b79c 100644 --- a/app/devices/device_vendor_restore.php +++ b/app/devices/device_vendor_restore.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //check permissions diff --git a/app/devices/device_vendors.php b/app/devices/device_vendors.php index d37c6812ff..7f8942cb3a 100644 --- a/app/devices/device_vendors.php +++ b/app/devices/device_vendors.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/devices/devices.php b/app/devices/devices.php index 8b69ad74b4..a6dbb9c249 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/devices/resources/classes/device.php b/app/devices/resources/classes/device.php index 4e7da2f666..42593be211 100644 --- a/app/devices/resources/classes/device.php +++ b/app/devices/resources/classes/device.php @@ -23,7 +23,6 @@ Contributor(s): Mark J Crane */ -include "root.php"; //define the device class class device { diff --git a/app/devices/resources/dashboard/device_keys.php b/app/devices/resources/dashboard/device_keys.php index 6536fbdd84..459030c256 100644 --- a/app/devices/resources/dashboard/device_keys.php +++ b/app/devices/resources/dashboard/device_keys.php @@ -22,8 +22,11 @@ */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/devices/root.php b/app/devices/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/devices/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/dialplan_inbound/dialplan_inbound_add.php b/app/dialplan_inbound/dialplan_inbound_add.php index b4770e0308..d3a90f3ba1 100644 --- a/app/dialplan_inbound/dialplan_inbound_add.php +++ b/app/dialplan_inbound/dialplan_inbound_add.php @@ -26,8 +26,11 @@ Riccardo Granchi */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/dialplan_inbound/root.php b/app/dialplan_inbound/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/dialplan_inbound/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 6c996bbbe4..aa228f8752 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -28,8 +28,11 @@ Andrew Colin */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/dialplan_outbound/root.php b/app/dialplan_outbound/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/dialplan_outbound/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/dialplans/root.php b/app/dialplans/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/dialplans/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/domain_limits/resources/dashboard/domain_limits.php b/app/domain_limits/resources/dashboard/domain_limits.php index d892917288..b8def62db9 100644 --- a/app/domain_limits/resources/dashboard/domain_limits.php +++ b/app/domain_limits/resources/dashboard/domain_limits.php @@ -1,7 +1,10 @@ */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/pop3/mime_parser.php"; diff --git a/app/email_logs/email_logs.php b/app/email_logs/email_logs.php index e25ea47224..cf23648064 100644 --- a/app/email_logs/email_logs.php +++ b/app/email_logs/email_logs.php @@ -15,8 +15,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/email_logs/email_test.php b/app/email_logs/email_test.php index d9951bf1b6..79cdc32722 100644 --- a/app/email_logs/email_test.php +++ b/app/email_logs/email_test.php @@ -24,8 +24,11 @@ * SUCH DAMAGE. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/email_logs/root.php b/app/email_logs/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/email_logs/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/email_queue/email_queue.php b/app/email_queue/email_queue.php index cdde8d44b0..1ea7e68a13 100644 --- a/app/email_queue/email_queue.php +++ b/app/email_queue/email_queue.php @@ -1,7 +1,10 @@ diff --git a/app/email_templates/email_template_edit.php b/app/email_templates/email_template_edit.php index 0e395deee7..a04bd242a5 100644 --- a/app/email_templates/email_template_edit.php +++ b/app/email_templates/email_template_edit.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/email_templates/email_templates.php b/app/email_templates/email_templates.php index 32b682fdd0..074dc6eb4d 100644 --- a/app/email_templates/email_templates.php +++ b/app/email_templates/email_templates.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/email_templates/root.php b/app/email_templates/root.php deleted file mode 100644 index 22735436d0..0000000000 --- a/app/email_templates/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> diff --git a/app/event_guard/event_guard_log_edit.php b/app/event_guard/event_guard_log_edit.php index 0c91f329ec..6c72d0e0d5 100644 --- a/app/event_guard/event_guard_log_edit.php +++ b/app/event_guard/event_guard_log_edit.php @@ -20,8 +20,11 @@ POSSIBILITY OF SUCH DAMAGE. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/event_guard/event_guard_logs.php b/app/event_guard/event_guard_logs.php index 0ef95568dc..0020409730 100644 --- a/app/event_guard/event_guard_logs.php +++ b/app/event_guard/event_guard_logs.php @@ -23,8 +23,11 @@ POSSIBILITY OF SUCH DAMAGE. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files; require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/event_guard/resources/service/event_guard.php b/app/event_guard/resources/service/event_guard.php index 764c240656..4985ac5456 100644 --- a/app/event_guard/resources/service/event_guard.php +++ b/app/event_guard/resources/service/event_guard.php @@ -24,19 +24,16 @@ //check the permission if (defined('STDIN')) { - $document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]); - preg_match("/^(.*)\/app\/.*$/", $document_root, $matches); - $document_root = $matches[1]; - set_include_path($document_root); - $_SERVER["DOCUMENT_ROOT"] = $document_root; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/require.php"; } else { //only allow running this from command line exit; - include "root.php"; - require_once "resources/require.php"; - require_once "resources/pdo.php"; } //increase limits diff --git a/app/event_guard/root.php b/app/event_guard/root.php deleted file mode 100644 index 22735436d0..0000000000 --- a/app/event_guard/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> diff --git a/app/extension_settings/app_config.php b/app/extension_settings/app_config.php old mode 100755 new mode 100644 diff --git a/app/extension_settings/app_defaults.php b/app/extension_settings/app_defaults.php old mode 100755 new mode 100644 diff --git a/app/extension_settings/app_languages.php b/app/extension_settings/app_languages.php old mode 100755 new mode 100644 diff --git a/app/extension_settings/extension_setting_edit.php b/app/extension_settings/extension_setting_edit.php old mode 100755 new mode 100644 index 6254870e53..cd6a381679 --- a/app/extension_settings/extension_setting_edit.php +++ b/app/extension_settings/extension_setting_edit.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/extension_settings/extension_settings.php b/app/extension_settings/extension_settings.php old mode 100755 new mode 100644 index 0f800a734f..6a7386d7e0 --- a/app/extension_settings/extension_settings.php +++ b/app/extension_settings/extension_settings.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/extension_settings/resources/classes/extension_settings.php b/app/extension_settings/resources/classes/extension_settings.php old mode 100755 new mode 100644 diff --git a/app/extension_settings/root.php b/app/extension_settings/root.php deleted file mode 100755 index 6fdf32f37b..0000000000 --- a/app/extension_settings/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/extensions/extension_copy.php b/app/extensions/extension_copy.php index 0bf80eaa1b..160f800e39 100644 --- a/app/extensions/extension_copy.php +++ b/app/extensions/extension_copy.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/extensions/extension_download.php b/app/extensions/extension_download.php index a2acf8cb03..4dcac78e77 100644 --- a/app/extensions/extension_download.php +++ b/app/extensions/extension_download.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 6a0e46dcc5..9e0fe3aa2e 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/extensions/extension_imports.php b/app/extensions/extension_imports.php index 7321a4636a..0faf4463e4 100644 --- a/app/extensions/extension_imports.php +++ b/app/extensions/extension_imports.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/extensions/resources/dashboard/caller_id.php b/app/extensions/resources/dashboard/caller_id.php index e33291330a..af3e83a508 100644 --- a/app/extensions/resources/dashboard/caller_id.php +++ b/app/extensions/resources/dashboard/caller_id.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/extensions/root.php b/app/extensions/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/extensions/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/fax/fax.php b/app/fax/fax.php index f46fdc3339..2cfa018a24 100644 --- a/app/fax/fax.php +++ b/app/fax/fax.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/fax/fax_active.php b/app/fax/fax_active.php index 653612d4c1..affb7df254 100644 --- a/app/fax/fax_active.php +++ b/app/fax/fax_active.php @@ -23,16 +23,22 @@ Contributor(s): Mark J Crane */ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('fax_active_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('fax_active_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; diff --git a/app/fax/fax_active_exec.php b/app/fax/fax_active_exec.php index 71038aa7b3..652170cc18 100644 --- a/app/fax/fax_active_exec.php +++ b/app/fax/fax_active_exec.php @@ -26,16 +26,22 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('fax_active_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('fax_active_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } //authorized referrer if (stristr($_SERVER["HTTP_REFERER"], '/fax_active.php') === false) { diff --git a/app/fax/fax_active_inc.php b/app/fax/fax_active_inc.php index 62bcbf4b01..2e7846a2ac 100644 --- a/app/fax/fax_active_inc.php +++ b/app/fax/fax_active_inc.php @@ -23,21 +23,27 @@ Contributor(s): Mark J Crane */ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('fax_active_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); -if (!permission_exists('fax_active_all') && $show == 'all') { - echo "access denied"; - exit; -} +//includes files + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('fax_active_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } + + if (!permission_exists('fax_active_all') && $show == 'all') { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; diff --git a/app/fax/fax_copy.php b/app/fax/fax_copy.php index b9058df334..30391a88f1 100644 --- a/app/fax/fax_copy.php +++ b/app/fax/fax_copy.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index 3b26d84582..620fc74183 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files; require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index 2590b2a146..c6c56f566e 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -25,8 +25,11 @@ James Rose */ -//includes -include "root.php"; +//set the include path +$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); +set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/functions/object_to_array.php"; require_once "resources/functions/parse_message.php"; diff --git a/app/fax/fax_files.php b/app/fax/fax_files.php index fc675e3a0a..83149e5a56 100644 --- a/app/fax/fax_files.php +++ b/app/fax/fax_files.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/fax/fax_files_remote.php b/app/fax/fax_files_remote.php index 773b1ba1e3..40ef8f32fe 100644 --- a/app/fax/fax_files_remote.php +++ b/app/fax/fax_files_remote.php @@ -25,8 +25,11 @@ James Rose */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/functions/object_to_array.php"; diff --git a/app/fax/fax_log_view.php b/app/fax/fax_log_view.php index fc02b722d8..cffe9665f2 100644 --- a/app/fax/fax_log_view.php +++ b/app/fax/fax_log_view.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/fax/fax_logs.php b/app/fax/fax_logs.php index a38cc8db71..bfa1f9a4e8 100644 --- a/app/fax/fax_logs.php +++ b/app/fax/fax_logs.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/fax/fax_outbox.php b/app/fax/fax_outbox.php index d20a296c52..089b19925a 100644 --- a/app/fax/fax_outbox.php +++ b/app/fax/fax_outbox.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 2591f8aa35..ce53a031b2 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -37,8 +37,11 @@ //send email through browser if (!$included) { - //includes - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/fax/root.php b/app/fax/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/fax/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/fax_queue/fax_queue.php b/app/fax_queue/fax_queue.php index 0ac1091b5a..21351e0e74 100644 --- a/app/fax_queue/fax_queue.php +++ b/app/fax_queue/fax_queue.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/fax_queue/fax_queue_delete.php b/app/fax_queue/fax_queue_delete.php index 6978f96722..af66f42c11 100644 --- a/app/fax_queue/fax_queue_delete.php +++ b/app/fax_queue/fax_queue_delete.php @@ -1,7 +1,10 @@ diff --git a/app/fifo/fifo_add.php b/app/fifo/fifo_add.php index b886de570d..8e296af9b5 100644 --- a/app/fifo/fifo_add.php +++ b/app/fifo/fifo_add.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/fifo/root.php b/app/fifo/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/fifo/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/fifo_list/fifo_exec.php b/app/fifo_list/fifo_exec.php index f590f2e0e3..ed1bcf5db1 100644 --- a/app/fifo_list/fifo_exec.php +++ b/app/fifo_list/fifo_exec.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/fifo_list/fifo_interactive.php b/app/fifo_list/fifo_interactive.php index 1e3e17aa25..b455614fc9 100644 --- a/app/fifo_list/fifo_interactive.php +++ b/app/fifo_list/fifo_interactive.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/fifo_list/fifo_interactive_inc.php b/app/fifo_list/fifo_interactive_inc.php index 0527ffda28..d270d98b41 100644 --- a/app/fifo_list/fifo_interactive_inc.php +++ b/app/fifo_list/fifo_interactive_inc.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes filesp"; require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/fifo_list/fifo_list.php b/app/fifo_list/fifo_list.php index 587428b7cc..578851d0ee 100644 --- a/app/fifo_list/fifo_list.php +++ b/app/fifo_list/fifo_list.php @@ -23,16 +23,22 @@ Contributor(s): Mark J Crane */ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('active_queue_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('active_queue_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; diff --git a/app/fifo_list/fifo_list_inc.php b/app/fifo_list/fifo_list_inc.php index fb80272074..9cde6a9fab 100644 --- a/app/fifo_list/fifo_list_inc.php +++ b/app/fifo_list/fifo_list_inc.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/fifo_list/root.php b/app/fifo_list/root.php deleted file mode 100644 index b6d02ea421..0000000000 --- a/app/fifo_list/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/follow_me/root.php b/app/follow_me/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/follow_me/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/gateways/gateway_copy.php b/app/gateways/gateway_copy.php index 81072b678f..feefb68684 100644 --- a/app/gateways/gateway_copy.php +++ b/app/gateways/gateway_copy.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/gateways/gateway_edit.php b/app/gateways/gateway_edit.php index fbc3c93341..922610db0a 100644 --- a/app/gateways/gateway_edit.php +++ b/app/gateways/gateway_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index a772a72fbf..28706116ad 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/gateways/root.php b/app/gateways/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/gateways/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/gswave/index.php b/app/gswave/index.php index 45671754d7..81e4ae4ac0 100644 --- a/app/gswave/index.php +++ b/app/gswave/index.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/gswave/root.php b/app/gswave/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/gswave/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/ivr_menus/ivr_menu_copy.php b/app/ivr_menus/ivr_menu_copy.php index 22dc134b87..a36b072324 100644 --- a/app/ivr_menus/ivr_menu_copy.php +++ b/app/ivr_menus/ivr_menu_copy.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index 9ab29f570f..67cc3bf7f5 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/classes/logging.php"; diff --git a/app/ivr_menus/ivr_menus.php b/app/ivr_menus/ivr_menus.php index 6900beed81..efc3a6d6ab 100644 --- a/app/ivr_menus/ivr_menus.php +++ b/app/ivr_menus/ivr_menus.php @@ -24,8 +24,11 @@ Mark J. Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/ivr_menus/root.php b/app/ivr_menus/root.php deleted file mode 100644 index b6d02ea421..0000000000 --- a/app/ivr_menus/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/log_viewer/log_viewer.php b/app/log_viewer/log_viewer.php index ceba040207..0dcb1f324b 100644 --- a/app/log_viewer/log_viewer.php +++ b/app/log_viewer/log_viewer.php @@ -25,8 +25,11 @@ James Rose */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/log_viewer/root.php b/app/log_viewer/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/log_viewer/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/modules/module_edit.php b/app/modules/module_edit.php index f678568fa9..238bb49633 100644 --- a/app/modules/module_edit.php +++ b/app/modules/module_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/modules/modules.php b/app/modules/modules.php index 5d9bf0de2a..94b97bbea0 100644 --- a/app/modules/modules.php +++ b/app/modules/modules.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/modules/root.php b/app/modules/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/modules/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/music_on_hold/music_on_hold.php b/app/music_on_hold/music_on_hold.php index f0228417c3..cd8a809d2a 100644 --- a/app/music_on_hold/music_on_hold.php +++ b/app/music_on_hold/music_on_hold.php @@ -25,8 +25,11 @@ James Rose */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/music_on_hold/music_on_hold_edit.php b/app/music_on_hold/music_on_hold_edit.php index c32a7c3bdc..18bc816772 100644 --- a/app/music_on_hold/music_on_hold_edit.php +++ b/app/music_on_hold/music_on_hold_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/music_on_hold/resources/classes/switch_music_on_hold.php b/app/music_on_hold/resources/classes/switch_music_on_hold.php index 3d38ca4b75..12cd921e03 100644 --- a/app/music_on_hold/resources/classes/switch_music_on_hold.php +++ b/app/music_on_hold/resources/classes/switch_music_on_hold.php @@ -25,7 +25,6 @@ James Rose Matthew Vale */ -include "root.php"; //define the switch_music_on_hold class if (!class_exists('switch_music_on_hold')) { diff --git a/app/music_on_hold/root.php b/app/music_on_hold/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/music_on_hold/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/number_translations/cmd.php b/app/number_translations/cmd.php index 3f730e4195..a73003adc3 100644 --- a/app/number_translations/cmd.php +++ b/app/number_translations/cmd.php @@ -24,8 +24,11 @@ Matthew Vale */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/number_translations/number_translation_edit.php b/app/number_translations/number_translation_edit.php index c525753f5c..9825e7b433 100644 --- a/app/number_translations/number_translation_edit.php +++ b/app/number_translations/number_translation_edit.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/number_translations/number_translations.php b/app/number_translations/number_translations.php index 97bb4c17c4..291b40cc9a 100644 --- a/app/number_translations/number_translations.php +++ b/app/number_translations/number_translations.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/number_translations/root.php b/app/number_translations/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/number_translations/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/phrases/phrase_edit.php b/app/phrases/phrase_edit.php index 72dcb1394f..5734855177 100644 --- a/app/phrases/phrase_edit.php +++ b/app/phrases/phrase_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/phrases/phrases.php b/app/phrases/phrases.php index 389e628aa9..561b3084f5 100644 --- a/app/phrases/phrases.php +++ b/app/phrases/phrases.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/phrases/root.php b/app/phrases/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/phrases/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/pin_numbers/pin_download.php b/app/pin_numbers/pin_download.php index 085798a8f1..f8b5461e02 100644 --- a/app/pin_numbers/pin_download.php +++ b/app/pin_numbers/pin_download.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/pin_numbers/pin_number_edit.php b/app/pin_numbers/pin_number_edit.php index fad7687178..c6f1635937 100644 --- a/app/pin_numbers/pin_number_edit.php +++ b/app/pin_numbers/pin_number_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/pin_numbers/pin_numbers.php b/app/pin_numbers/pin_numbers.php index e31660db51..69fa0b57f7 100644 --- a/app/pin_numbers/pin_numbers.php +++ b/app/pin_numbers/pin_numbers.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/pin_numbers/root.php b/app/pin_numbers/root.php deleted file mode 100644 index 0045eb7752..0000000000 --- a/app/pin_numbers/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2016 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/provision/index.php b/app/provision/index.php index 2e82fe48b4..0cc3a59129 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -24,8 +24,11 @@ Luis Daniel Lucio Quiroz */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/functions/device_by.php"; diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 8d2c970c85..f4d690fda1 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -24,7 +24,6 @@ Mark J Crane Luis Daniel Lucio Quiroz */ -include "root.php"; //define the provision class class provision { diff --git a/app/provision/root.php b/app/provision/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/provision/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/recordings/recording_edit.php b/app/recordings/recording_edit.php index 21c9c3a1f5..ab26002d3d 100644 --- a/app/recordings/recording_edit.php +++ b/app/recordings/recording_edit.php @@ -25,8 +25,11 @@ James Rose */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/recordings/recording_play.php b/app/recordings/recording_play.php index 17a4ee24d5..71c8a29174 100644 --- a/app/recordings/recording_play.php +++ b/app/recordings/recording_play.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php index e6da6cd97a..18d1155f17 100644 --- a/app/recordings/recordings.php +++ b/app/recordings/recordings.php @@ -28,8 +28,11 @@ //set the max php execution time ini_set('max_execution_time', 7200); -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/recordings/root.php b/app/recordings/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/recordings/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/registrations/registration_reload.php b/app/registrations/registration_reload.php index 33943d8997..77783bb0b0 100644 --- a/app/registrations/registration_reload.php +++ b/app/registrations/registration_reload.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/registrations/registrations.php b/app/registrations/registrations.php index 34cc7def70..10d4cf7b19 100644 --- a/app/registrations/registrations.php +++ b/app/registrations/registrations.php @@ -25,8 +25,11 @@ James Rose */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes fileshp"; require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/registrations/root.php b/app/registrations/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/registrations/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/ring_groups/resources/dashboard/ring_group_forward.php b/app/ring_groups/resources/dashboard/ring_group_forward.php index d222006c3f..d26e6450c6 100644 --- a/app/ring_groups/resources/dashboard/ring_group_forward.php +++ b/app/ring_groups/resources/dashboard/ring_group_forward.php @@ -25,8 +25,11 @@ James Rose */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/ring_groups/resources/dashboard/root.php b/app/ring_groups/resources/dashboard/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/ring_groups/resources/dashboard/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/ring_groups/ring_group_edit.php b/app/ring_groups/ring_group_edit.php index 6f3ed74a24..7d94e14c88 100644 --- a/app/ring_groups/ring_group_edit.php +++ b/app/ring_groups/ring_group_edit.php @@ -26,8 +26,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/classes/ringbacks.php"; diff --git a/app/ring_groups/ring_groups.php b/app/ring_groups/ring_groups.php index e3d6a31308..0932924f24 100644 --- a/app/ring_groups/ring_groups.php +++ b/app/ring_groups/ring_groups.php @@ -25,8 +25,11 @@ James Rose */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/ring_groups/root.php b/app/ring_groups/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/ring_groups/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/settings/root.php b/app/settings/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/settings/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/settings/setting_edit.php b/app/settings/setting_edit.php index 43b06650c5..7f5174f8f6 100644 --- a/app/settings/setting_edit.php +++ b/app/settings/setting_edit.php @@ -25,8 +25,11 @@ James Rose */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/sip_profiles/root.php b/app/sip_profiles/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/sip_profiles/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/sip_profiles/sip_profile_copy.php b/app/sip_profiles/sip_profile_copy.php index f61b62062e..fc2b87cafc 100644 --- a/app/sip_profiles/sip_profile_copy.php +++ b/app/sip_profiles/sip_profile_copy.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files"; require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/sip_profiles/sip_profile_edit.php b/app/sip_profiles/sip_profile_edit.php index ac872bf445..37c1a59a85 100644 --- a/app/sip_profiles/sip_profile_edit.php +++ b/app/sip_profiles/sip_profile_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/sip_profiles/sip_profiles.php b/app/sip_profiles/sip_profiles.php index 053f7a5fa4..a49ebd2dfe 100644 --- a/app/sip_profiles/sip_profiles.php +++ b/app/sip_profiles/sip_profiles.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/sip_status/cmd.php b/app/sip_status/cmd.php index 4f47eb798b..fbcaf9274b 100644 --- a/app/sip_status/cmd.php +++ b/app/sip_status/cmd.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/sip_status/root.php b/app/sip_status/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/sip_status/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/sip_status/sip_status.php b/app/sip_status/sip_status.php index d5de7bad66..eef540e6ea 100644 --- a/app/sip_status/sip_status.php +++ b/app/sip_status/sip_status.php @@ -24,8 +24,12 @@ Mark J Crane James Rose */ -//includes - include "root.php"; + +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/sofia_global_settings/root.php b/app/sofia_global_settings/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/sofia_global_settings/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/sofia_global_settings/sofia_global_setting_edit.php b/app/sofia_global_settings/sofia_global_setting_edit.php index 089625fb97..3e51548e4f 100644 --- a/app/sofia_global_settings/sofia_global_setting_edit.php +++ b/app/sofia_global_settings/sofia_global_setting_edit.php @@ -1,7 +1,10 @@ - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> diff --git a/app/streams/stream_edit.php b/app/streams/stream_edit.php index f544e76792..c6ff9682fc 100644 --- a/app/streams/stream_edit.php +++ b/app/streams/stream_edit.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/streams/streams.php b/app/streams/streams.php index 7125d1acac..22c8423e63 100644 --- a/app/streams/streams.php +++ b/app/streams/streams.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/switch/resources/dashboard/switch_status.php b/app/switch/resources/dashboard/switch_status.php index 956128d70b..69beb287fb 100644 --- a/app/switch/resources/dashboard/switch_status.php +++ b/app/switch/resources/dashboard/switch_status.php @@ -1,7 +1,10 @@ - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/system/system.php b/app/system/system.php index 2888f554b2..8e00be2eda 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -25,8 +25,11 @@ James Rose */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/time_conditions/root.php b/app/time_conditions/root.php deleted file mode 100644 index 89cc1aa8ab..0000000000 --- a/app/time_conditions/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 7aa19f0536..7e15d34267 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/time_conditions/time_conditions.php b/app/time_conditions/time_conditions.php index f894307d03..3fa283508d 100644 --- a/app/time_conditions/time_conditions.php +++ b/app/time_conditions/time_conditions.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/vars/root.php b/app/vars/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/vars/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/vars/var_edit.php b/app/vars/var_edit.php index 0800cd2797..1deb5968d8 100644 --- a/app/vars/var_edit.php +++ b/app/vars/var_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/vars/vars.php b/app/vars/vars.php index fb50a07bf5..43c87b1bf3 100644 --- a/app/vars/vars.php +++ b/app/vars/vars.php @@ -24,13 +24,15 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; - //check permissions if (permission_exists('var_view')) { //access granted diff --git a/app/voicemail_greetings/root.php b/app/voicemail_greetings/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/voicemail_greetings/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/voicemail_greetings/voicemail_greeting_edit.php b/app/voicemail_greetings/voicemail_greeting_edit.php index 8b8835a503..a48c1a7455 100644 --- a/app/voicemail_greetings/voicemail_greeting_edit.php +++ b/app/voicemail_greetings/voicemail_greeting_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/voicemail_greetings/voicemail_greetings.php b/app/voicemail_greetings/voicemail_greetings.php index 67e9745af3..451e7f5420 100644 --- a/app/voicemail_greetings/voicemail_greetings.php +++ b/app/voicemail_greetings/voicemail_greetings.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/voicemails/resources/dashboard/voicemails.php b/app/voicemails/resources/dashboard/voicemails.php index aa0f7b80d3..b9008e7259 100644 --- a/app/voicemails/resources/dashboard/voicemails.php +++ b/app/voicemails/resources/dashboard/voicemails.php @@ -1,7 +1,10 @@ - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php index c6401c92e1..e8fda7dea7 100644 --- a/app/voicemails/voicemail_edit.php +++ b/app/voicemails/voicemail_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/voicemails/voicemail_imports.php b/app/voicemails/voicemail_imports.php index 9b03d21d84..f7320932f0 100644 --- a/app/voicemails/voicemail_imports.php +++ b/app/voicemails/voicemail_imports.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/voicemails/voicemail_message_toggle.php b/app/voicemails/voicemail_message_toggle.php index b823832d00..972448afa6 100644 --- a/app/voicemails/voicemail_message_toggle.php +++ b/app/voicemails/voicemail_message_toggle.php @@ -23,16 +23,23 @@ Contributor(s): Mark J Crane */ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('voicemail_message_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} + +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('voicemail_message_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; diff --git a/app/voicemails/voicemail_messages.php b/app/voicemails/voicemail_messages.php index 457514f7a6..f2a9e7b972 100644 --- a/app/voicemails/voicemail_messages.php +++ b/app/voicemails/voicemail_messages.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/paging.php"; diff --git a/app/voicemails/voicemails.php b/app/voicemails/voicemails.php index a0c591de28..8844705009 100644 --- a/app/voicemails/voicemails.php +++ b/app/voicemails/voicemails.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/xml_cdr/download.php b/app/xml_cdr/download.php index f0aaf414b8..ad138d8334 100644 --- a/app/xml_cdr/download.php +++ b/app/xml_cdr/download.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //check permisions diff --git a/app/xml_cdr/report.php b/app/xml_cdr/report.php index 44e689d014..1753688ff3 100644 --- a/app/xml_cdr/report.php +++ b/app/xml_cdr/report.php @@ -26,7 +26,11 @@ Mark J Crane */ //includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/xml_cdr/resources/dashboard/missed_calls.php b/app/xml_cdr/resources/dashboard/missed_calls.php index 5318778c24..b37dfd8137 100644 --- a/app/xml_cdr/resources/dashboard/missed_calls.php +++ b/app/xml_cdr/resources/dashboard/missed_calls.php @@ -1,7 +1,10 @@ - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/xml_cdr/root.php b/app/xml_cdr/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/xml_cdr/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index e74cf43e5a..ad3932c56a 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/xml_cdr/xml_cdr_archive.php b/app/xml_cdr/xml_cdr_archive.php index 38242862e1..dc408c1a22 100644 --- a/app/xml_cdr/xml_cdr_archive.php +++ b/app/xml_cdr/xml_cdr_archive.php @@ -28,8 +28,11 @@ //set archive flag $archive_request = true; -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "xml_cdr.php"; ?> \ No newline at end of file diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php index 7bf336e511..b21048ec0b 100644 --- a/app/xml_cdr/xml_cdr_details.php +++ b/app/xml_cdr/xml_cdr_details.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/xml_cdr/xml_cdr_export.php b/app/xml_cdr/xml_cdr_export.php index 96a12d26f7..eb832b05e7 100644 --- a/app/xml_cdr/xml_cdr_export.php +++ b/app/xml_cdr/xml_cdr_export.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/xml_cdr/xml_cdr_extension_summary.php b/app/xml_cdr/xml_cdr_extension_summary.php index 86fc604574..c01a60b8f1 100644 --- a/app/xml_cdr/xml_cdr_extension_summary.php +++ b/app/xml_cdr/xml_cdr_extension_summary.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/xml_cdr/xml_cdr_import.php b/app/xml_cdr/xml_cdr_import.php index c24e7a8a10..5076ea08dc 100644 --- a/app/xml_cdr/xml_cdr_import.php +++ b/app/xml_cdr/xml_cdr_import.php @@ -34,8 +34,11 @@ require_once "resources/require.php"; } else { - //required includes - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/require.php"; require_once "resources/pdo.php"; } diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php index b86e58c433..58491b1539 100644 --- a/app/xml_cdr/xml_cdr_inc.php +++ b/app/xml_cdr/xml_cdr_inc.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/app/xml_cdr/xml_cdr_search.php b/app/xml_cdr/xml_cdr_search.php index d929799ca4..876cc8962a 100644 --- a/app/xml_cdr/xml_cdr_search.php +++ b/app/xml_cdr/xml_cdr_search.php @@ -24,8 +24,11 @@ Mark J Crane */ -//include - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/xml_cdr/xml_cdr_statistics.php b/app/xml_cdr/xml_cdr_statistics.php index e50e8c03fa..8eaa642d3f 100644 --- a/app/xml_cdr/xml_cdr_statistics.php +++ b/app/xml_cdr/xml_cdr_statistics.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "xml_cdr_statistics_inc.php"; diff --git a/app/xml_cdr/xml_cdr_statistics_csv.php b/app/xml_cdr/xml_cdr_statistics_csv.php index c9481a7025..8a14f29cac 100644 --- a/app/xml_cdr/xml_cdr_statistics_csv.php +++ b/app/xml_cdr/xml_cdr_statistics_csv.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/app/xml_cdr/xml_cdr_statistics_inc.php b/app/xml_cdr/xml_cdr_statistics_inc.php index 32141c6d34..a5dadf4326 100644 --- a/app/xml_cdr/xml_cdr_statistics_inc.php +++ b/app/xml_cdr/xml_cdr_statistics_inc.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/authentication/root.php b/core/authentication/root.php deleted file mode 100644 index 22735436d0..0000000000 --- a/core/authentication/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> diff --git a/core/dashboard/dashboard.php b/core/dashboard/dashboard.php index 141fc1fccd..276c9d2362 100644 --- a/core/dashboard/dashboard.php +++ b/core/dashboard/dashboard.php @@ -21,8 +21,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/dashboard/dashboard_edit.php b/core/dashboard/dashboard_edit.php index 86e8f41c5a..f7cdc9f54d 100644 --- a/core/dashboard/dashboard_edit.php +++ b/core/dashboard/dashboard_edit.php @@ -22,8 +22,11 @@ the Initial Developer. All Rights Reserved. */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/dashboard/index.php b/core/dashboard/index.php index 02d4fafe01..a5ad3e8698 100644 --- a/core/dashboard/index.php +++ b/core/dashboard/index.php @@ -24,8 +24,9 @@ Mark J Crane */ -//include the root directory - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); //if config.php file does not exist then redirect to the install page if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) { diff --git a/core/dashboard/root.php b/core/dashboard/root.php deleted file mode 100644 index 1ff8f7927e..0000000000 --- a/core/dashboard/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2018 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> diff --git a/core/databases/database_edit.php b/core/databases/database_edit.php index 1d99e944d7..b337f7bc0f 100644 --- a/core/databases/database_edit.php +++ b/core/databases/database_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/databases/databases.php b/core/databases/databases.php index 30d1828815..300c0163ac 100644 --- a/core/databases/databases.php +++ b/core/databases/databases.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/core/databases/root.php b/core/databases/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/core/databases/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/default_settings/default_setting_edit.php b/core/default_settings/default_setting_edit.php index a598383536..3f43a2d694 100644 --- a/core/default_settings/default_setting_edit.php +++ b/core/default_settings/default_setting_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/default_settings/default_setting_toggle.php b/core/default_settings/default_setting_toggle.php index 037a12b535..5c051bfadb 100644 --- a/core/default_settings/default_setting_toggle.php +++ b/core/default_settings/default_setting_toggle.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/default_settings/default_settings.php b/core/default_settings/default_settings.php index 025a459385..e1869f5473 100644 --- a/core/default_settings/default_settings.php +++ b/core/default_settings/default_settings.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/default_settings/default_settings_reload.php b/core/default_settings/default_settings_reload.php index e508ed8e1d..772ba88075 100644 --- a/core/default_settings/default_settings_reload.php +++ b/core/default_settings/default_settings_reload.php @@ -24,10 +24,13 @@ Mark J Crane */ -//includes -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require_once "resources/require.php"; + require_once "resources/check_auth.php"; //check permissions if (permission_exists('default_setting_view')) { diff --git a/core/default_settings/root.php b/core/default_settings/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/core/default_settings/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/domain_settings/domain_setting_edit.php b/core/domain_settings/domain_setting_edit.php index e45973eeea..e37533ef35 100644 --- a/core/domain_settings/domain_setting_edit.php +++ b/core/domain_settings/domain_setting_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/domain_settings/domain_settings.php b/core/domain_settings/domain_settings.php index 1f805a8658..f0c226fc8b 100644 --- a/core/domain_settings/domain_settings.php +++ b/core/domain_settings/domain_settings.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/domain_settings/root.php b/core/domain_settings/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/core/domain_settings/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/domains/domain_edit.php b/core/domains/domain_edit.php index 55c4032af1..2f853b36bd 100644 --- a/core/domains/domain_edit.php +++ b/core/domains/domain_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/domains/domains.php b/core/domains/domains.php index 0574abfeb0..23d74d2459 100644 --- a/core/domains/domains.php +++ b/core/domains/domains.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/core/domains/root.php b/core/domains/root.php deleted file mode 100644 index 22735436d0..0000000000 --- a/core/domains/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> diff --git a/core/events/resources/classes/events.php b/core/events/resources/classes/events.php index 5036626ce8..9d70425b5b 100644 --- a/core/events/resources/classes/events.php +++ b/core/events/resources/classes/events.php @@ -29,7 +29,11 @@ class events { */ public function __construct() { //create the database connection - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/classes/database.php"; $database = new database; $database->connect(); diff --git a/core/groups/group_edit.php b/core/groups/group_edit.php index a47fb1e3cd..2e1b4bb5e2 100644 --- a/core/groups/group_edit.php +++ b/core/groups/group_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/groups/group_members.php b/core/groups/group_members.php index bf627b2c2c..e7ac7b5a54 100644 --- a/core/groups/group_members.php +++ b/core/groups/group_members.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/groups/group_permissions.php b/core/groups/group_permissions.php index 23378c8860..25c144cb8c 100644 --- a/core/groups/group_permissions.php +++ b/core/groups/group_permissions.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/groups/groupmemberadd.php b/core/groups/groupmemberadd.php index bb52fc56cf..fe1ff68651 100644 --- a/core/groups/groupmemberadd.php +++ b/core/groups/groupmemberadd.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/groups/groupmemberdelete.php b/core/groups/groupmemberdelete.php index 9e1a9ca60b..6df7512804 100644 --- a/core/groups/groupmemberdelete.php +++ b/core/groups/groupmemberdelete.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/groups/groups.php b/core/groups/groups.php index d84530a5e9..62d54359e9 100644 --- a/core/groups/groups.php +++ b/core/groups/groups.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/core/groups/permissions_copy.php b/core/groups/permissions_copy.php index dfad081cc4..2a35833409 100644 --- a/core/groups/permissions_copy.php +++ b/core/groups/permissions_copy.php @@ -24,8 +24,11 @@ Sérgio Reis */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/groups/permissions_default.php b/core/groups/permissions_default.php index 1928ed95aa..64f97c50a2 100644 --- a/core/groups/permissions_default.php +++ b/core/groups/permissions_default.php @@ -26,7 +26,11 @@ //check permisions if (!$included) { - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('group_edit')) { diff --git a/core/groups/root.php b/core/groups/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/core/groups/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/install/install.php b/core/install/install.php index 239a78a1c3..608cf9ed1e 100644 --- a/core/install/install.php +++ b/core/install/install.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/functions.php"; //include required classes diff --git a/core/install/root.php b/core/install/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/core/install/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/menu/menu.php b/core/menu/menu.php index 6db98a91be..ac1a82eb33 100644 --- a/core/menu/menu.php +++ b/core/menu/menu.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/menu/menu_edit.php b/core/menu/menu_edit.php index c4911b3618..e629e347dc 100644 --- a/core/menu/menu_edit.php +++ b/core/menu/menu_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/menu/menu_item_edit.php b/core/menu/menu_item_edit.php index f1db4e07fc..c6e94b23d1 100644 --- a/core/menu/menu_item_edit.php +++ b/core/menu/menu_item_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files; require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/menu/menu_item_list.php b/core/menu/menu_item_list.php index a5ea2190e0..f5b52e842e 100644 --- a/core/menu/menu_item_list.php +++ b/core/menu/menu_item_list.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/menu/menu_item_move_down.php b/core/menu/menu_item_move_down.php index 828a5e9b1b..6002a1c05b 100644 --- a/core/menu/menu_item_move_down.php +++ b/core/menu/menu_item_move_down.php @@ -23,16 +23,23 @@ Contributor(s): Mark J Crane */ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('menu_edit')) { - //access granted -} -else { - echo "access denied"; - return; -} + +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('menu_edit')) { + //access granted + } + else { + echo "access denied"; + return; + } //add multi-lingual support $language = new text; diff --git a/core/menu/menu_item_move_up.php b/core/menu/menu_item_move_up.php index 600b3e7bf9..0a077b4593 100644 --- a/core/menu/menu_item_move_up.php +++ b/core/menu/menu_item_move_up.php @@ -23,16 +23,22 @@ Contributor(s): Mark J Crane */ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('menu_edit')) { - //access granted -} -else { - echo "access denied"; - return; -} +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('menu_edit')) { + //access granted + } + else { + echo "access denied"; + return; + } //add multi-lingual support $language = new text; diff --git a/core/menu/menu_reload.php b/core/menu/menu_reload.php index 62efbbd0ca..b90bd4ecc9 100644 --- a/core/menu/menu_reload.php +++ b/core/menu/menu_reload.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/menu/menu_restore_default.php b/core/menu/menu_restore_default.php index 5b3876cc19..835c03d401 100644 --- a/core/menu/menu_restore_default.php +++ b/core/menu/menu_restore_default.php @@ -26,7 +26,11 @@ //check permissions if (!$included) { - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('menu_restore')) { diff --git a/core/menu/root.php b/core/menu/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/core/menu/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/notifications/notification_edit.php b/core/notifications/notification_edit.php index d5ec80bf80..0958a8ce8b 100644 --- a/core/notifications/notification_edit.php +++ b/core/notifications/notification_edit.php @@ -24,16 +24,22 @@ Contributor(s): Mark J Crane */ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (if_group('superadmin')) { - //access granted -} -else { - echo "access denied"; - exit; -} +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (if_group('superadmin')) { + //access granted + } + else { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; diff --git a/core/notifications/root.php b/core/notifications/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/core/notifications/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/upgrade/index.php b/core/upgrade/index.php index 0834f336c9..57eb01b2ad 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -27,8 +27,11 @@ //set a timeout set_time_limit(15*60); //15 minutes -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/upgrade/root.php b/core/upgrade/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/core/upgrade/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/upgrade/upgrade_domains.php b/core/upgrade/upgrade_domains.php index 47a176313c..3a0bd78b12 100644 --- a/core/upgrade/upgrade_domains.php +++ b/core/upgrade/upgrade_domains.php @@ -26,16 +26,21 @@ //check the permission if(defined('STDIN')) { - $document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]); - preg_match("/^(.*)\/core\/.*$/", $document_root, $matches); - $document_root = $matches[1]; - set_include_path($document_root); + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/require.php"; $_SERVER["DOCUMENT_ROOT"] = $document_root; $display_type = 'text'; //html, text } else if (!$included) { - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('upgrade_apps') || if_group("superadmin")) { diff --git a/core/upgrade/upgrade_schema.php b/core/upgrade/upgrade_schema.php index 04a305a122..00c82e3b99 100644 --- a/core/upgrade/upgrade_schema.php +++ b/core/upgrade/upgrade_schema.php @@ -29,11 +29,11 @@ //check the permission if(defined('STDIN')) { - $document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]); - preg_match("/^(.*)\/core\/.*$/", $document_root, $matches); - $document_root = $matches[1]; - set_include_path($document_root); - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files include "resources/functions.php"; require_once "resources/classes/text.php"; $_SERVER["DOCUMENT_ROOT"] = $document_root; @@ -44,7 +44,11 @@ $text = $language->get(); } else if (!$included) { - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('upgrade_schema') || if_group("superadmin")) { diff --git a/core/user_logs/root.php b/core/user_logs/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/core/user_logs/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/user_logs/user_log_edit.php b/core/user_logs/user_log_edit.php index 10c368ab30..e46844b1d3 100644 --- a/core/user_logs/user_log_edit.php +++ b/core/user_logs/user_log_edit.php @@ -1,7 +1,10 @@ - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/user_settings/user_dashboard.php b/core/user_settings/user_dashboard.php index 328094ab30..7dd57d1136 100644 --- a/core/user_settings/user_dashboard.php +++ b/core/user_settings/user_dashboard.php @@ -24,8 +24,12 @@ Mark J Crane */ -//include the root directory - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require_once "resources/require.php"; //if config.php file does not exist then redirect to the install page if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) { diff --git a/core/user_settings/user_setting_edit.php b/core/user_settings/user_setting_edit.php index aa325ab20f..c195caf7fa 100644 --- a/core/user_settings/user_setting_edit.php +++ b/core/user_settings/user_setting_edit.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/user_settings/user_setting_set.php b/core/user_settings/user_setting_set.php index 7fa78936cf..aad7c0118e 100644 --- a/core/user_settings/user_setting_set.php +++ b/core/user_settings/user_setting_set.php @@ -24,8 +24,11 @@ Contributor(s): Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/user_settings/user_settings.php b/core/user_settings/user_settings.php index 66a83368f5..b92c9fedff 100644 --- a/core/user_settings/user_settings.php +++ b/core/user_settings/user_settings.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/core/users/root.php b/core/users/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/core/users/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/core/users/user_edit.php b/core/users/user_edit.php index 5bedf46777..c5e9adcc69 100644 --- a/core/users/user_edit.php +++ b/core/users/user_edit.php @@ -25,8 +25,11 @@ Luis Daniel Lucio Quiroz */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/users/user_imports.php b/core/users/user_imports.php index 3cebb54c1d..9569ec480e 100644 --- a/core/users/user_imports.php +++ b/core/users/user_imports.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; diff --git a/core/users/users.php b/core/users/users.php index ed774457ec..27ddc69c01 100644 --- a/core/users/users.php +++ b/core/users/users.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; diff --git a/index.php b/index.php index cbd6c45c14..f914cded24 100644 --- a/index.php +++ b/index.php @@ -24,8 +24,11 @@ Mark J. Crane */ -//include root - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files //start the session ini_set("session.cookie_httponly", True); diff --git a/login.php b/login.php index 47415b4214..9e068277ae 100644 --- a/login.php +++ b/login.php @@ -23,8 +23,11 @@ Contributor(s): Mark J. Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //start session diff --git a/logout.php b/logout.php index b51d6fc4f4..3312d5001a 100644 --- a/logout.php +++ b/logout.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //destroy session diff --git a/project_root.php b/project_root.php deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/captcha/root.php b/resources/captcha/root.php deleted file mode 100644 index cc8ae3bcff..0000000000 --- a/resources/captcha/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/resources/classes/captcha.php b/resources/classes/captcha.php index 55b5f33ad6..8caab89531 100644 --- a/resources/classes/captcha.php +++ b/resources/classes/captcha.php @@ -59,9 +59,11 @@ class captcha { */ public function image_captcha() { - //includes - include "root.php"; - require_once "config.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files require_once "resources/functions.php"; error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings diff --git a/resources/classes/config.php b/resources/classes/config.php index f2ada614ff..64a156042b 100644 --- a/resources/classes/config.php +++ b/resources/classes/config.php @@ -73,8 +73,12 @@ class config { * @var string $config_path - full path to the config.php file */ public function find() { - //get the PROJECT PATH - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files + require_once "resources/require.php"; // find the file if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) { $this->config_path = $_SERVER["PROJECT_ROOT"]."/resources/config.php"; diff --git a/resources/classes/database.php b/resources/classes/database.php index 7cf17a091d..520174d9ea 100644 --- a/resources/classes/database.php +++ b/resources/classes/database.php @@ -405,8 +405,16 @@ public function connect() { if (strlen($this->db_name) == 0) { + + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files + require_once "resources/require.php"; + + //include config.php - include "root.php"; if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) { include $_SERVER["PROJECT_ROOT"]."/resources/config.php"; } elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) { diff --git a/resources/classes/directory.php b/resources/classes/directory.php index 4f2e998e79..af3c3fd7e2 100644 --- a/resources/classes/directory.php +++ b/resources/classes/directory.php @@ -23,7 +23,6 @@ Contributor(s): Mark J Crane */ -include "root.php"; //define the directory class class switch_directory { diff --git a/resources/classes/domains.php b/resources/classes/domains.php index 5bc749ca42..e41d7c84a1 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -621,8 +621,9 @@ if (!class_exists('domains')) { $db_path = $config->db_path; $db_port = $config->db_port; - //get the PROJECT PATH - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); //check for default settings $this->settings(); @@ -741,12 +742,6 @@ if (!class_exists('domains')) { $domains_processed++; } - //update config.lua - if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/scripts/resources/classes/scripts.php')) { - $obj = new scripts; - $obj->write_config(); - } - //clear the session variables unset($_SESSION['domain']); unset($_SESSION['switch']); diff --git a/resources/classes/events.php b/resources/classes/events.php index e0f22512c9..6de1899289 100644 --- a/resources/classes/events.php +++ b/resources/classes/events.php @@ -7,7 +7,14 @@ * $e->add_event_function('myfunction') it could be a static method as well * $e->execute_event(ADD, $params) event type, params is an associative array */ -include "root.php"; + +//set the include path +$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); +set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files +require_once "resources/require.php"; + define ("MODULE_LOAD", 1); // when loading a FS module with FS define ("MODULE_UNLOAD", 2); diff --git a/resources/classes/root.php b/resources/classes/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/resources/classes/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/resources/classes/schema.php b/resources/classes/schema.php index a10a6be5f1..04addb2a33 100644 --- a/resources/classes/schema.php +++ b/resources/classes/schema.php @@ -23,7 +23,6 @@ Contributor(s): Mark J Crane */ -include "root.php"; //define the schema class if (!class_exists('schema')) { @@ -487,8 +486,12 @@ if (!class_exists('schema')) { $db_path = $config->db_path; $db_port = $config->db_port; - //get the PROJECT PATH - include "root.php"; + //set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + + //includes files + require_once "resources/require.php"; //add multi-lingual support if (!isset($text)) { diff --git a/resources/classes/template.php b/resources/classes/template.php index 8864c76061..656ac1dd36 100644 --- a/resources/classes/template.php +++ b/resources/classes/template.php @@ -23,7 +23,6 @@ Contributor(s): Mark J Crane */ -include "root.php"; //define the template class if (!class_exists('template')) { diff --git a/resources/fonts/root.php b/resources/fonts/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/resources/fonts/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/resources/fonts/web_font_loader.php b/resources/fonts/web_font_loader.php index 6a5967e305..78fa9e1428 100644 --- a/resources/fonts/web_font_loader.php +++ b/resources/fonts/web_font_loader.php @@ -1,5 +1,9 @@ */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //set variables if not set diff --git a/resources/header.php b/resources/header.php index 31dfdd6822..65e0177494 100644 --- a/resources/header.php +++ b/resources/header.php @@ -24,8 +24,11 @@ Mark J Crane */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; //if reloadxml then run the command diff --git a/resources/pdo.php b/resources/pdo.php index a165a3735b..635bb287f2 100644 --- a/resources/pdo.php +++ b/resources/pdo.php @@ -25,8 +25,11 @@ Raymond Chandler */ -//includes - include "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/functions.php"; //set defaults diff --git a/resources/pdo_vm.php b/resources/pdo_vm.php index 41f799474b..84da252691 100644 --- a/resources/pdo_vm.php +++ b/resources/pdo_vm.php @@ -23,8 +23,13 @@ Contributor(s): Mark J Crane */ -include "root.php"; -require "resources/require.php"; + +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files + require "resources/require.php"; //get the contents of xml_cdr.conf.xml $conf_xml_string = file_get_contents($_SESSION['switch']['conf']['dir'].'/autoload_configs/voicemail.conf.xml'); diff --git a/resources/root.php b/resources/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/resources/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/resources/switch.php b/resources/switch.php index 70f0f86e0b..902ba72cba 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -26,8 +26,11 @@ Riccardo Granchi */ -//includes - require_once "root.php"; +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files"; require_once "resources/require.php"; //get the event socket information diff --git a/resources/uuid.php b/resources/uuid.php index 156da53ca3..b7e177abb3 100644 --- a/resources/uuid.php +++ b/resources/uuid.php @@ -1,7 +1,13 @@ diff --git a/root.php b/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index 9b8632a429..309b491c43 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -204,8 +204,11 @@ if (!function_exists('fax_split_dtmf')) { } } -//includes - if (!defined('STDIN')) { include "root.php"; } +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//includes files require_once "resources/require.php"; include "resources/classes/event_socket.php"; include "resources/phpmailer/class.phpmailer.php"; diff --git a/secure/index.php b/secure/index.php index d6d8ab6673..54eb95224f 100644 --- a/secure/index.php +++ b/secure/index.php @@ -26,7 +26,11 @@ //block directory browsing and send the user to the main index -include "root.php"; -header("Location: ".PROJECT_PATH."/index.php"); +//set the include path + $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); + set_include_path(parse_ini_file($conf[0])['document.root']); + +//set a redirect + header("Location: ".PROJECT_PATH."/index.php"); ?> \ No newline at end of file diff --git a/secure/root.php b/secure/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/secure/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file diff --git a/themes/default/css.php b/themes/default/css.php index fc05a411c6..29a4263252 100644 --- a/themes/default/css.php +++ b/themes/default/css.php @@ -1,6 +1,10 @@ - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// 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"]); - } - -?> \ No newline at end of file