Commit Graph

89 Commits

Author SHA1 Message Date
frytimo
08001488f4 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
2025-03-12 13:55:47 -06:00
FusionPBX
cd8d5302ac Fix temporary permissions 2024-11-29 13:57:01 -07:00
frytimo
2cbb4dbc31 remove instances where a pointer is used in a foreach loop for value (#7108) 2024-08-22 12:41:10 -06:00
FusionPBX
1c22b49d5a Pass the database object to the settings object 2024-08-06 02:40:50 -06:00
FusionPBX
032a24cb28 Update domains.php 2024-08-05 15:52:51 -06:00
FusionPBX
00c803f53e Use the database more efficiently 2024-08-05 12:16:36 -06:00
FusionPBX
3215f50826 Update domains.php 2024-06-22 19:31:38 -06:00
frytimo
fcd64fcce6 Remove session from provisioning (#7014)
* use single database object, use settings class

* add common domain functions

* use settings class
2024-06-22 19:28:04 -06:00
fusionate
2d3dca985d Upgrade - CLI (Manual & Menu): Mitigate PHP 8.x warnings, minor adjustments. 2024-05-13 14:19:34 -06:00
frytimo
0b8edef82c Config class rewrite (#6965)
* Use a singleton pattern in the database class to re-use the database object inside the permission_exists function.
2024-04-27 19:22:20 -06:00
fusionate
0fe2f20375 Domains - Delete: Fix issue deleting multiple domains at once. 2024-01-17 21:33:23 +00:00
FusionPBX
fa123ff069 Build dialplan xml from the array. More efficient to save data and xml in one step. 2023-11-03 02:18:57 -06:00
FusionPBX
4dbd4e10a3 Add missing default settings 2023-10-11 17:27:11 -06:00
FusionPBX
c6d966395e Use settings class for app_defaults.php 2023-09-16 00:22:12 -06:00
FusionPBX
2c5724c6ed Add new class methods and use them 2023-09-11 01:45:19 -06:00
FusionPBX
4eb7fdf007 Update default and domain setting session array
In the "domains" class upgrade method, only set the value when either "default_setting_enabled" is true or "domain_setting_enabled" is equal to true.
2023-08-28 14:45:39 -06:00
markjcrane
32051873be Use __dir__ to find resources/require.php 2023-06-16 22:49:09 -06:00
FusionPBX
473033257a Exclude switch default settings.
This category is causing errors and is not needed for this code.
2023-06-07 11:43:15 -06:00
markjcrane
b75b0f63e6 Initialize the array before using them 2023-06-06 23:37:09 -06:00
fusionate
8e9f28a5e0 Domains [Class]: Updates for PHP 8.1 2023-06-06 21:43:50 +00:00
fusionate
f7951324ea Domains [Class] - Updates for PHP 8.1 2023-05-16 18:42:32 +00:00
FusionPBX
ff2c52eda8 Update domains.php 2023-05-12 20:32:44 -06:00
FusionPBX
44a46d491b Use !empty in the if statement 2023-05-12 20:24:39 -06:00
FusionPBX
b86cd20e8e Use isset instead of is_uuid 2023-05-10 22:01:12 -06:00
frytimo
fef8165be2 Frytimo pr patches for php8.1 (#6630)
* Passing null to parameter #2 ($string) of type string is deprecated

* Passing null to parameter #1 ($string) of type string is deprecated

* php 8.1 fixes

* php 8.1 fixes - replace strlen($var) > 0 with !empty($var)

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - strlower with null

* php 8.1 fixes - strreplace with null

* php 8.1 fixes - passing null to base64_decode

* php 8.1 fixes - check for false and check for null on $this->dir

* php 8.1 fixes - remove assignment of $db variable to modules object

* php 8.1 fixes - avoid sending null to substr

* php 8.1 fixes - change ${var} to {$var}

* php 8.1 fixes - check for null before preg_replace

* php 8.1 fixes - remove setting db variable on domains object

* php 8.1 fixes - set empty string if $row['domain_setting_subcategory'] is null

* php 8.1 fixes - set empty string if $_REQUEST['show'] is not available

* php 8.1 fixes

* php 8.1 fixes - correct $_POST checking syntax

* php 8.1 fixes - correct $_POST variables

* php 8.1 fixes

* Use brackets consistently

* Update user_setting_edit.php

* Change to not empty

* Update device.php

* Update text.php

---------

Co-authored-by: Tim Fry <tim@voipstratus.com>
Co-authored-by: FusionPBX <markjcrane@gmail.com>
2023-05-05 10:46:37 -06:00
frytimo
37646c0893 Frytimo pr remove unused variables and fix clobbering (#6656)
* config->exists returns true or false but no action taken and variable
is unused

* remove unused variable db_type

* remove unused variable db_name

* remove unused variable db_username

* remove unused variable db_password

* remove unused variable db_secure

* remove unused variable db_cert_authority

* remove unused variable db_host

* remove unused variable db_path

* remove unused variable db_port

* remove unused variable db. The upgrade method never uses the db variable
and instead uses a new database connection each time.

* remove uninitialized parameters variable

* domain_count never used

* variable context is never used in the method or any app_defaults

* variable $row is clobbered by inner foreach loop

* variable domain_name is never used in method scope

* variable domain_array seems to be uninitialized in this scope so set an
empty string value so function lower_case is not receiving null.
2023-05-03 14:41:39 -06:00
frytimo
69bd42af05 remove unneeded destruct methods as GC has higher performance (#6631)
Co-authored-by: Tim Fry <tim@voipstratus.com>
2023-04-27 20:18:53 -06:00
FusionPBX
051cb01fdc Use the subcategory when refreshing the session
Beset to be specific when using unset to clear values in the session
2023-03-23 21:40:50 -06:00
FusionPBX
b373e3c7fe Needed to get DOCUMENT_ROOT and PROJECT_PATH 2022-10-11 15:53:18 -06:00
markjcrane
d50bcb476a Replace root.php 2022-10-10 16:35:14 -06:00
FusionPBX
a432996055 Add missing part of the array. 2022-01-09 06:41:25 -07:00
FusionPBX
2c096c9e01 Only load default settings that are not in the database. 2022-01-08 16:22:03 -07:00
FusionPBX
408b13238e Use include instead of require_once. 2021-09-13 11:52:12 -06:00
FusionPBX
dc8c2f1df6 Update domains class to use the database class. 2021-09-12 15:29:28 -06:00
fusionate
3d81016695 Domains Class: Update settings() method to support setting array order, when present. 2020-12-28 16:28:01 -07:00
Nate
5c7f97ac8a Domains: Retain session domain_name and domain_uuid on add and delete. 2020-11-02 16:00:02 -07:00
FusionPBX
f567c12672 Update domains.php 2020-08-14 00:37:16 -06:00
agree
51a6b56dae Update domains.php (#5092)
* Update domains.php
2020-03-11 20:04:41 -06:00
Nate
b9a207c51d Domains Class: Use unique variable name for array id in delete() method. 2020-02-17 17:54:36 -07:00
Nate
1b95cbf38c Domains: Supress warnings when deleting missing xml files in delete() method. Fix recordings directory session variable index. 2020-02-17 08:51:21 -07:00
FusionPBX
eb28a261bc Update domains.php 2019-12-16 11:17:25 -07:00
FusionPBX
9f70128428 Update domains.php 2019-12-16 09:37:57 -07:00
Nate
911a43219e Users: Prevent duplicate usernames. 2019-09-10 19:23:14 -06:00
jpattWPC
4ae27f13b6 Add support for PostgreSQL TLS (#4262)
This commit adds support for PostgreSQL TLS communication. This requires /etc/fusionpbx/config.php to have two parameters added:

$db_secure = true;
$db_cert_authority = "/path/to/ca.crt";
2019-06-05 21:10:58 -06:00
FusionPBX
1f1c813675 Update domains.php 2018-02-25 01:08:54 -07:00
Mafoo
32a6f76ed0 Enhance [master] provide $app_path during upgrade (#2573)
if a application is installed via a symlink PHP will resolve the symlink
for __DIR__ and __FILE__ making it impossible for an application to work
out it's relative path withing the fusion system.
By providing $app_path during upgrade routines an application will
beable to provide the correct link for menu items (e.g.
/opt/languages/index.php) instead of having to hard code it where it
could change depending on how the application was installed
2017-06-08 09:41:56 -06:00
Mafoo
bfe3ff173f Enhance - Display text on app_defaults (#2645)
enable display_type on domains (and therefore app_defaults)
capture the output of app_defaults
format if statements to project preference
use more generic label display for results reducing number of translations required
change upgrade.php to use the more consistent $display_type
2017-06-08 09:39:50 -06:00
FusionPBX
f6fdd9523f Update domains.php 2017-01-17 13:37:26 -07:00
FusionPBX
6fe57bace2 Update domains.php 2017-01-14 18:17:21 -07:00
FusionPBX
c6c5329a56 Update domains.php 2017-01-14 18:15:34 -07:00