Commit Graph
71 Commits
Author SHA1 Message Date
Adam Daley 96659a195c Refactor cookie management and clean up legacy (#3308)
* Remove manual unsetting of `BOXADMR` cookie

* Rename locale cookie `BBLANG` to `fb_locale`

* Rename session name to `fb_sid`

* Tidy comments in `config-sample.php`

* Remove legacy `bb-ipn.php` rewrite rule

* Remove legacy BB params and file migration check

* Remove header comments from `robots.txt`

* Update SQL dump header database name

* Use `FB_*` DB constants and add DB port
2026-03-10 08:42:11 +00:00
Belle Aerni 0a156f4161 Fix CS automation (#3209)
* Restore needed gitignore

* Ran the fixes since they are far behind

* Fix for rector causing a problem. Re-ran.

* Update ServiceTest.php
2026-01-26 11:18:35 -08:00
f27d2e3646 Fix downloadable products (#2822)
* Fixed Downloadable product issue where the product config was overwritten if the settings were saved.

* Ran phpstan & cs-fixer

* Added pdate function to fix products where possible

* Fixed uploading new files when the config is broken.

* Added fix to updater

* Removed superfluous line

* Bump Last Patch Level to Fix Live Tests

* Clean up file download response headers and fix `json_decode` usage

* Handle null config in saveProductConfig and sendProductFile

* Apply suggestion from @Copilot

Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix file upload path and improve error handling

* Refactor file update logic in Service class

Replaces inline update of the servicedownloadable record with a call to updateProductFile, improving code organization and maintainability.

* Update `last_patch` setting to version 48

Incremented the 'last_patch' value in the settings table from 47 to 48 to reflect the latest patch version.

* Improve downloadable product filename recovery in patch

Enhanced patch 48 in UpdatePatcher to more robustly recover missing filenames for downloadable products by checking both order configs and service_downloadable records, updating all related data sources, and cleaning up orphaned records. Added detailed statistics logging for the recovery process. Also removed an obsolete PHPStan ignore rule for polyfilled ctype functions.

* Add required param validation to config_save method

Introduced explicit required parameter validation for the 'id' field in the config_save method of the Admin API. This ensures that a missing product ID is caught early with a clear error message.

* Refactor file handling and patch logic for downloadable products

Simplifies and streamlines the patch logic for recovering lost filenames in downloadable products, removing verbose statistics and redundant comments. Refactors file upload error handling in Servicedownloadable Service to use a dedicated error message method and eliminates unnecessary try/catch blocks. Updates Admin API to use attribute-based required parameter validation for product file downloads.

* Update src/modules/Servicedownloadable/Service.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor Servicedownloadable Admin API param validation

Removed redundant manual required param validation in Admin API methods in favor of attribute-based validation. Updated related tests to reflect this change and added more comprehensive tests for file sending scenarios. Also updated HTML form element IDs for clarity.

* Remove redundant test for missing product ID in config save

Deleted the testConfigSaveMissingId test from AdminTest.php as it is no longer needed. This streamlines the test suite by removing duplicate or unnecessary validation checks.

---------

Co-authored-by: Chris Schläpfer <c.schlaepfer@datact.ch>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-30 04:05:30 +00:00
Adam Daley a9b903c222 Codebase modernisation, configuration cleanup, and improved type safety (#2957)
* Refactor tests to replace depreciated functions

* Update Rector config and dependencies

* Rector: Add explicit string casting for stricter type safety

* Rector: Add return type hints to methods across codebase

* Rector: Increase dead code level and refactor invoice item logic

* Remove unnecessary `willReturn` from test mocks

Eliminate redundant `willReturn(null)` and similar calls from PHPUnit mock setups in legacy module tests, leaving only method expectations. Also update some test values to use floats for consistency.

* Refactor API controller and email adapter return values

* Update formatting and guidelines in `AGENTS.md`
2025-10-11 23:39:44 +01:00
Adam DaleyandCopilot 315f9f3944 Refactor Filesystem and Path handling (#2836)
* Removed legacy files

* Refactor Filesystem and Path handling

* Removed `FOSSBilling\Tools` legacy functions

* Update live-tests to include file check for `php_error.log`

* Update Extension module tables to fix wrapping issue

* Apply suggestions from @Copilot

Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Extension module icon URL handling

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-09 21:50:11 +01:00
Belle Aerni 31ce61d619 Fix oversight in protocol handling (#2808)
* Fix oversight in protocol handling

* Ran the CS fixer
2025-07-02 10:25:51 -07:00
d2ad579466 Typos and some untranslatable text (#2773)
* Fix typos and add translatable strings 1

* Fix typos and add translatable strings 2

* Fix typos and add translatable strings 3

* correction

* Load theme settings HTML as Twig template

* Make huraga theme settings translatable

* Update CONTRIBUTING.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Cookieconsent/html_admin/mod_cookieconsent_index.html.twig

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update cspell.json

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-05 12:32:15 +01:00
FOSSBilling BotandFOSSBilling Bot a888d3fd68 Apply PHP Code Styling & Quality Changes (#2651)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2025-04-07 23:42:19 +01:00
Adam Daley c0d1c68ffc Fix installer redirect when config missing (#2648)
Fix installer redirect issue when config missing introduced in #2626 due to changes in loader logic.
2025-03-24 17:51:10 -07:00
FOSSBilling BotandFOSSBilling Bot c500462e97 Apply PHP Code Styling & Quality Changes (#2631)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2025-03-07 12:56:33 +00:00
Adam Daley 43d1969f68 Refactor initial application loading (#2626)
* Refactor initial application loading

Refactor `load.php` to simplify loading, clarify loading, and to use available Symfony components. Additionally, update `index.php` as appropriate.

Add Symfony HttpFoundation as supporting dependency and for future functionality.

* Remove or disable problematic and unused functions

* Restore required FOSSBilling\Event function

* Remove / disable problematic unused functions

* Restore required FOSSBilling\Event function

* Refactor initial application loading

Refactor `load.php` to simplify loading, clarify loading, and to use available Symfony components. Additionally, update `index.php` as appropriate.

Add Symfony HttpFoundation as supporting dependency and for future functionality.

* Remove or disable problematic and unused functions

* Restore required FOSSBilling\Event function

* Remove / disable problematic unused functions

* Restore required FOSSBilling\Event function
2025-03-06 00:55:20 +00:00
Belle Aerni 368f8cd6ad Bump the year (#2581) 2025-01-23 15:11:53 -08:00
Belle Aerni c0ee8d3fc5 Cleaned up some routing, simplified webserver conf (#2511)
* Cleaned up some routing, simplified webserver conf

* Update cspell.json

* Update cspell.json

* Fixes
2024-11-27 04:00:12 -08:00
Belle Aerni d2cf53f1f4 Ensure the error handler always has the needed classes (#2386)
With the order of operations, it was possible for the error handler to be triggered without the auto-loader functional, resulting in these classes to not be loaded.

This fixes that
2024-08-04 13:24:35 -07:00
FOSSBilling BotandFOSSBilling Bot 17d19c28ee Apply PHP Code Styling & Quality Changes (#2333)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2024-07-04 13:46:38 -07:00
Belle Aerni 76321faf8e Misc fixes and cleanup (#2299)
* Misc fixes and cleanup

* More misc cleanup

* Removed outdated / invalid tests

* Update SentryHelper.php
2024-06-10 20:32:44 -07:00
Belle Aerni 075c809881 Updated our rector configs (#2224)
* Some rector config work

* Increased type coverage, added dead code
2024-04-09 00:51:42 -07:00
Belle Aerni d771457efc Bump the year (#2167)
* Bump the year

* And fix the spelling
2024-02-25 02:45:38 -08:00
Belle Aerni e1044636d4 Refactored the generatePassword function (#2131) 2024-02-11 17:02:47 +00:00
Belle Aerni b5a4bd4d9e Various minor improvements (#2132)
- Removed unused twig extension, May a tiny bit of ram and reduce memory usage.
- Switch to the filesystem `touch` function VS PHP's native. Also corrected the time used for touch.
- Wrapped our call to monolog's `write` function in a try-catch. These don't need to be fatal. Instead logs to the PHP error log.
- Ensured the SSL redirect won't be triggered if needed headers weren't provided. Prevents logged errors
- Removed unused composer deps.
- Moved cURL to being a required extension in our composer.json file
- Replaced a a case where the death star version constraint was being used.
2024-02-10 21:39:25 -08:00
Belle Aerni ea0b7068b7 Minor bugfixes / deprecation cleanups (#2128)
* Minor bugfixes / deprecation cleanups

* Making the tests happy
2024-02-09 22:00:00 -08:00
Belle Aerni 76b32a6026 Feat: allow selection of the default network interface (#2065)
* Feat: allow selection of the default network interface

* Update cspell.json

* Wrote some tests, moved the setting to the config file

* Cleanup, fixes, include Sentry in the bind setting

* Use JS to update the IP rather than reload, minor tweaks

* UI tweaks

* Removed leftover incomplete sentence, mention interface names
2024-01-17 01:46:32 -08:00
Belle Aerni b061d5da04 Implemented a new class for config management (#2066)
* Implemented a new class for config management

* Run Rector & PHP-CS-Fixer

* Spelling

* Pointed a bunch of code to the new class

* Fix tests, removed 2 broken ones that did nothing

* Quick run of PHP-CS-Fixer

* Fixed issues noticed in self review

* Updated remaining old methods. Fixed minor error page issue

* Very minor code tweak

* Fixes, added a related test

* Check for OPCache functions being defined

* I don't think this timeout is needed
2024-01-15 14:12:53 -08:00
FOSSBilling BotandFOSSBilling Bot a86da9ad90 Apply PHP Code Styling & Quality Changes (#2038)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2024-01-04 05:27:59 -08:00
Jaap Marcus 7e8ff7700a Fix Installer when behind a reverse proxy (#1977)
Make sure set:
 proxy_set_header X-Forwarded-Host $host;
 proxy_set_header X-Forwarded-Proto https;

When creating then nginx config
2023-12-15 23:27:30 +00:00
Belle Aerni a3b6180abf Fix the issue John noticed (#1870)
* Fix the issue John noticed

* QoL: Don't delete it when debug mode is enabled
2023-11-25 04:01:08 +00:00
FOSSBilling BotandFOSSBilling Bot ee1c0f33fa Apply PHP Code Styling & Quality Changes (#1856)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2023-11-21 11:27:18 -08:00
Belle Aerni 6006bfa264 Resolve events being duplicated in Sentry (#1844)
* Resolve events being duplicated in Sentry

* Fixed a typo

* Aaaand restored the placeholder

* Also adjust the API code
2023-11-17 09:00:05 +02:00
Belle Aerni 104553bf7f Error reporting bug fixes (#1785)
* Error reporting bug fixes

* This is honestly a better way to do this
2023-11-08 07:08:58 +00:00
Adam Daley 230b10f6ea Replace direct config references with constants (#1768)
* Fix PATH_DATA constant to use config

Update `PATH_DATA` constant to use the `path_data` config option.

* Replace direct config references with constants

Replace direct references to `config.php` file and specific config options in favour of global constants, where available.

* Drop BB prefix on global constants

Rename global constants to drop `BB_` prefix, where appropriate.
2023-11-06 07:55:23 +00:00
FOSSBilling Bot 7717e185aa Apply PHP Code Styling & Quality Changes (#1772) 2023-11-01 08:36:29 +01:00
Belle Aerni 602b537996 Opt-in error reporting via Sentry.io (#1732)
* Began implementing Sentry.io support

* Added to the installer

* Added the ID to the bug report template and UI

* Hook it into our error handler, added the ability to filter by error code

* Attempting to add the DSN via GH actions

* Spelling and making PHPstan happy

* Skip exceptions for various incomplete configurations

Also brings in some of the category suggestions made by @Anuril in #195

* Update tests to account for changes

* Added & renamed exception classes

* Fix tests

* Change a bunch of items to be InformationExceptions

* Use a lighter HTTP client, fixed API error reporting

* I guess that's not needed now?

Arighty then

* Improvements, additional info added

* Update SentryHelper.php

* Improved error logging, added instance ID to error page

Also made it so that errors are correctly sent to Sentry rather than exclusively exceptions

* Make the tests happy

* Added the link, improved wording

Also removed the "performance" part of the reporting as it needs to be added to the front-end and I'm not currently implementing that

* Began implementing UI alerts and info

* Added the ability to toggle, fixed tests, use path constants

* Added some useful info & links to the page

* These should be InformationException

* Fix the automated Sentry DSN entry

* Fix the install number text

* Minor cleanup, converted more to InformationException

* Replaced some direct config references with constants

We have the BB_DEBUG constant to indicate if we have debug mode enabled or not, so we shouldn't be directly referencing it in the config file unless we actually need to do so.

Using the constant means there's less locations to update the reference if the config structure is changed

* Bugfix

* Consistency & fixed a PHPDoc

* Corrections

* We actually do want exceptions thrown here

* Change how we get the instance ID

* Stability improvements

Having support for translatable error pages was proving to be problematic, so I had to remove it.

I also had to update the exception class to handle cases where the trans function wasn't setup yet (needed for the /run-patcher page if an error occurs)

* Missed this change on git

* Also fix the variable names...

* Re-added new deps after rebase

* This should also accept "Error" types

* Added more info to the bug report and removed a dug line

* This wasn't supposed to get renamed

* Updated some missed references to Box_Exception
2023-10-28 18:40:39 -07:00
Belle Aerni 28e2d824e1 Prevent errors over some CLI setups (#1729) 2023-10-17 13:26:37 -07:00
RonandBelle Aerni 75fb9cbdcf Developer Workflow Supporting Code (#1692)
* #1583 initial workflow update using debug reference in config for install dir bypass

* #1583 add missed files

* #1583 improve config generation

* #1583 clean up docblock (issue feedback)

* fix https detection, corrected pull from upstream

* #1583 improve docker build config

* #1583 remove docker configs from repo, they have been moved to dev workflow documentation

* Two very minor changes

* Other minor changes

---------

Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-10-05 09:47:57 +02:00
Belle Aerni 8c7729ccd3 Miscellaneous autoloader improvements (#1676)
* Miscellaneous autoloader improvements

* Spelling

* Fixed PHPDocs
2023-10-04 07:40:19 +03:00
FOSSBilling BotandFOSSBilling Bot f37753d4a7 Apply PHP Code Styling & Quality Changes (#1638)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2023-09-26 17:10:30 -07:00
Belle Aerni 8c047bc0da Fix to allow analysis to run against the installer (#1633) 2023-09-25 22:02:57 +03:00
YağızhanandBelle Aerni dbcf9a3ad4 Rewritten bin/prepare & +FOSSBilling_Environment (#1622)
* Rewritten bin/prepare & +FOSSBilling_Environment

* -redundancy

* - unnecessary bits

* nothing much

* Fix inverted logic, use new function in missed location

---------

Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-09-22 18:19:02 -07:00
Belle Aerni 0318eb1287 Tweak the HTTPS check and secure cookie flag behavior (#1600) 2023-09-14 23:44:16 +03:00
Yağızhanandfossbilling-bot fd872ac941 Implement PHP-CS-Fixer as an automated workflow (#1240)
* Implement PHP-CS-Fixer as an automated workflow

* Apply PHP-CS-Fixer changes

---------

Co-authored-by: fossbilling-bot <121974958+fossbilling-bot@users.noreply.github.com>
2023-07-30 06:49:11 -07:00
Belle Aerni 5eb516d4eb Prevent exceptions from being interpreted as HTML (#1394) 2023-07-01 14:58:13 +02:00
Belle Aerni 25a0090c5d Bump AntLoader to v2.0.0 (#1280) 2023-05-30 12:26:24 +03:00
Yağızhan d909d77f7e -Unnecessary whitespace in the class headers (#1219) 2023-05-07 13:24:29 -07:00
Yağızhan 412e4a9fbd Standardized the class headers (#1212) 2023-05-06 13:06:17 +01:00
Belle Aerni dded03b41d Replace custom autoloader with AntLoader (#1215)
* Replace custom autoloader with AntLoader

* Update install.php

* Bump antcms/antloader to v1.0.1
2023-05-05 14:17:56 -07:00
Adam Daley e54569d2cd Introduce namespaces and strict typing for FOSSBilling library classes (#1206) 2023-05-04 01:02:06 +01:00
Belle Aerni d9e69d4146 Implement a custom autoloader (#1194)
* Implement a custom autoloader

* Remove unreachable line

* Spelling

* I missed that

* Just use the latest version of PHPStan

* Also setup the autoloader in the installer

* Implemented classmap capabilities

* Remove debug line, add PHPDocs

* Typo 7 removing dead code

* Fix the installer after the most recent commit

* Remove outdated installation steps

And link to the website instead

* Excuse me. Formatting please?
2023-05-01 13:19:55 -07:00
Belle AerniandAdam Daley e3d6bc9ad9 Introduce a cspell workflow (#1192)
* Introduce a cspell workflow

* Update cspell.yml

* Update cspell.yml

* Why is it seemingly ignoring the config?

* Waiit a min

* Fixed a bunch of spelling mistakes

* And set it back to incremental mode

* That is actually supposed to be spelled wrong..

Because BoxBilling :)

* Capitalization

* I swear I fixed this as well

* Update cspell.json

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2023-04-30 00:05:25 -07:00
Belle AerniandAdam Daley ed404202a6 Remove broken and poorly implemented feature (#1190)
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2023-04-29 12:58:29 -07:00
Belle Aerni 273dc3bf65 Fix load.php and minor error handler issues (#1188)
* Fix load.php and minor error handler issues

* Re-enable the installer check

* Final few fixes
2023-04-29 20:56:14 +01:00