From 08001488f454dbdf29f5a1f6036cacb9dfebf102 Mon Sep 17 00:00:00 2001 From: frytimo Date: Wed, 12 Mar 2025 16:55:47 -0300 Subject: [PATCH] Allow namespace in auto loader (#7307) * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove class_exists wrapper for class definitions * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove include statement of class file * remove closing tag * remove invalid method params * remove closing tag * remove closing tag * Update auto_loader to load each class file in the project Update the auto_loader class to use an include statement on each file in the project to load the class within the file. This will allow mismatched names within the file to be loaded and mapped according to the declaration instead of the filename. The class is then checked against the parsed classes from the PHP engine so that namespaces are available and mapped to the file they were declared in. An update was also made to the search algorithm used to find a file that was not already loaded by collapsing the array to have only valid matches to increase performance on a cache miss. Logging within the auto_loader has been moved to a function. Multiple files were modified to allow the include statement. When the class has the `if(class_exists())` statement, the auto_loader is called to check for the class. This caused an infinite loop scenario so all wrappers have been removed. The auto_loader will now break the loop by directly modifying the internal classes array instead of trying to restart with the 'reload_classes' method. - APCu is used to cache classes so any loading of the classes is done only once. To clear the APCu cache, restart php-fpm or call the auto_loader::clear_cache() function. - Cache file is used when APCu is not available. To clear the cache remove it from the tmp folder or call the auto_loader::clear_cache() function. - All classes must no longer have a class_exists wrapper to benefit from the performance boost. - Classes should not be directly included when the auto_loader is used. * remove include statement of class file * Update destinations.php --- .../resources/classes/access_controls.php | 7 - .../classes/basic_operator_panel.php | 4 - app/bridges/resources/classes/bridges.php | 4 - .../resources/classes/call_block.php | 6 - .../resources/classes/call_broadcast.php | 6 - .../resources/classes/call_center.php | 6 - app/call_centers/waveform.php | 3 +- .../resources/classes/call_flows.php | 4 - app/call_flows/waveform.php | 1 - app/call_forward/call_forward_edit.php | 1 - .../resources/classes/call_forward.php | 1 - .../resources/classes/do_not_disturb.php | 1 - .../resources/classes/follow_me.php | 1 - .../resources/classes/call_recordings.php | 6 - app/call_recordings/waveform.php | 1 - .../resources/classes/conference_centers.php | 5 +- app/conference_centers/waveform.php | 1 - .../resources/classes/conference_controls.php | 8 - .../resources/classes/conference_profiles.php | 8 - .../resources/classes/conferences.php | 4 - app/destinations/destination_edit.php | 1 - .../resources/classes/destinations.php | 46 ++- app/dialplans/resources/classes/dialplan.php | 4 - .../resources/classes/email_queue.php | 8 - .../resources/jobs/email_queue.php | 1 - app/email_queue/resources/jobs/email_send.php | 1 - .../resources/service/email_queue.php | 3 - .../resources/classes/event_guard.php | 8 - .../resources/classes/extension_settings.php | 8 - app/extensions/extension_copy.php | 1 - app/extensions/extension_edit.php | 2 - .../resources/classes/extension.php | 4 - app/fax/fax_emails.php | 1 - app/fax/resources/classes/fax.php | 4 - app/fax_queue/resources/classes/fax_queue.php | 8 - app/fax_queue/resources/service/fax_queue.php | 1 - app/fifo/resources/classes/fifo.php | 8 - app/gateways/resources/classes/gateways.php | 4 - app/ivr_menus/resources/classes/ivr_menu.php | 4 - app/ivr_menus/waveform.php | 1 - app/modules/resources/classes/modules.php | 5 - app/music_on_hold/music_on_hold.php | 1 - .../classes/switch_music_on_hold.php | 7 +- app/music_on_hold/waveform.php | 1 - .../resources/classes/number_translations.php | 4 - app/phrases/resources/classes/phrases.php | 4 - .../resources/classes/pin_numbers.php | 4 - .../resources/classes/switch_recordings.php | 4 - app/recordings/waveform.php | 1 - app/registrations/registrations.php | 1 - .../resources/classes/ring_groups.php | 4 - app/ring_groups/waveform.php | 1 - .../resources/classes/sip_profiles.php | 4 - .../classes/sofia_global_settings.php | 8 - app/streams/resources/classes/streams.php | 4 - app/switch/resources/classes/presence.php | 10 +- app/switch/resources/classes/ringbacks.php | 7 - app/switch/resources/classes/switch_files.php | 8 - .../resources/classes/time_conditions.php | 4 - app/vars/resources/classes/vars.php | 4 - .../resources/classes/voicemail_greetings.php | 4 - app/voicemail_greetings/waveform.php | 1 - .../resources/classes/voicemail.php | 1 - .../resources/dashboard/voicemails.php | 3 - app/voicemails/voicemail_message_toggle.php | 1 - app/voicemails/waveform.php | 1 - app/xml_cdr/resources/classes/xml_cdr.php | 4 - app/xml_cdr/waveform.php | 1 - .../resources/classes/authentication.php | 1 - .../resources/classes/plugins/email.php | 4 - .../resources/classes/plugins/ldap.php | 2 - .../resources/classes/plugins/totp.php | 2 - core/contacts/contacts_vcard.php | 1 - core/contacts/resources/classes/contacts.php | 4 - .../dashboard/resources/classes/dashboard.php | 8 - .../databases/resources/classes/databases.php | 4 - .../resources/classes/default_settings.php | 8 - .../resources/classes/domain_settings.php | 4 - core/domains/domain_edit.php | 1 - .../resources/classes/email_templates.php | 4 - core/events/resources/classes/events.php | 9 +- core/groups/permissions_default.php | 1 - core/install/resources/classes/install.php | 6 +- core/menu/menu_restore_default.php | 1 - core/software/resources/classes/software.php | 6 - core/upgrade/index.php | 1 - core/upgrade/upgrade.php | 3 - core/upgrade/upgrade_domains.php | 2 - core/upgrade/upgrade_menu.php | 3 - core/upgrade/upgrade_schema.php | 1 - .../user_logs/resources/classes/user_logs.php | 8 - .../resources/classes/user_settings.php | 4 - core/user_settings/user_setting_set.php | 1 - core/users/resources/classes/users.php | 8 - resources/classes/auto_loader.php | 263 ++++++++++++------ resources/classes/button.php | 5 - resources/classes/database.php | 4 +- resources/classes/domains.php | 7 - resources/classes/email.php | 4 +- resources/classes/groups.php | 7 - resources/classes/menu.php | 2 - resources/classes/message.php | 4 - resources/classes/modal.php | 5 - resources/classes/schema.php | 6 - resources/classes/switch_settings.php | 4 - resources/classes/template.php | 4 - resources/classes/tones.php | 8 +- resources/classes/xml.php | 4 - resources/switch.php | 2 - secure/fax_to_email.php | 5 +- 110 files changed, 209 insertions(+), 520 deletions(-) diff --git a/app/access_controls/resources/classes/access_controls.php b/app/access_controls/resources/classes/access_controls.php index 4d8efd2add..25ca525c01 100644 --- a/app/access_controls/resources/classes/access_controls.php +++ b/app/access_controls/resources/classes/access_controls.php @@ -2,11 +2,7 @@ /** * access controls class - * - * @method null download */ -if (!class_exists('access_controls')) { - class access_controls { /** @@ -264,6 +260,3 @@ if (!class_exists('access_controls')) { } } } - -} -?> diff --git a/app/basic_operator_panel/resources/classes/basic_operator_panel.php b/app/basic_operator_panel/resources/classes/basic_operator_panel.php index 234726fb46..7d1ba52ce2 100644 --- a/app/basic_operator_panel/resources/classes/basic_operator_panel.php +++ b/app/basic_operator_panel/resources/classes/basic_operator_panel.php @@ -27,7 +27,6 @@ /** * Define the operator_panel class */ -if (!class_exists('basic_operator_panel')) { class basic_operator_panel { /** @@ -245,6 +244,3 @@ if (!class_exists('basic_operator_panel')) { return $result; } } -} - -?> diff --git a/app/bridges/resources/classes/bridges.php b/app/bridges/resources/classes/bridges.php index a4fba27236..c9c1170b85 100644 --- a/app/bridges/resources/classes/bridges.php +++ b/app/bridges/resources/classes/bridges.php @@ -25,7 +25,6 @@ */ //define the bridges class -if (!class_exists('bridges')) { class bridges { /** @@ -255,6 +254,3 @@ if (!class_exists('bridges')) { } } -} - -?> \ No newline at end of file diff --git a/app/call_block/resources/classes/call_block.php b/app/call_block/resources/classes/call_block.php index 1d1fc8ef2b..1faf6501dc 100644 --- a/app/call_block/resources/classes/call_block.php +++ b/app/call_block/resources/classes/call_block.php @@ -2,10 +2,7 @@ /** * call block class - * - * @method null download */ -if (!class_exists('call_block')) { class call_block { /** @@ -459,6 +456,3 @@ if (!class_exists('call_block')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/app/call_broadcast/resources/classes/call_broadcast.php b/app/call_broadcast/resources/classes/call_broadcast.php index 4b3f45cc20..08c7011ddf 100644 --- a/app/call_broadcast/resources/classes/call_broadcast.php +++ b/app/call_broadcast/resources/classes/call_broadcast.php @@ -27,10 +27,7 @@ /** * call broadcast class - * - * @method null download */ -if (!class_exists('call_broadcast')) { class call_broadcast { /** @@ -177,6 +174,3 @@ if (!class_exists('call_broadcast')) { } } -} - -?> \ No newline at end of file diff --git a/app/call_centers/resources/classes/call_center.php b/app/call_centers/resources/classes/call_center.php index f84b6e1014..11ce9dc30e 100644 --- a/app/call_centers/resources/classes/call_center.php +++ b/app/call_centers/resources/classes/call_center.php @@ -26,11 +26,8 @@ /** * cache class provides an abstracted cache - * - * @method string dialplan - builds the dialplan for call center */ //define the call center class - if (!class_exists('call_center')) { class call_center { /** * define the variables @@ -611,7 +608,6 @@ } //method } //class - } /* $o = new call_center; @@ -625,5 +621,3 @@ $c->destination_number = ""; $c->queue_cc_exit_keys = ""; $c->dialplan(); */ - -?> diff --git a/app/call_centers/waveform.php b/app/call_centers/waveform.php index 0c93872262..04f03fa01e 100644 --- a/app/call_centers/waveform.php +++ b/app/call_centers/waveform.php @@ -27,8 +27,7 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; - + use maximal\audio\Waveform; //check permisions diff --git a/app/call_flows/resources/classes/call_flows.php b/app/call_flows/resources/classes/call_flows.php index c9a54f66e2..83a2d4497b 100644 --- a/app/call_flows/resources/classes/call_flows.php +++ b/app/call_flows/resources/classes/call_flows.php @@ -25,7 +25,6 @@ */ //define the call_flows class -if (!class_exists('call_flows')) { class call_flows { /** @@ -410,6 +409,3 @@ if (!class_exists('call_flows')) { } //method } //class -} - -?> diff --git a/app/call_flows/waveform.php b/app/call_flows/waveform.php index 0c93872262..8b760cd949 100644 --- a/app/call_flows/waveform.php +++ b/app/call_flows/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/call_forward/call_forward_edit.php b/app/call_forward/call_forward_edit.php index a6e48e8f7c..c3916334fb 100644 --- a/app/call_forward/call_forward_edit.php +++ b/app/call_forward/call_forward_edit.php @@ -421,7 +421,6 @@ //synchronize configuration if (!empty($_SESSION['switch']['extensions']['dir']) && is_readable($_SESSION['switch']['extensions']['dir'])) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); diff --git a/app/call_forward/resources/classes/call_forward.php b/app/call_forward/resources/classes/call_forward.php index 0017b05ac3..14abd65449 100644 --- a/app/call_forward/resources/classes/call_forward.php +++ b/app/call_forward/resources/classes/call_forward.php @@ -248,7 +248,6 @@ //synchronize configuration if (!empty($_SESSION['switch']['extensions']['dir']) && is_readable($_SESSION['switch']['extensions']['dir'])) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); diff --git a/app/call_forward/resources/classes/do_not_disturb.php b/app/call_forward/resources/classes/do_not_disturb.php index 3d6027ea98..a54e436e08 100644 --- a/app/call_forward/resources/classes/do_not_disturb.php +++ b/app/call_forward/resources/classes/do_not_disturb.php @@ -261,7 +261,6 @@ //synchronize configuration if (!empty($_SESSION['switch']['extensions']['dir']) && is_readable($_SESSION['switch']['extensions']['dir'])) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); diff --git a/app/call_forward/resources/classes/follow_me.php b/app/call_forward/resources/classes/follow_me.php index 0ee47b8ee4..f17adbf08c 100644 --- a/app/call_forward/resources/classes/follow_me.php +++ b/app/call_forward/resources/classes/follow_me.php @@ -426,7 +426,6 @@ //synchronize configuration if (!empty($_SESSION['switch']['extensions']['dir']) && is_readable($_SESSION['switch']['extensions']['dir'])) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); diff --git a/app/call_recordings/resources/classes/call_recordings.php b/app/call_recordings/resources/classes/call_recordings.php index 614a51c577..84cc2751e9 100644 --- a/app/call_recordings/resources/classes/call_recordings.php +++ b/app/call_recordings/resources/classes/call_recordings.php @@ -26,10 +26,7 @@ /** * call_recordings class - * - * @method null download */ -if (!class_exists('call_recordings')) { class call_recordings { /** @@ -525,6 +522,3 @@ if (!class_exists('call_recordings')) { } } //class -} - -?> diff --git a/app/call_recordings/waveform.php b/app/call_recordings/waveform.php index 8e3b52be6a..f7cba04c2b 100644 --- a/app/call_recordings/waveform.php +++ b/app/call_recordings/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/conference_centers/resources/classes/conference_centers.php b/app/conference_centers/resources/classes/conference_centers.php index b9fea85e4f..a2ae424c70 100644 --- a/app/conference_centers/resources/classes/conference_centers.php +++ b/app/conference_centers/resources/classes/conference_centers.php @@ -26,7 +26,6 @@ Luis Daniel Lucio Quiroz */ //define the conference centers class -if (!class_exists('conference_centers')) { class conference_centers { /** @@ -800,7 +799,7 @@ if (!class_exists('conference_centers')) { } //class -} + //example conference center /* @@ -814,5 +813,3 @@ if (!class_exists('conference_centers')) { $result = $conference_center->rooms(); print_r($result); */ - -?> \ No newline at end of file diff --git a/app/conference_centers/waveform.php b/app/conference_centers/waveform.php index 0c93872262..8b760cd949 100644 --- a/app/conference_centers/waveform.php +++ b/app/conference_centers/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/conference_controls/resources/classes/conference_controls.php b/app/conference_controls/resources/classes/conference_controls.php index 13120b560a..bf3e9bbf8f 100644 --- a/app/conference_controls/resources/classes/conference_controls.php +++ b/app/conference_controls/resources/classes/conference_controls.php @@ -26,12 +26,7 @@ /** * conference_controls class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('conference_controls')) { class conference_controls { /** @@ -426,6 +421,3 @@ if (!class_exists('conference_controls')) { } } -} - -?> \ No newline at end of file diff --git a/app/conference_profiles/resources/classes/conference_profiles.php b/app/conference_profiles/resources/classes/conference_profiles.php index d92a0c01e3..e44522ac62 100644 --- a/app/conference_profiles/resources/classes/conference_profiles.php +++ b/app/conference_profiles/resources/classes/conference_profiles.php @@ -26,12 +26,7 @@ /** * conference_profiles class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('conference_profiles')) { class conference_profiles { /** @@ -432,6 +427,3 @@ if (!class_exists('conference_profiles')) { } } -} - -?> \ No newline at end of file diff --git a/app/conferences/resources/classes/conferences.php b/app/conferences/resources/classes/conferences.php index c9a14f8140..3c5de88196 100644 --- a/app/conferences/resources/classes/conferences.php +++ b/app/conferences/resources/classes/conferences.php @@ -25,7 +25,6 @@ */ //define the conferences class -if (!class_exists('conferences')) { class conferences { /** @@ -374,6 +373,3 @@ if (!class_exists('conferences')) { } } -} - -?> \ No newline at end of file diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index bd57431454..73cb68e07e 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -1964,7 +1964,6 @@ echo " ".$text['label-destination_hold_music']."\n"; echo "\n"; echo "\n"; - require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $music_on_hold = new switch_music_on_hold; echo $music_on_hold->select('destination_hold_music', $destination_hold_music, null); echo "
\n"; diff --git a/app/destinations/resources/classes/destinations.php b/app/destinations/resources/classes/destinations.php index 2e5fea96de..0c83c321d9 100644 --- a/app/destinations/resources/classes/destinations.php +++ b/app/destinations/resources/classes/destinations.php @@ -26,11 +26,7 @@ /** * destinations - * - * @method get_array get the destinations - * @method select build the html select */ -if (!class_exists('destinations')) { class destinations { /** @@ -455,26 +451,24 @@ if (!class_exists('destinations')) { $destination_id = str_replace("[", "_", $destination_id); //$destination_id = preg_replace('/[^a-zA-Z_,.]/', '', $destination_name); - ?> - - \n"; + echo " function get_destinations(id, destination_type, action, search) {\n"; + echo " var xhttp = new XMLHttpRequest();\n"; + echo " xhttp.onreadystatechange = function() {\n"; + echo " if (this.readyState == 4 && this.status == 200) {\n"; + echo " document.getElementById(id).innerHTML = this.responseText;\n"; + echo " }\n"; + echo " };\n"; + echo " if (action) {\n"; + echo " xhttp.open(\"GET\", \"/app/destinations/resources/destinations.php?destination_type=\"+destination_type+\"&action=\"+action, true);\n"; + echo " }\n"; + echo " else {\n"; + echo " xhttp.open(\"GET\", \"/app/destinations/resources/destinations.php?destination_type=\"+destination_type, true);\n"; + echo " }\n"; + echo " xhttp.send();\n"; + echo " }\n"; + echo "\n"; //get the destinations $destinations = $this->get($destination_type); @@ -1308,7 +1302,7 @@ if (!class_exists('destinations')) { } //method } //class -} + /* $obj = new destinations; //$destinations = $obj->destinations; @@ -1319,5 +1313,3 @@ echo $obj->select('ivr', 'example4', ''); echo $obj->select('ivr', 'example5', ''); echo $obj->select('ivr', 'example6', ''); */ - -?> diff --git a/app/dialplans/resources/classes/dialplan.php b/app/dialplans/resources/classes/dialplan.php index 5c5b1cee7b..0147b6b313 100644 --- a/app/dialplans/resources/classes/dialplan.php +++ b/app/dialplans/resources/classes/dialplan.php @@ -25,7 +25,6 @@ */ //define the dialplan class - if (!class_exists('dialplan')) { class dialplan { //variables @@ -1580,6 +1579,3 @@ } //class - } - -?> diff --git a/app/email_queue/resources/classes/email_queue.php b/app/email_queue/resources/classes/email_queue.php index 77bc6542ee..a7efc72c7e 100644 --- a/app/email_queue/resources/classes/email_queue.php +++ b/app/email_queue/resources/classes/email_queue.php @@ -2,12 +2,7 @@ /** * email_queue class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('email_queue')) { class email_queue { /** @@ -225,6 +220,3 @@ if (!class_exists('email_queue')) { } } -} - -?> diff --git a/app/email_queue/resources/jobs/email_queue.php b/app/email_queue/resources/jobs/email_queue.php index 9e1d3952eb..0167e54796 100755 --- a/app/email_queue/resources/jobs/email_queue.php +++ b/app/email_queue/resources/jobs/email_queue.php @@ -11,7 +11,6 @@ //includes files require_once "resources/pdo.php"; - include "resources/classes/permissions.php"; require $_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/functions/transcribe.php"; //increase limits diff --git a/app/email_queue/resources/jobs/email_send.php b/app/email_queue/resources/jobs/email_send.php index 82a0180358..a0b3f8d213 100755 --- a/app/email_queue/resources/jobs/email_send.php +++ b/app/email_queue/resources/jobs/email_send.php @@ -10,7 +10,6 @@ } //include files - include "resources/classes/permissions.php"; include_once "resources/phpmailer/class.phpmailer.php"; include_once "resources/phpmailer/class.smtp.php"; diff --git a/app/email_queue/resources/service/email_queue.php b/app/email_queue/resources/service/email_queue.php index f12a023502..684dbc7b8e 100644 --- a/app/email_queue/resources/service/email_queue.php +++ b/app/email_queue/resources/service/email_queue.php @@ -9,9 +9,6 @@ exit; } -//include files - include "resources/classes/permissions.php"; - //increase limits set_time_limit(0); ini_set('max_execution_time', 0); diff --git a/app/event_guard/resources/classes/event_guard.php b/app/event_guard/resources/classes/event_guard.php index 02bafd1bc2..69ff9aefcf 100644 --- a/app/event_guard/resources/classes/event_guard.php +++ b/app/event_guard/resources/classes/event_guard.php @@ -26,12 +26,7 @@ /** * event_guard_logs class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('event_guard')) { class event_guard { /** @@ -303,6 +298,3 @@ if (!class_exists('event_guard')) { } } -} - -?> diff --git a/app/extension_settings/resources/classes/extension_settings.php b/app/extension_settings/resources/classes/extension_settings.php index b473669e9d..15c5b2cc01 100644 --- a/app/extension_settings/resources/classes/extension_settings.php +++ b/app/extension_settings/resources/classes/extension_settings.php @@ -26,12 +26,7 @@ /** * extension_settings class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('extension_settings')) { class extension_settings { /** @@ -272,6 +267,3 @@ if (!class_exists('extension_settings')) { } } -} - -?> diff --git a/app/extensions/extension_copy.php b/app/extensions/extension_copy.php index 9148d21b6b..0aeca685a4 100644 --- a/app/extensions/extension_copy.php +++ b/app/extensions/extension_copy.php @@ -186,7 +186,6 @@ //synchronize configuration if (is_writable($_SESSION['switch']['extensions']['dir'])) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 0bddf373df..f99c45b1b6 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -850,7 +850,6 @@ //synchronize configuration if (is_writable($switch_extensions)) { - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->xml(); unset($ext); @@ -2037,7 +2036,6 @@ echo " ".$text['label-hold_music']."\n"; echo "\n"; echo "\n"; - require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $options = ''; $moh = new switch_music_on_hold; echo $moh->select('hold_music', $hold_music ?? '', $options); diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php index 8a8eab1afa..53d0f9f90a 100644 --- a/app/extensions/resources/classes/extension.php +++ b/app/extensions/resources/classes/extension.php @@ -25,7 +25,6 @@ */ //define the directory class -if (!class_exists('extension')) { class extension { /** @@ -795,6 +794,3 @@ if (!class_exists('extension')) { } } -} - -?> diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index a22080e67c..8a52178671 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -29,7 +29,6 @@ require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/functions/object_to_array.php"; require_once "resources/functions/parse_message.php"; -require_once "resources/classes/text.php"; //get accounts to monitor $sql = "select d.domain_name, f.* "; diff --git a/app/fax/resources/classes/fax.php b/app/fax/resources/classes/fax.php index d3b6b8748d..e1a24157ce 100644 --- a/app/fax/resources/classes/fax.php +++ b/app/fax/resources/classes/fax.php @@ -25,7 +25,6 @@ */ //define the fax class -if (!class_exists('fax')) { class fax { /** @@ -725,7 +724,6 @@ if (!class_exists('fax')) { } } //class -} /* $o = new fax; @@ -738,5 +736,3 @@ $c->destination_number = $fax_destination_number; $c->fax_description = $fax_description; $c->dialplan(); */ - -?> \ No newline at end of file diff --git a/app/fax_queue/resources/classes/fax_queue.php b/app/fax_queue/resources/classes/fax_queue.php index f5d2897ef1..0f2378a066 100644 --- a/app/fax_queue/resources/classes/fax_queue.php +++ b/app/fax_queue/resources/classes/fax_queue.php @@ -26,12 +26,7 @@ /** * fax_queue class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('fax_queue')) { class fax_queue { /** @@ -274,6 +269,3 @@ if (!class_exists('fax_queue')) { } } } -} - -?> diff --git a/app/fax_queue/resources/service/fax_queue.php b/app/fax_queue/resources/service/fax_queue.php index 6084254ebf..db9eb1e654 100644 --- a/app/fax_queue/resources/service/fax_queue.php +++ b/app/fax_queue/resources/service/fax_queue.php @@ -8,7 +8,6 @@ //includes files require_once dirname(__DIR__, 4) . "/resources/require.php"; require_once "resources/pdo.php"; - include "resources/classes/permissions.php"; //increase limits set_time_limit(0); diff --git a/app/fifo/resources/classes/fifo.php b/app/fifo/resources/classes/fifo.php index 4338f3f48e..450f5cd4c3 100644 --- a/app/fifo/resources/classes/fifo.php +++ b/app/fifo/resources/classes/fifo.php @@ -2,12 +2,7 @@ /** * fifo class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('fifo')) { class fifo { /** @@ -283,6 +278,3 @@ if (!class_exists('fifo')) { } } -} - -?> \ No newline at end of file diff --git a/app/gateways/resources/classes/gateways.php b/app/gateways/resources/classes/gateways.php index cbfba52633..83ab122ad9 100644 --- a/app/gateways/resources/classes/gateways.php +++ b/app/gateways/resources/classes/gateways.php @@ -25,7 +25,6 @@ */ //define the gateways class -if (!class_exists('gateways')) { class gateways { /** @@ -583,6 +582,3 @@ if (!class_exists('gateways')) { } } -} - -?> \ No newline at end of file diff --git a/app/ivr_menus/resources/classes/ivr_menu.php b/app/ivr_menus/resources/classes/ivr_menu.php index 50a0fde239..2d91d84c15 100644 --- a/app/ivr_menus/resources/classes/ivr_menu.php +++ b/app/ivr_menus/resources/classes/ivr_menu.php @@ -25,7 +25,6 @@ */ //define the ivr_menu class -if (!class_exists('ivr_menu')) { class ivr_menu { /** @@ -489,6 +488,3 @@ if (!class_exists('ivr_menu')) { } } -} - -?> diff --git a/app/ivr_menus/waveform.php b/app/ivr_menus/waveform.php index 0c93872262..8b760cd949 100644 --- a/app/ivr_menus/waveform.php +++ b/app/ivr_menus/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/modules/resources/classes/modules.php b/app/modules/resources/classes/modules.php index 28b83949e0..8559b657b4 100644 --- a/app/modules/resources/classes/modules.php +++ b/app/modules/resources/classes/modules.php @@ -25,7 +25,6 @@ */ //define the modules class -if (!class_exists('modules')) { class modules { /** @@ -1101,10 +1100,8 @@ if (!class_exists('modules')) { } //class -} /* -require_once "resources/classes/modules.php"; $mod = new modules; $mod->dir = $_SESSION['switch']['mod']['dir']; echo $mod->dir."\n"; @@ -1138,5 +1135,3 @@ echo $mod->dir."\n"; //print_r($result); //echo "\n"; */ - -?> diff --git a/app/music_on_hold/music_on_hold.php b/app/music_on_hold/music_on_hold.php index 95c4443a81..ae92335afb 100644 --- a/app/music_on_hold/music_on_hold.php +++ b/app/music_on_hold/music_on_hold.php @@ -308,7 +308,6 @@ $cache = new cache; $cache->delete("configuration:local_stream.conf"); - //require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $music = new switch_music_on_hold; $music->reload(); 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 71d628eca2..55d90e86b1 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 @@ -27,7 +27,6 @@ */ //define the switch_music_on_hold class -if (!class_exists('switch_music_on_hold')) { class switch_music_on_hold { /** @@ -85,7 +84,6 @@ if (!class_exists('switch_music_on_hold')) { } //recordings if (is_dir($_SERVER["PROJECT_ROOT"].'/app/recordings')) { - require_once "app/recordings/resources/classes/switch_recordings.php"; $recordings_c = new switch_recordings; $recordings = $recordings_c->list_recordings(); if (is_array($recordings) && sizeof($recordings) > 0) { @@ -447,12 +445,9 @@ if (!class_exists('switch_music_on_hold')) { } //method } //class -} + //build and save the XML - //require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; //$moh = new switch_music_on_hold; //$moh->xml(); //$moh->save(); - -?> \ No newline at end of file diff --git a/app/music_on_hold/waveform.php b/app/music_on_hold/waveform.php index 68087e5dde..47fafbd10c 100644 --- a/app/music_on_hold/waveform.php +++ b/app/music_on_hold/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/number_translations/resources/classes/number_translations.php b/app/number_translations/resources/classes/number_translations.php index 22a2836401..c0abf97057 100644 --- a/app/number_translations/resources/classes/number_translations.php +++ b/app/number_translations/resources/classes/number_translations.php @@ -25,7 +25,6 @@ */ //define the number translations class -if (!class_exists('number_translations')) { class number_translations { /** @@ -414,11 +413,8 @@ if (!class_exists('number_translations')) { } //method } //class -} /* $obj = new number_translations; $obj->delete(); */ - -?> \ No newline at end of file diff --git a/app/phrases/resources/classes/phrases.php b/app/phrases/resources/classes/phrases.php index 2ed6f0f893..8fa677fe8a 100644 --- a/app/phrases/resources/classes/phrases.php +++ b/app/phrases/resources/classes/phrases.php @@ -25,7 +25,6 @@ */ //define the phrases class -if (!class_exists('phrases')) { class phrases { /** @@ -431,6 +430,3 @@ if (!class_exists('phrases')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/app/pin_numbers/resources/classes/pin_numbers.php b/app/pin_numbers/resources/classes/pin_numbers.php index c0be87493e..817f21caab 100644 --- a/app/pin_numbers/resources/classes/pin_numbers.php +++ b/app/pin_numbers/resources/classes/pin_numbers.php @@ -25,7 +25,6 @@ */ //define the pin numbers class -if (!class_exists('pin_numbers')) { class pin_numbers { /** @@ -245,6 +244,3 @@ if (!class_exists('pin_numbers')) { } } -} - -?> \ No newline at end of file diff --git a/app/recordings/resources/classes/switch_recordings.php b/app/recordings/resources/classes/switch_recordings.php index dc3988ef67..f50fa1e80e 100644 --- a/app/recordings/resources/classes/switch_recordings.php +++ b/app/recordings/resources/classes/switch_recordings.php @@ -26,7 +26,6 @@ */ //define the switch_recordings class -if (!class_exists('switch_recordings')) { class switch_recordings { /** @@ -158,6 +157,3 @@ if (!class_exists('switch_recordings')) { } //method } //class -} - -?> diff --git a/app/recordings/waveform.php b/app/recordings/waveform.php index f5136b2927..07a15a5555 100644 --- a/app/recordings/waveform.php +++ b/app/recordings/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/registrations/registrations.php b/app/registrations/registrations.php index 8840050198..18720eb38d 100644 --- a/app/registrations/registrations.php +++ b/app/registrations/registrations.php @@ -88,7 +88,6 @@ $registrations = $obj->get($profile ?? null); //order the array - require_once "resources/classes/array_order.php"; $order = new array_order(); $registrations = $order->sort($registrations, 'sip-auth-realm', 'user'); diff --git a/app/ring_groups/resources/classes/ring_groups.php b/app/ring_groups/resources/classes/ring_groups.php index ceab17b711..5a9786e256 100644 --- a/app/ring_groups/resources/classes/ring_groups.php +++ b/app/ring_groups/resources/classes/ring_groups.php @@ -25,7 +25,6 @@ */ //define the ring groups class -if (!class_exists('ring_groups')) { class ring_groups { /** @@ -512,6 +511,3 @@ if (!class_exists('ring_groups')) { } } -} - -?> diff --git a/app/ring_groups/waveform.php b/app/ring_groups/waveform.php index 0c93872262..8b760cd949 100644 --- a/app/ring_groups/waveform.php +++ b/app/ring_groups/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/sip_profiles/resources/classes/sip_profiles.php b/app/sip_profiles/resources/classes/sip_profiles.php index 5d90bb5de8..2ab414a2c3 100644 --- a/app/sip_profiles/resources/classes/sip_profiles.php +++ b/app/sip_profiles/resources/classes/sip_profiles.php @@ -25,7 +25,6 @@ */ //define the sip profiles class -if (!class_exists('sip_profiles')) { class sip_profiles { /** @@ -434,6 +433,3 @@ if (!class_exists('sip_profiles')) { } } -} - -?> \ No newline at end of file diff --git a/app/sofia_global_settings/resources/classes/sofia_global_settings.php b/app/sofia_global_settings/resources/classes/sofia_global_settings.php index 289efda183..f9a1c838b3 100644 --- a/app/sofia_global_settings/resources/classes/sofia_global_settings.php +++ b/app/sofia_global_settings/resources/classes/sofia_global_settings.php @@ -26,12 +26,7 @@ /** * sofia_global_settings class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('sofia_global_settings')) { class sofia_global_settings { /** @@ -247,6 +242,3 @@ if (!class_exists('sofia_global_settings')) { } } -} - -?> \ No newline at end of file diff --git a/app/streams/resources/classes/streams.php b/app/streams/resources/classes/streams.php index 05340cdfee..2256892d8f 100644 --- a/app/streams/resources/classes/streams.php +++ b/app/streams/resources/classes/streams.php @@ -25,7 +25,6 @@ */ //define the streams class -if (!class_exists('streams')) { class streams { /** @@ -244,6 +243,3 @@ if (!class_exists('streams')) { } } -} - -?> \ No newline at end of file diff --git a/app/switch/resources/classes/presence.php b/app/switch/resources/classes/presence.php index b455c24a6d..c645f8eac4 100644 --- a/app/switch/resources/classes/presence.php +++ b/app/switch/resources/classes/presence.php @@ -23,12 +23,7 @@ /** * presence class - * - * @method boolean active - * @method array show */ - -if (!class_exists('presence')) { class presence { /** @@ -84,7 +79,6 @@ if (!class_exists('presence')) { return $array; } } -} //examples /* @@ -97,11 +91,9 @@ if (!class_exists('presence')) { echo "active: true\n"; } else { - echo "active: false\n"; + echo "active: false\n"; } //show active the presence $presence = new presence; $array = $presence->show(); */ - -?> diff --git a/app/switch/resources/classes/ringbacks.php b/app/switch/resources/classes/ringbacks.php index db05aeb98a..d206eac70b 100644 --- a/app/switch/resources/classes/ringbacks.php +++ b/app/switch/resources/classes/ringbacks.php @@ -25,7 +25,6 @@ Matthew Vale */ -if (!class_exists('ringbacks')) { class ringbacks { //define variables @@ -85,18 +84,15 @@ if (!class_exists('ringbacks')) { */ //get the tones - require_once "resources/classes/tones.php"; $tones = new tones; $this->tones_list = $tones->tones_list(); //get music on hold and recordings if (is_dir($_SERVER["PROJECT_ROOT"].'/app/music_on_hold')) { - require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $music = new switch_music_on_hold; $this->music_list = $music->get(); } if (is_dir($_SERVER["PROJECT_ROOT"].'/app/recordings')) { - require_once "app/recordings/resources/classes/switch_recordings.php"; $recordings = new switch_recordings; $this->recordings_list = $recordings->list_recordings(); } @@ -232,6 +228,3 @@ if (!class_exists('ringbacks')) { return $select; } } -} - -?> diff --git a/app/switch/resources/classes/switch_files.php b/app/switch/resources/classes/switch_files.php index 80b1b24436..c98091a624 100644 --- a/app/switch/resources/classes/switch_files.php +++ b/app/switch/resources/classes/switch_files.php @@ -26,12 +26,7 @@ /** * switch class provides methods for copying switch_files - * - * @method string correct_path - * @method string copy_scripts - * @method string copy_languages */ -if (!class_exists('switch_files')) { class switch_files { /** @@ -158,7 +153,6 @@ if (!class_exists('switch_files')) { } } -} /* //example use @@ -168,5 +162,3 @@ if (!class_exists('switch_files')) { $obj->copy_scripts(); $obj->copy_languages(); */ - -?> diff --git a/app/time_conditions/resources/classes/time_conditions.php b/app/time_conditions/resources/classes/time_conditions.php index 98a5e757df..c4be826b78 100644 --- a/app/time_conditions/resources/classes/time_conditions.php +++ b/app/time_conditions/resources/classes/time_conditions.php @@ -25,7 +25,6 @@ */ //define the time conditions class - if (!class_exists('time_conditions')) { class time_conditions { /** @@ -346,6 +345,3 @@ } //class - } - -?> diff --git a/app/vars/resources/classes/vars.php b/app/vars/resources/classes/vars.php index 3f137327d5..7018b3da36 100644 --- a/app/vars/resources/classes/vars.php +++ b/app/vars/resources/classes/vars.php @@ -25,7 +25,6 @@ */ //define the vars class -if (!class_exists('vars')) { class vars { /** @@ -258,6 +257,3 @@ if (!class_exists('vars')) { } } -} - -?> \ No newline at end of file diff --git a/app/voicemail_greetings/resources/classes/voicemail_greetings.php b/app/voicemail_greetings/resources/classes/voicemail_greetings.php index b8ae36fb28..74b50cd0d2 100644 --- a/app/voicemail_greetings/resources/classes/voicemail_greetings.php +++ b/app/voicemail_greetings/resources/classes/voicemail_greetings.php @@ -25,7 +25,6 @@ */ //define the voicemail greetings class -if (!class_exists('voicemail_greetings')) { class voicemail_greetings { /** @@ -166,6 +165,3 @@ if (!class_exists('voicemail_greetings')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/app/voicemail_greetings/waveform.php b/app/voicemail_greetings/waveform.php index 59e8032d78..78325752ef 100644 --- a/app/voicemail_greetings/waveform.php +++ b/app/voicemail_greetings/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index 771d07ed97..cfeca41e78 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -1581,7 +1581,6 @@ } //example voicemail messages - //require_once "app/voicemails/resources/classes/voicemail.php"; //$voicemail = new voicemail; //$voicemail->voicemail_uuid = $voicemail_uuid; //$voicemail->order_by = $order_by; diff --git a/app/voicemails/resources/dashboard/voicemails.php b/app/voicemails/resources/dashboard/voicemails.php index a8e88448c4..6f062a54ca 100644 --- a/app/voicemails/resources/dashboard/voicemails.php +++ b/app/voicemails/resources/dashboard/voicemails.php @@ -23,9 +23,6 @@ //voicemail echo "
\n"; -//required class - require_once "app/voicemails/resources/classes/voicemail.php"; - //get the voicemail $vm = new voicemail; $vm->domain_uuid = $_SESSION['domain_uuid']; diff --git a/app/voicemails/voicemail_message_toggle.php b/app/voicemails/voicemail_message_toggle.php index 46227bbd55..da1afc7c0c 100644 --- a/app/voicemails/voicemail_message_toggle.php +++ b/app/voicemails/voicemail_message_toggle.php @@ -47,7 +47,6 @@ //toggle the voicemail message $toggled = 0; if (is_array($voicemail_messages) && sizeof($voicemail_messages) > 0) { - require_once "resources/classes/voicemail.php"; foreach ($voicemail_messages as $voicemail_uuid => $voicemail_message_uuids) { foreach ($voicemail_message_uuids as $voicemail_message_uuid) { if (is_uuid($voicemail_uuid) && is_uuid($voicemail_message_uuid)) { diff --git a/app/voicemails/waveform.php b/app/voicemails/waveform.php index 645ef6c003..effb3842f5 100644 --- a/app/voicemails/waveform.php +++ b/app/voicemails/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 8996ca6e9d..432570f92d 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -26,10 +26,7 @@ /** * xml_cdr class provides methods for adding cdr records to the database - * - * @method boolean add */ -if (!class_exists('xml_cdr')) { class xml_cdr { /** @@ -2370,4 +2367,3 @@ if (!class_exists('xml_cdr')) { } } //class -} diff --git a/app/xml_cdr/waveform.php b/app/xml_cdr/waveform.php index b37c596109..885087ec78 100644 --- a/app/xml_cdr/waveform.php +++ b/app/xml_cdr/waveform.php @@ -27,7 +27,6 @@ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; - require_once "resources/classes/waveform.php"; use maximal\audio\Waveform; diff --git a/core/authentication/resources/classes/authentication.php b/core/authentication/resources/classes/authentication.php index 790f319709..9cdc02ebae 100644 --- a/core/authentication/resources/classes/authentication.php +++ b/core/authentication/resources/classes/authentication.php @@ -96,7 +96,6 @@ class authentication { //process the plugin if (file_exists($plugin)) { //run the plugin - include_once $plugin; $object = new $class_name(); $object->domain_name = $this->domain_name; $object->domain_uuid = $this->domain_uuid; diff --git a/core/authentication/resources/classes/plugins/email.php b/core/authentication/resources/classes/plugins/email.php index 900c467b36..aa0bfd4a38 100644 --- a/core/authentication/resources/classes/plugins/email.php +++ b/core/authentication/resources/classes/plugins/email.php @@ -26,8 +26,6 @@ /** * plugin_email - * - * @method email time based one time password authenticate the user */ class plugin_email { @@ -521,5 +519,3 @@ class plugin_email { } } - -?> diff --git a/core/authentication/resources/classes/plugins/ldap.php b/core/authentication/resources/classes/plugins/ldap.php index dfd499602f..de85f39089 100644 --- a/core/authentication/resources/classes/plugins/ldap.php +++ b/core/authentication/resources/classes/plugins/ldap.php @@ -209,5 +209,3 @@ class plugin_ldap { return $result; } } - -?> \ No newline at end of file diff --git a/core/authentication/resources/classes/plugins/totp.php b/core/authentication/resources/classes/plugins/totp.php index 0524335a63..ccf7b8b410 100644 --- a/core/authentication/resources/classes/plugins/totp.php +++ b/core/authentication/resources/classes/plugins/totp.php @@ -439,5 +439,3 @@ class plugin_totp { } } - -?> diff --git a/core/contacts/contacts_vcard.php b/core/contacts/contacts_vcard.php index 59dcb42b97..f9434275df 100644 --- a/core/contacts/contacts_vcard.php +++ b/core/contacts/contacts_vcard.php @@ -42,7 +42,6 @@ if (!empty($_GET)) { $text = $language->get(); //create the vcard object - require_once "resources/classes/vcard.php"; $vcard = new vcard(); //get the contact id diff --git a/core/contacts/resources/classes/contacts.php b/core/contacts/resources/classes/contacts.php index c29f0243a8..cd3de9d6d7 100644 --- a/core/contacts/resources/classes/contacts.php +++ b/core/contacts/resources/classes/contacts.php @@ -25,7 +25,6 @@ */ //define the contacts class -if (!class_exists('contacts')) { class contacts { const APP_NAME = "contacts"; @@ -277,6 +276,3 @@ if (!class_exists('contacts')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/core/dashboard/resources/classes/dashboard.php b/core/dashboard/resources/classes/dashboard.php index 34f973bd95..6ecb1ba8fa 100644 --- a/core/dashboard/resources/classes/dashboard.php +++ b/core/dashboard/resources/classes/dashboard.php @@ -26,12 +26,7 @@ /** * dashboard class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('dashboard')) { class dashboard { /** @@ -247,6 +242,3 @@ if (!class_exists('dashboard')) { } } -} - -?> diff --git a/core/databases/resources/classes/databases.php b/core/databases/resources/classes/databases.php index 8b9edee5e2..0b5a29d78c 100644 --- a/core/databases/resources/classes/databases.php +++ b/core/databases/resources/classes/databases.php @@ -25,7 +25,6 @@ */ //define the databases class -if (!class_exists('databases')) { class databases { /** @@ -169,6 +168,3 @@ if (!class_exists('databases')) { } } -} - -?> \ No newline at end of file diff --git a/core/default_settings/resources/classes/default_settings.php b/core/default_settings/resources/classes/default_settings.php index 499614b5b3..73deb9801d 100644 --- a/core/default_settings/resources/classes/default_settings.php +++ b/core/default_settings/resources/classes/default_settings.php @@ -26,12 +26,7 @@ /** * default_settings class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('default_settings')) { class default_settings { /** @@ -327,6 +322,3 @@ if (!class_exists('default_settings')) { } //method } //class -} - -?> diff --git a/core/domain_settings/resources/classes/domain_settings.php b/core/domain_settings/resources/classes/domain_settings.php index 04a7c66626..b384ab062d 100644 --- a/core/domain_settings/resources/classes/domain_settings.php +++ b/core/domain_settings/resources/classes/domain_settings.php @@ -25,7 +25,6 @@ */ //define the domain settings class -if (!class_exists('domain_settings')) { class domain_settings { /** @@ -386,6 +385,3 @@ if (!class_exists('domain_settings')) { } //method } //class -} - -?> diff --git a/core/domains/domain_edit.php b/core/domains/domain_edit.php index bc40710efb..760b8f90ba 100644 --- a/core/domains/domain_edit.php +++ b/core/domains/domain_edit.php @@ -486,7 +486,6 @@ //recreate dialplan and extension xml files if (is_readable($_SESSION['switch']['extensions']['dir'])) { - require_once $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/resources/classes/extension.php"; $extension = new extension; $extension->xml(); } diff --git a/core/email_templates/resources/classes/email_templates.php b/core/email_templates/resources/classes/email_templates.php index 027e76ee03..af7240421a 100644 --- a/core/email_templates/resources/classes/email_templates.php +++ b/core/email_templates/resources/classes/email_templates.php @@ -25,7 +25,6 @@ */ //define the email templates class -if (!class_exists('email_templates')) { class email_templates { /** @@ -244,6 +243,3 @@ if (!class_exists('email_templates')) { } } -} - -?> \ No newline at end of file diff --git a/core/events/resources/classes/events.php b/core/events/resources/classes/events.php index e3fbb373cb..dd72242c6d 100644 --- a/core/events/resources/classes/events.php +++ b/core/events/resources/classes/events.php @@ -2,9 +2,6 @@ /** * events class provides an event system - * - * @method void load_plugins - * @method dynamic __call */ class events { @@ -31,11 +28,7 @@ class events { //create the database connection //includes files - require_once dirname(__DIR__, 4) . "/resources/require.php"; - - //includes files - require_once "resources/classes/database.php"; - $database = new database; + $database = database::new(); $database->connect(); $this->db = $database->db; return $this->db = $database->db; diff --git a/core/groups/permissions_default.php b/core/groups/permissions_default.php index 30a17c6f7e..4b5b41f02e 100644 --- a/core/groups/permissions_default.php +++ b/core/groups/permissions_default.php @@ -43,7 +43,6 @@ $text = $language->get(); //permission restore default - require_once "core/groups/resources/classes/permission.php"; $permission = new permission; $permission->restore(); diff --git a/core/install/resources/classes/install.php b/core/install/resources/classes/install.php index cd9b089cb7..221d7b4c38 100644 --- a/core/install/resources/classes/install.php +++ b/core/install/resources/classes/install.php @@ -1,6 +1,5 @@ diff --git a/core/menu/menu_restore_default.php b/core/menu/menu_restore_default.php index ef46c1e998..df0c5f3c1a 100644 --- a/core/menu/menu_restore_default.php +++ b/core/menu/menu_restore_default.php @@ -51,7 +51,6 @@ } //menu restore default - //require_once "resources/classes/menu.php"; $menu = new menu; $menu->menu_uuid = $menu_uuid; $menu->menu_language = $menu_language; diff --git a/core/software/resources/classes/software.php b/core/software/resources/classes/software.php index 7a84332caf..16f8bac3d0 100644 --- a/core/software/resources/classes/software.php +++ b/core/software/resources/classes/software.php @@ -2,10 +2,7 @@ /** * software class - * - * @method string version */ -if (!class_exists('software')) { class software { /** @@ -25,6 +22,3 @@ if (!class_exists('software')) { } } -} - -?> diff --git a/core/upgrade/index.php b/core/upgrade/index.php index eb56ed9fce..5d7f1499eb 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -133,7 +133,6 @@ //load an array of the database schema and compare it with the active database if (!empty($action["upgrade_schema"]) && permission_exists("upgrade_schema")) { - require_once "resources/classes/schema.php"; $obj = new schema(); if (isset($action["data_types"]) && $action["data_types"] == 'true') { $obj->data_types = true; diff --git a/core/upgrade/upgrade.php b/core/upgrade/upgrade.php index 376c3b0a22..7fb56cc9d0 100644 --- a/core/upgrade/upgrade.php +++ b/core/upgrade/upgrade.php @@ -189,8 +189,6 @@ //run all app_defaults.php files if ($upgrade_type == 'domains') { - require_once "resources/classes/config.php"; - require_once "resources/classes/domains.php"; $domain = new domains; $domain->display_type = $display_type; $domain->upgrade(); @@ -199,7 +197,6 @@ //upgrade schema and/or data_types if ($upgrade_type == 'schema') { //get the database schema put it into an array then compare and update the database as needed. - require_once "resources/classes/schema.php"; $obj = new schema; if (isset($argv[2]) && $argv[2] == 'data_types') { $obj->data_types = true; diff --git a/core/upgrade/upgrade_domains.php b/core/upgrade/upgrade_domains.php index 99931b27a1..e2d1692b0a 100644 --- a/core/upgrade/upgrade_domains.php +++ b/core/upgrade/upgrade_domains.php @@ -46,8 +46,6 @@ } //run all app_defaults.php files - require_once "resources/classes/config.php"; - require_once "resources/classes/domains.php"; $domain = new domains; $domain->display_type = $display_type; $domain->upgrade(); diff --git a/core/upgrade/upgrade_menu.php b/core/upgrade/upgrade_menu.php index e2497f80f9..f44373c479 100644 --- a/core/upgrade/upgrade_menu.php +++ b/core/upgrade/upgrade_menu.php @@ -273,8 +273,6 @@ function do_upgrade_code_submodules() { * Execute all app_defaults.php files */ function do_upgrade_domains() { - require_once dirname(__DIR__, 2) . "/resources/classes/config.php"; - require_once dirname(__DIR__, 2) . "/resources/classes/domains.php"; $domain = new domains; $domain->display_type = 'text'; $domain->upgrade(); @@ -285,7 +283,6 @@ function do_upgrade_domains() { */ function do_upgrade_schema(bool $data_types = false) { //get the database schema put it into an array then compare and update the database as needed. - require_once dirname(__DIR__, 2) . "/resources/classes/schema.php"; $obj = new schema; $obj->data_types = $data_types; echo $obj->schema('text'); diff --git a/core/upgrade/upgrade_schema.php b/core/upgrade/upgrade_schema.php index aa60ffef8a..807631d935 100644 --- a/core/upgrade/upgrade_schema.php +++ b/core/upgrade/upgrade_schema.php @@ -59,7 +59,6 @@ $text = $language->get(); //get the database schema put it into an array then compare and update the database as needed. - require_once "resources/classes/schema.php"; $obj = new schema; if (isset($argv[1]) && $argv[1] == 'data_types') { $obj->data_types = true; diff --git a/core/user_logs/resources/classes/user_logs.php b/core/user_logs/resources/classes/user_logs.php index 041603f66f..659e3976f2 100644 --- a/core/user_logs/resources/classes/user_logs.php +++ b/core/user_logs/resources/classes/user_logs.php @@ -26,12 +26,7 @@ /** * user_logs class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('user_logs')) { class user_logs { /** @@ -151,6 +146,3 @@ if (!class_exists('user_logs')) { } } -} - -?> diff --git a/core/user_settings/resources/classes/user_settings.php b/core/user_settings/resources/classes/user_settings.php index dea8b87ab3..8819ae58b0 100644 --- a/core/user_settings/resources/classes/user_settings.php +++ b/core/user_settings/resources/classes/user_settings.php @@ -25,7 +25,6 @@ */ //define the user settings class -if (!class_exists('user_settings')) { class user_settings { /** @@ -181,6 +180,3 @@ if (!class_exists('user_settings')) { } //method } //class -} - -?> \ No newline at end of file diff --git a/core/user_settings/user_setting_set.php b/core/user_settings/user_setting_set.php index 90dc47ed26..ef9dc20c86 100644 --- a/core/user_settings/user_setting_set.php +++ b/core/user_settings/user_setting_set.php @@ -107,7 +107,6 @@ Mark J Crane //revoke temporary permissions $p->delete('user_setting_delete', 'temp'); //reset session variables to default - require "resources/classes/domains.php"; $domain = new domains(); $domain->set(); } diff --git a/core/users/resources/classes/users.php b/core/users/resources/classes/users.php index 734ce273d9..f7424b734e 100644 --- a/core/users/resources/classes/users.php +++ b/core/users/resources/classes/users.php @@ -26,12 +26,7 @@ /** * users class - * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('users')) { class users { /** @@ -315,6 +310,3 @@ if (!class_exists('users')) { } } } -} - -?> diff --git a/resources/classes/auto_loader.php b/resources/classes/auto_loader.php index 1b5ed65549..74aed053e7 100644 --- a/resources/classes/auto_loader.php +++ b/resources/classes/auto_loader.php @@ -1,29 +1,37 @@ - Portions created by the Initial Developer are Copyright (C) 2008-2024 - the Initial Developer. All Rights Reserved. + The Initial Developer of the Original Code is + Mark J Crane + Portions created by the Initial Developer are Copyright (C) 2008-2024 + the Initial Developer. All Rights Reserved. - Contributor(s): - Mark J Crane -*/ + Contributor(s): + Mark J Crane + */ +/** + * Auto Loader class + * Searches for project files when a class is required. Debugging mode can be set using: + * - export DEBUG=1 + * OR + * - debug=true is appended to the url + */ class auto_loader { const FILE = 'autoloader_cache.php'; @@ -37,11 +45,20 @@ class auto_loader { */ private $apcu_enabled; + /** + * Cache path and file name + * @var string + */ + private static $cache_file = null; + public function __construct($project_path = '') { //set if we can use RAM cache $this->apcu_enabled = function_exists('apcu_enabled') && apcu_enabled(); + //set cache location + self::$cache_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . self::FILE; + //classes must be loaded before this object is registered if (!$this->load_cache()) { //cache miss so load them @@ -61,12 +78,14 @@ class auto_loader { //update RAM cache when available if ($this->apcu_enabled) { - apcu_store(self::CACHE_KEY, $this->classes); + $success = apcu_store(self::CACHE_KEY, $this->classes); + //do not save to drive when we are using apcu + if ($success) return true; } //ensure we have somewhere to put the file if (empty($file)) { - $file = sys_get_temp_dir() . '/' . self::FILE; + $file = self::$cache_file; } //export the classes array using PHP engine @@ -77,13 +96,10 @@ class auto_loader { if ($result !== false) { return true; } + + //file failed to save - send error to syslog when debugging $error_array = error_get_last(); - //send to syslog when debugging - if (!empty($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') { - openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); - syslog(LOG_WARNING, "[php][auto_loader] " . $error_array['message']); - closelog(); - } + self::log(LOG_WARNING, $error_array['message'] ?? ''); return false; } @@ -99,21 +115,21 @@ class auto_loader { //use a standard file if (empty($file)) { - $file = sys_get_temp_dir() . '/'. self::FILE; + $file = self::$cache_file; } + //use PHP engine to parse it if (file_exists($file)) { $this->classes = include $file; } - //assign to an array - if (!empty($this->classes)) { - //cache edge case of first time using apcu cache - if ($this->apcu_enabled) { - apcu_store(self::CACHE_KEY, $this->classes); - } - return true; + + //catch edge case of first time using apcu cache + if ($this->apcu_enabled) { + apcu_store(self::CACHE_KEY, $this->classes); } - return false; + + //return true when we have classes and false if the array is still empty + return !empty($this->classes); } public function reload_classes($project_path = '') { @@ -122,26 +138,87 @@ class auto_loader { $project_path = dirname(__DIR__, 2); } - //build the array of all classes - $search_path = []; - $search_path = array_merge($search_path, glob($project_path . '/resources/classes/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/resources/interfaces/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/resources/traits/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/*/*/resources/classes/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/*/*/resources/interfaces/*.php')); - $search_path = array_merge($search_path, glob($project_path . '/*/*/resources/traits/*.php')); + //build the array of all locations for classes in specific order + $search_path = [ + $project_path . '/resources/interfaces/*.php', + $project_path . '/resources/traits/*.php', + $project_path . '/resources/classes/*.php', + $project_path . '/*/*/resources/interfaces/*.php', + $project_path . '/*/*/resources/traits/*.php', + $project_path . '/*/*/resources/classes/*.php', + $project_path . '/core/authentication/resources/classes/plugins/*.php', + ]; + + //get all php files for each path + $files = []; + foreach ($search_path as $path) { + $files = array_merge($files, glob($path)); + } //reset the current array $this->classes = []; - //store the class name (key) and the path (value) - foreach ($search_path as $path) { - $this->classes[basename($path, '.php')] = $path; - } + //store PHP language declared classes, interfaces, and traits + $curr_classes = get_declared_classes(); + $curr_interfaces = get_declared_interfaces(); + $curr_traits = get_declared_traits(); + //store the class name (key) and the path (value) + foreach ($files as $file) { + + //include the new class + try { + include_once $file; + } catch (Exception $e) { + //report the error + self::log(LOG_ERR, "Exception while trying to include file '$file': " . $e->getMessage()); + continue; + } + + //get the new classes + $new_classes = get_declared_classes(); + $new_interfaces = get_declared_interfaces(); + $new_traits = get_declared_traits(); + + //check for a new class + $classes = array_diff($new_classes, $curr_classes); + if (!empty($classes)) { + foreach ($classes as $class) { + $this->classes[$class] = $file; + } + //overwrite previous array with new values + $curr_classes = $new_classes; + } + + //check for a new interface + $interfaces = array_diff($new_interfaces, $curr_interfaces); + if (!empty($interfaces)) { + foreach ($interfaces as $interface) { + $this->classes[$interface] = $file; + } + //overwrite previous array with new values + $curr_interfaces = $new_interfaces; + } + + //check for a new trait + $traits = array_diff($new_traits, $curr_traits); + if (!empty($traits)) { + foreach ($traits as $trait) { + $this->classes[$trait] = $file; + } + //overwrite previous array with new values + $curr_traits = $new_traits; + } + } } - private function loader($class_name) : bool { + /** + * The loader is set to private because only the PHP engine should be calling this method + * @param string $class_name The class name that needs to be loaded + * @return bool True if the class is loaded or false when the class is not found + * @access private + */ + private function loader($class_name): bool { //sanitize the class name $class_name = preg_replace('[^a-zA-Z0-9_]', '', $class_name); @@ -161,32 +238,29 @@ class auto_loader { } //cache miss - if (!empty($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') { - openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); - syslog(LOG_WARNING, "[php][auto_loader] class not found in cache: ".$class_name); - closelog(); - } + self::log(LOG_WARNING, "class '$class_name' not found in cache"); //set project path using magic dir constant $project_path = dirname(__DIR__, 2); //build the search path array - $search_path[] = glob($project_path . "/resources/classes/".$class_name.".php"); - $search_path[] = glob($project_path . "/resources/interfaces/".$class_name.".php"); - $search_path[] = glob($project_path . "/resources/traits/".$class_name.".php"); - $search_path[] = glob($project_path . "/*/*/resources/classes/".$class_name.".php"); - $search_path[] = glob($project_path . "/*/*/resources/interfaces/".$class_name.".php"); - $search_path[] = glob($project_path . "/*/*/resources/traits/".$class_name.".php"); + $search_path[] = glob($project_path . "/resources/interfaces/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/resources/traits/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/resources/classes/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/*/*/resources/interfaces/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/*/*/resources/traits/" . $class_name . ".php"); + $search_path[] = glob($project_path . "/*/*/resources/classes/" . $class_name . ".php"); - //find the path - $path = self::autoload_search($search_path); - if (!empty($path)) { + //collapse all entries to only the matched entry + $matches = array_filter($search_path); + if (!empty($matches)) { + $path = array_pop($matches)[0]; - //include the class or interface - include $path; + //include the class, interface, or trait + include_once $path; - //make sure to reload the cache after we found a new class - $this->reload_classes(); + //inject the class in to the array + $this->classes[$class_name] = $path; //update the cache with new classes $this->update_cache(); @@ -196,35 +270,54 @@ class auto_loader { } //send to syslog when debugging - if (!empty($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') { - openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); - syslog(LOG_WARNING, "[php][auto_loader] class not found name: ".$class_name); - closelog(); - } + self::log(LOG_ERR, "class '$class_name' not found name"); //return boolean return false; } - public static function autoload_search($array) : string { - foreach($array as $path) { - if (is_array($path) && count($path) != 0) { - foreach($path as $sub_path) { - if (!empty($sub_path) && file_exists($sub_path)) { - return $sub_path; - } - } - } - elseif (!empty($path) && file_exists($path)) { - return $path; - } + /** + * Returns a list of classes loaded by the auto_loader. If no classes have been loaded an empty array is returned. + * @return array List of classes loaded by the auto_loader or empty array + */ + public function get_class_list(): array { + if (!empty($this->classes)) { + return $this->classes; } - return ''; + return []; } - public static function clear_cache() { + public static function clear_cache(string $file = '') { + + //check for apcu cache if (function_exists('apcu_enabled') && apcu_enabled()) { apcu_delete(self::CACHE_KEY); } + + //set default file + if (empty(self::$cache_file)) { + self::$cache_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . self::FILE; + } + + //set file to clear + if (empty($file)) { + $file = self::$cache_file; + } + + //remove the file when it exists + if (file_exists($file)) { + @unlink($file); + $error_array = error_get_last(); + //send to syslog when debugging with either environment variable or debug in the url + self::log(LOG_WARNING, $error_array['message'] ?? ''); + } + } + + private static function log(int $level, string $message): void { + if (filter_var($_REQUEST['debug'] ?? false, FILTER_VALIDATE_BOOL) || filter_var(getenv('DEBUG') ?? false, FILTER_VALIDATE_BOOL)) { + openlog("PHP", LOG_PID | LOG_PERROR, LOG_LOCAL0); + syslog($level, "[auto_loader] " . $message); + closelog(); + } } } diff --git a/resources/classes/button.php b/resources/classes/button.php index c82b34551b..d7786d7418 100644 --- a/resources/classes/button.php +++ b/resources/classes/button.php @@ -25,7 +25,6 @@ Mark J Crane */ -if (!class_exists('button')) { class button { public static $collapse = 'hide-md-dn'; @@ -127,7 +126,6 @@ if (!class_exists('button')) { $button = $anchor.$button.""; } return $button; - unset($button); } private static function quote($value) { @@ -135,7 +133,6 @@ if (!class_exists('button')) { } } -} /* @@ -236,5 +233,3 @@ if (!class_exists('button')) { */ - -?> \ No newline at end of file diff --git a/resources/classes/database.php b/resources/classes/database.php index f745b8a489..28ceade452 100644 --- a/resources/classes/database.php +++ b/resources/classes/database.php @@ -3279,7 +3279,7 @@ * @see database::__construct() * @see database::connect() */ - public static function new(array $params = []) { + public static function new(array $params = []): static { if (self::$database === null) { self::$database = new database($params); if (!self::$database->is_connected()) { @@ -3326,7 +3326,6 @@ /* //example usage //find - require_once "resources/classes/database.php"; $database = new database; $database->domain_uuid = $_SESSION["domain_uuid"]; $database->type = $db_type; @@ -3343,7 +3342,6 @@ $database->find(); print_r($database->result); //insert - require_once "resources/classes/database.php"; $database = new database; $database->domain_uuid = $_SESSION["domain_uuid"]; $database->table = "v_ivr_menus"; diff --git a/resources/classes/domains.php b/resources/classes/domains.php index 2875616cdd..edb1932425 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -28,11 +28,7 @@ /** * domains class * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('domains')) { class domains { /** @@ -786,6 +782,3 @@ if (!class_exists('domains')) { } } -} - -?> diff --git a/resources/classes/email.php b/resources/classes/email.php index dc419897b0..9b046505d6 100644 --- a/resources/classes/email.php +++ b/resources/classes/email.php @@ -27,9 +27,7 @@ /** * email class * - * @method boolean send */ -if (!class_exists('email')) { class email { /** @@ -625,7 +623,7 @@ if (!class_exists('email')) { } } -} + /* $email = new email; diff --git a/resources/classes/groups.php b/resources/classes/groups.php index 2bf85c4e63..138671f38b 100644 --- a/resources/classes/groups.php +++ b/resources/classes/groups.php @@ -27,11 +27,7 @@ /** * groups class provides methods for add, delete groups, and add default groups * - * @method null delete - * @method null toggle - * @method null copy */ -if (!class_exists('groups')) { class groups { /** @@ -534,6 +530,3 @@ if (!class_exists('groups')) { $_SESSION["user"]["group_level"] = $this->group_level; } } -} - -?> \ No newline at end of file diff --git a/resources/classes/menu.php b/resources/classes/menu.php index 9df1c94320..04489265a9 100644 --- a/resources/classes/menu.php +++ b/resources/classes/menu.php @@ -27,7 +27,6 @@ /** * menu class */ -if (!class_exists('menu')) { class menu { /** @@ -1339,4 +1338,3 @@ if (!class_exists('menu')) { } } -} diff --git a/resources/classes/message.php b/resources/classes/message.php index 936f4edd46..61e017753b 100644 --- a/resources/classes/message.php +++ b/resources/classes/message.php @@ -25,7 +25,6 @@ Matthew Vale */ -if (!class_exists('message')) { class message { static function add($message, $mood = null, $delay = null) { @@ -71,6 +70,3 @@ if (!class_exists('message')) { return $html; } } -} - -?> diff --git a/resources/classes/modal.php b/resources/classes/modal.php index e5d61a9f68..0629c4fa69 100644 --- a/resources/classes/modal.php +++ b/resources/classes/modal.php @@ -25,7 +25,6 @@ Mark J Crane */ -if (!class_exists('modal')) { class modal { static function create($array) { @@ -65,11 +64,7 @@ if (!class_exists('modal')) { $modal .= "
"; return $modal; - unset($modal); } } -} - -?> \ No newline at end of file diff --git a/resources/classes/schema.php b/resources/classes/schema.php index 3ec6c2c57f..1bd01703ff 100644 --- a/resources/classes/schema.php +++ b/resources/classes/schema.php @@ -26,8 +26,6 @@ */ //define the schema class -if (!class_exists('schema')) { - class schema { //define variables @@ -473,7 +471,6 @@ if (!class_exists('schema')) { } //get the db variables - //require_once "resources/classes/config.php"; //$config = new config; //$config_exists = $config->exists(); //$config_path = $config->find(); @@ -908,13 +905,10 @@ if (!class_exists('schema')) { } //end function } -} //example use -//require_once "resources/classes/schema.php"; //$obj = new schema; //$obj->db_type = $db_type; //$obj->schema(); //$result_array = $schema->obj['sql']; //print_r($result_array); -?> diff --git a/resources/classes/switch_settings.php b/resources/classes/switch_settings.php index 3457dba41e..e1822954cc 100644 --- a/resources/classes/switch_settings.php +++ b/resources/classes/switch_settings.php @@ -5,7 +5,6 @@ * * @method settings will add missing switch directories to default settings */ -if (!class_exists('switch_settings')) { class switch_settings { public $event_socket_ip_address; @@ -276,6 +275,3 @@ if (!class_exists('switch_settings')) { unset($array); } } -} - -?> diff --git a/resources/classes/template.php b/resources/classes/template.php index 0c932163e3..3b3d2c57f4 100644 --- a/resources/classes/template.php +++ b/resources/classes/template.php @@ -25,7 +25,6 @@ */ //define the template class - if (!class_exists('template')) { class template { public $engine; @@ -90,6 +89,3 @@ } } } - } - -?> \ No newline at end of file diff --git a/resources/classes/tones.php b/resources/classes/tones.php index 397348e660..90a8f9a08d 100644 --- a/resources/classes/tones.php +++ b/resources/classes/tones.php @@ -25,7 +25,6 @@ Matthew Vale */ -if (!class_exists('tones')) { class tones { //define variables @@ -33,7 +32,7 @@ if (!class_exists('tones')) { private $music_list; private $recordings_list; private $default_tone_label; - + //class constructor public function __construct() { //add multi-lingual support @@ -61,11 +60,8 @@ if (!class_exists('tones')) { $this->tones = $tone_list ?? ''; unset($sql, $tones, $tone, $tone_list); } - + public function tones_list() { return $this->tones; } } -} - -?> diff --git a/resources/classes/xml.php b/resources/classes/xml.php index 582595f15a..ac7d883297 100644 --- a/resources/classes/xml.php +++ b/resources/classes/xml.php @@ -1,6 +1,5 @@ diff --git a/resources/switch.php b/resources/switch.php index 906942b404..fa72e0ba13 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -948,7 +948,6 @@ if (!function_exists('save_switch_xml')) { function save_switch_xml() { if (is_readable($_SESSION['switch']['extensions']['dir'])) { if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/resources/classes/extension.php")) { - require_once $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."app/extensions/resources/classes/extension.php"; $extension = new extension; $extension->xml(); } @@ -958,7 +957,6 @@ if (!function_exists('save_switch_xml')) { save_setting_xml(); } if (file_exists($_SERVER["PROJECT_ROOT"]."/app/modules/app_config.php")) { - require_once $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/modules/resources/classes/modules.php"; $module = new modules; $module->xml(); //$msg = $module->msg; diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index a4a3525ddd..50e3f282ac 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -201,9 +201,8 @@ if (!function_exists('fax_split_dtmf')) { //includes files require_once dirname(__DIR__) . "/resources/require.php"; - include "resources/classes/event_socket.php"; - include "resources/phpmailer/class.phpmailer.php"; - include "resources/phpmailer/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded + include_once "resources/phpmailer/class.phpmailer.php"; + include_once "resources/phpmailer/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded //set php ini values ini_set('max_execution_time', 900); //15 minutes