Commit Graph

167 Commits

Author SHA1 Message Date
FusionPBX
31fef269e4 Use gettype on the values
- Add boolean handing to ifelse string
- Use trim only when the variable type is string

Add params for :child_key_name, :parent_key_value
- These were strictly sanitized
- Updated to not appear unsafe

Remove database method: add, and update
- Replaced by the save method several years ago
2025-10-03 16:29:43 -06:00
FusionPBX
e82a21ba11 Update child validate changes
- Include value trim
2025-10-03 14:02:54 -06:00
FusionPBX
f7e23476ba Normalize the user data to match the database
- Used to check if the data has changed
- Only update modified data
- Added the following
   - normalize null
   - normalize numeric
   - normalize string
   - normalize boolean (updated)
2025-10-03 11:59:46 -06:00
FusionPBX
dae3262851 Update database handling for app_name and app_uuid
If app_name is not found, then try the singular form of the class name
2025-10-03 10:19:34 -06:00
FusionPBX
6fcd0e83c1 Update database.php 2025-10-01 08:26:34 -06:00
FusionPBX
2fe8b65988 Define app_name and app_uuid as constants (#7534)
* Set a constant on each class for app_name and app_uuid
* Update the database class to use the app_uuid and app_name
* Update the classes to use the database::new()
* Remove the instances of 'new database'
2025-09-30 21:37:09 -06:00
FusionPBX
7f9064fadb Update boolean toggle and the database boolean type (#7522)
* Change the data type to boolean

* Use boolean values in SQL and Conditional Statements

* Schema Data Types: Drop views so that alter tables statements complete

* Update settings.php

* Add extension for call_screen_enabled

* Gateway handle boolean
Add the boolean toggle
- distinct_to
- caller_id_in_from
- supress_cng
- extension_in_contact
- contact_in_ping

* Update gateways.php

* Update voicemail_edit.php

* Replace the ${caller_id_name} with the extensions caller id name

* Phrase - Edit: Update slide toggle with new select beneath.

* Update the input toggle style

* Set the input_toggle_style_switch as boolean

* Update the input toggle style

* Theme: Adjust CSS to wrap description text on form fields.

* Add domain_uuid and domain_name to the SQL SELECT

* Unset the parameters to fix the next query

* Gateway: Integrate new slide toggle switch.

* Dashboard: Update the input toggle style (#7499)

* Dashboard: Update the input toggle style

* Update dashboard_widget_edit.php

* Update dashboard_edit.php

* Inbound Route - Add: Integrate new slide toggle switch and boolean.

* User Settings: Integrate new slide toggle switch.

* Call Block Edit: Update the input toggle style (#7500)

* Bridge Edit: Update the input toggle style (#7501)

* Update phrases.php

* Update domain_edit.php

* Domain Settings Edit: Update the input toggle style

* User Edit: Update the input toggle style

* Update install.php

* Remove fields marked as deprecated

* Use boolean in the select statement

* Streams: New slide toggle and boolean.

* Streams: Remove unnecessary default.

* Queues (FIFO): New slide toggle.

* Call Detail Records: Update the input toggle style (#7503)

* Call Detail Records: Update the input toggle style

* Update xml_cdr_extension_summary.php

* Update xml_cdr_extension_summary.php

* Update xml_cdr_extension_summary.php

* Call Centers: Update the input toggle style (#7502)

* Call Centers: Update the input toggle style

* Update call_center_agent_edit.php

* Conference Centers: Update the input toggle style (#7506)

* Conference Centers: Update the input toggle style

* Update app_config.php

* Update conference_center_edit.php

* Use boolean data type (#7505)

* Call Flow Edit: Update the input toggle style (#7504)

* Devices: Update the input toggle style

* IVR Menus: New slide toggle.

* IVR Menu: Remove deprected file.

* SIP Profile - Edit: New slide toggle.

* Device Profiles: Update the input toggle style

* Ring Groups - List: Fix syntax.

* Theme: Fire onchange event when switching slide toggle control.

* Device Vendors: Update the input toggle style

* Update enabled boolean

* Update device_edit.php

* Ring Groups: New slide toggle.

* Update domain_edit.php

* Email Templates: Update the input toggle style

* Header: Correct default value on input toggle style.

* Default/Domain/User Settings: Adjust Select option label for better clarity.

* Use true boolean types for switch theme toggle or drop-down box (#7507)

* Groups: Update the input toggle style

* Conference Controls: Update the input toggle style (#7509)

* Conference Controls: Update the input toggle style

* Update conference_control_edit.php

* Update conference_control_details.php

* Update conference_control_detail_edit.php

* Conferences: Update the input toggle style (#7511)

* Use true boolean types for switch theme toggle or drop-down box (#7513)

* Dialplans: Update the input toggle style
Also updated outbound route add

* Ring Group: Only adjust ring group forward destination top margin when slide toggle enabled.

* Default/Domain/User Settings - List: Adjust for new 'Select Box' label on input_toggle_style value.

* Use true boolean types for switch theme toggle or drop-down box (#7514)

* Call Forward / Follow Me: Minor javascript adjustments to mirror previous behavior.

* Ring Groups [Dashboard]: New slide toggle.

* Get the contacts details with a seperate SQL Query

* Remove debug info

* Destinations: Update the input toggle style

* Conference Profiles: Update the input toggle style (#7515)

* Conference Profiles: Update the input toggle style

* Update conference_profiles.php

* Update conference_profile_params.php

* Update conference_profile_param_edit.php

* Update conference_profile_edit.php

* Extensions: Update the input toggle style

* Contacts: Update the input toggle style (#7517)

* Contacts: Update the input toggle style

* Update contact_address_edit.php

* Update contact_attachment_edit.php

* Update contact_edit.php

* Update contact_email_edit.php

* Update contact_phone_edit.php

* Update contact_relation_edit.php

* Update contact_setting_edit.php

* Update contact_url_edit.php

* Update contacts.php

* Voicemails: New slide toggle.

* Voicemail Greeting: New slide toggle.

* Modules: New slide toggle.

* Recordings: New slide toggle

* Variables: New slide toggle.

* Time Conditions: New slide toggle.

* Extensions - List: Remove invalid column name.

* Extension Settings: New slide toggle.

* Number Translations: New slide toggle and boolean.

* Sofia global settings: Update the input toggle style

* Update alter table convert to boolean

* Fix contact relation search (#7518)

* Sip Profile Edit: Fix setting enabled labels (#7519)

* Sip Profile Edit: Fix setting enabled labels

* Update sip_profile_edit.php

* Update dialplan_edit.php (#7520)

* Update SQL queries to use true/false for contact primary settings (#7521)

* Update SQL queries to use true/false for contact primary settings

* Update contacts_vcard.php

* Update email.php

* Update totp.php

* Update contact_url_edit.php

* Update contact_email_edit.php

* Update contact_address_edit.php

* Update contact_attachment_edit.php

* Update contact_phone_edit.php

* Add a database views method

* Add database view groups

* Add database users view

* Add database call_recordings view

* Update users.php

* Add  database view call block

* Update schema to use the database views method

* Update conference.conf.lua boolean

* Update directory.lua boolean

* Update callcenter.conf.lua agent_status boolean

* Update sofia.conf.lua boolean

* Update number translations lua boolean

* Update directory.lua boolean

* Update group_call.lua fix the cache

* Update reverse-auth-lookup.lua boolean

* Update directory.lua boolean

* Use concat instead of ||

* Update index.lua

---------

Co-authored-by: fusionate <nate@fusionpbx.com>
Co-authored-by: Alex <alex@fusionpbx.com>
Co-authored-by: frytimo <tim@fusionpbx.com>
2025-09-20 18:42:05 -06:00
FusionPBX
a7f4712ceb Remove class_exists condition 2025-09-05 13:01:58 -06:00
FusionPBX
e313e9d750 Add try catch around beginTransaction and commit
Added the try catch around save and delete methods.
2025-08-21 09:52:52 -06:00
FusionPBX
bc5275fdcd Compare both value and type 2025-08-18 12:07:52 -06:00
FusionPBX
57b26b9d44 Normalize the boolean data 2025-08-14 16:52:37 -06:00
FusionPBX
62c7d6a4c4 Correct the original data array
The original data array old_array, the value should be null for adding records with an insert
2025-08-10 01:44:38 -06:00
FusionPBX
b6868ebedb Keep the primary and secondary keys in the array 2025-08-10 00:07:44 -06:00
FusionPBX
851025565c Only update modified data 2025-08-09 23:05:56 -06:00
FusionPBX
96275ed9c1 Fix transactions to save the domain_uuid
Symptom
Advanced -> Transactions showed as global when it should have shown the correct domain. This was failing when saving a new record.
2025-07-03 09:16:26 -06:00
FusionPBX
aa6bc173a7 Update database.php 2025-07-03 08:30:53 -06:00
FusionPBX
58e69d2596 Fix the user_uuid using database::new() 2025-07-03 08:13:46 -06:00
FusionPBX
d583e8352d Use more intuitive names 2025-04-07 14:48:47 -06:00
FusionPBX
6c6814b29e Remove syntax that breaks older PHP
Removed :static to support PHP 7.4
2025-03-12 23:39:24 -06:00
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
b8b796316e Add method column_exists to the database class 2025-01-28 15:35:02 -07:00
frytimo
f6adc9bdd0 suppress access on null php notice in new is_connected method (#7227) 2025-01-23 12:38:03 -07:00
frytimo
95faf83337 add is_connected method to database (#7225) 2025-01-23 11:42:19 -07:00
FusionPBX
18bce0437d Add more debug details and return false 2025-01-22 20:35:53 -07:00
FusionPBX
7e4f82f840 Enhance message array debug details 2025-01-22 20:07:02 -07:00
FusionPBX
8ea79e56e7 Replace exit; with return false; 2025-01-22 19:26:25 -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
ba3ab5a8c9 Use parent_name as its more intuitive
Also replace $this->name with $this->app_name
2024-08-06 17:07:16 -06:00
FusionPBX
c960575796 Update database.php 2024-08-06 11:28:32 -06:00
FusionPBX
46bbb31391 Update database.php
- preset empty values for variables and arrays
- use $table_name instead of $this->name
2024-08-06 02:52:55 -06:00
FusionPBX
b3f31af5a8 If data is global then domain_uuid set to null
This means transaction is global. If there is a domain_uuid use the domain ID from the data.
2024-08-01 18:02:15 -06:00
Antonio Fernandez
dcf1f9d17c Update database.php (#7053)
Fix for table_exists method on mysql
2024-07-18 12:10:05 -06:00
frytimo
a863faaae2 fix the user_uuid missing from transaction tables (#7026)
Co-authored-by: Tim Fry <tim@fusionpbx.com>
2024-06-27 11:26:16 -06:00
frytimo
f0a80426eb add function to return the config object used to create the database object (#6998)
Co-authored-by: Tim Fry <tim@fusionpbx.com>
2024-06-08 09:57:33 -06:00
FusionPBX
d9c92c00e9 Update database.php add comments 2024-05-02 06:40:30 -06:00
FusionPBX
0c08780ca2 Update database.php 2024-04-27 19:29:50 -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
FusionPBX
2a1e36ca02 Add apps as a class variable
- Use self:$apps
- Replace $_SESSION['apps']
2024-04-19 11:07:30 -06:00
FusionPBX
768937b624 Update database.php
- Allow sending $params into the constructor.
- Add paramaters: domain_uuid and user_uuid
- Replace $user_uuid and the session variable with $this->user_uuid
- Use the SESSION as an alternative to the parameter
2024-04-19 09:48:05 -06:00
frytimo
758cb2ec60 set to compare instead of assignment in the message error checking (#6933) 2024-03-28 22:07:04 -06:00
FusionPBX
4ed611a187 When the toggle field and values are empty then use defaults 2023-08-15 21:37:05 -06:00
FusionPBX
4bf775897e Replace GLOB_BRACE as its not supported by all systems. 2023-08-14 11:27:40 -06:00
fusionate
ceb0637c83 Database [Class]: Update for PHP 8.1 2023-07-05 23:12:00 +00:00
FusionPBX
ec04006971 Change the scope of the database variables 2023-06-28 15:29:28 -06:00
FusionPBX
bcf7cbaad2 Save database errors to the message variable 2023-06-19 16:08:54 -06:00
markjcrane
1452bde1ac Update the database class to find the require.php 2023-06-17 22:29:15 -06:00
markjcrane
32051873be Use __dir__ to find resources/require.php 2023-06-16 22:49:09 -06:00
fusionate
8b982dd6e3 Database [Class]: Modify copy() method to support enable and description fields without the table name. 2023-06-09 19:42:10 +00:00
FusionPBX
7979ff145b Use $this->message
Reason for using this message rather than local message variable is that it get changed and the information we want is preserved in the class variable.
2023-05-26 09:55:18 -06:00
fusionate
6119f7de7d Database [Class]: Update for PHP 8.1 2023-05-25 15:40:20 +00:00