Commit Graph
79 Commits
Author SHA1 Message Date
Adam Daley 691c3f7aa7 Use templates/* directories for module templates (#3347)
* Use `templates/*` directories for module templates

* Update template globs and fix icon path
2026-03-17 21:28:15 +00:00
Adam Daley 568a4926e6 Add 'msword' to cspell.json dictionary (#3320) 2026-03-11 01:09:41 +00:00
0d81f5d450 Enhance security and validation for sessions and file uploads (#3315)
* Sanitise email HTML; add session decoder

* Use signed session restore token for redirects

* Restrict invoice and service access to client

* Perform CSRF check regardless of session

* Validate uploaded files by extension/mime

* Use 32-byte random for reset hashes

* Use PBKDF2 SHA-256 for key derivation

* Add versioned encryption and migrate data

* Refactor Servicecustom API and update download validation

* Prefer token login when credentials present

* Update cspell word list with filetype terms

* Ignore token auth for guest requests

* Validate decrypted text and add fixed IV in test

* Bump `last_patch` setting to 50

* Update src/modules/Api/Controller/Client.php

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

* Fix CSRF/token auth interaction: token auth always bypasses CSRF regardless of session (#3318)

* Replace hand-rolled PHP session parser with unserialize() (#3317)

* Initial plan

* Replace buggy phpSessionDecode() with unserialize()

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>

* Fix migrateEncryptedColumn failing on tables without updated_at (#3316)

* Initial plan

* Fix migrateEncryptedColumn to skip updated_at when column doesn't exist

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>

* Guard `phpSessionDecode()` return type in `deleteSessionIfMatching` (#3319)

* Initial plan

* Guard phpSessionDecode() return type in deleteSessionIfMatching

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
2026-03-11 00:59:05 +00:00
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
Adam DaleyandCopilot 0c44c7f624 Replace PDO usage with Doctrine DBAL (#2964)
* Refactor database connection to use `DriverManagerFactory`

* Add Doctrine DBAL connection to DI container

Revert "Add Doctrine DBAL connection to DI container"

This reverts commit bc2f9f4901d8baee4b12cd2795b0ef76156849cf.

Reapply "Add Doctrine DBAL connection to DI container"

This reverts commit 48debb74bbfa6c8cebf27ee20c222c911d508ccb.

* Refactor database access to use Doctrine DBAL

* Refactor DB config to use 'driver' instead of 'type'

* Refactor database connection to use `DriverManagerFactory`

* Add Doctrine DBAL connection to DI container

Revert "Add Doctrine DBAL connection to DI container"

This reverts commit bc2f9f4901d8baee4b12cd2795b0ef76156849cf.

Reapply "Add Doctrine DBAL connection to DI container"

This reverts commit 48debb74bbfa6c8cebf27ee20c222c911d508ccb.

* Refactor database access to use Doctrine DBAL

* Refactor DB config to use 'driver' instead of 'type'

* Refactor tests to use `dbal` mocks

* Replace `getQueryBuilder` with `createQueryBuilder

* Fix handling of empty query results and cleanup exception comment

* Update Composer lock file

* Refactor PDO initialization in DI container

Updated the DI definition for 'pdo' to directly use the PDO instance returned by Doctrine's DriverManagerFactory, removing unnecessary object casting. Also added missing import for DriverManagerFactory. Updated PHPStan config to remove a redundant ctype_alnum rule.

* Refactor query execution and result fetching logic

Updated database query handling in Extension and System Service classes to separate query building from execution and fetching. This improves code clarity and ensures consistent use of fetchOne for single-value results.

* Fix SQL where clause syntax in Service.php

Corrects the syntax of the where clause in several queries by changing 'where('param', ':param')' to 'where('param = :param')' for proper parameter binding and query execution.

* Refactor Stats module to use Doctrine DBAL

* Refactor Custompages Service to use dbal instead of pdo

Replaced all direct PDO usage with dbal methods for database operations in the Custompages Service. This improves consistency, leverages dbal's abstraction, and prepares the codebase for better maintainability and future enhancements.

* Refactor DBAL usage and update test mocks

Refactored DBAL service definitions and query builder usage to improve clarity and consistency. Updated tests to use anonymous classes for DBAL and query builder mocks instead of PHPUnit mock objects, simplifying test setup and improving maintainability.

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

* Refactor DB queries to use executeQuery and executeStatement

Replaced manual PDO prepare/execute calls with Doctrine DBAL's executeQuery and executeStatement methods in UpdatePatcher and ApiRequestTable. This improves code consistency and leverages DBAL features for query execution and result fetching.

* Add input validation for DB charset, table, and column names

Introduces strict validation for supported database charsets in DriverManagerFactory, allowed column names in Custompages Service, and allowed table names in Stats Service to prevent invalid or unsafe input. Also updates UpdatePatcher with default values for new config keys and adjusts a Stats Service test to use a valid table name.

* Add 'CHARSETS' to cspell custom words list

* Refactor query execution in patcher and product domain

Updated query builder usage in UpdatePatcher and ProductDomainTable to separate query building from execution, aligning with best practices. Removed unused fetchOne stubs from ServiceTest to reflect these changes.

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

* Refactor `getProductSummary` to use Doctrine DBAL

* Fix parameter binding for category and hash in UpdatePatcher

Updated the insert statement in UpdatePatcher to bind the 'category' and 'hash' parameters explicitly, ensuring correct handling of null values during database insertion.

* Update MySQL charset handling in PDO setup

Removes redundant charset initialization statements for MySQL connections, relying on DBAL to handle connection charset via DSN. Now only sets the server default charset and session timeouts.

* Set default DB driver to `pdo_mysql` in `UpdatePatcher`

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-25 13:02:23 +00:00
Adam Daley 08a3919d96 Refactor Javascript and related API functions (#2725)
* chore: Remove jQuery dependencies and update build system

- Remove jQuery from theme dependencies
- Simplify build configuration
- Update documentation to reflect jQuery removal
- Apply PSR-12 code style formatting
- Replace jQuery with vanilla JS in ClientBalance adapter

* refactor: Complete JavaScript API rewrite with modern architecture

- Rewrite API.js with improved URL handling and CSRF management
- Add reusable utility functions in utils.js
- Remove deprecated jQuery-based bb object
- Update Tom Select integration

* feat: Add Twig API functions for declarative API interaction

- Add fb_api(), fb_api_form(), fb_api_link() Twig functions
- Add asset deduplication to prevent duplicate script/style loading

Note: Dashboard/Index module moved to separate refactor/index PR

* refactor: Integrate new API into theme layouts and core templates

- Update theme layouts to use new API functions
- Convert theme partials and macros
- Update core admin module templates (System, Theme, Wysiwyg, Staff)

* refactor: Update module templates to use new API functions

- Replace data-api-* attributes with fb_api_*() Twig functions
- Remove manual CSRF token handling
- Update all module templates for consistency

Note: Index module excluded (moved to refactor/index PR)

* Remove custom ignore rule from phpstan.neon

Deleted a specific ignore rule for ctype_alnum argument count in src/modules/Extension/Service.php, likely because it is no longer needed or the underlying issue has been resolved.
2026-01-14 19:10:24 +00:00
Copilotandadmdly 1d9193852d Fix lang attribute for i18n, remove duplicate toast container, and extract inline z-index (#3149)
* Fix lang attribute, toast container, and move z-index to CSS

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Add 'zindex' to cspell ignoreWords to fix spellcheck

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
2026-01-14 10:51:24 +00:00
8dc2d0f39b Migrate asset build system from Webpack Encore to esbuild (#3126)
* Migrate asset build system from Webpack Encore to esbuild

Replaces Symfony Webpack Encore with esbuild for frontend asset compilation. Updates documentation, removes related dependencies and config files, and adds esbuild configuration for themes. This modernizes the build process for improved speed and maintainability.

* Remove redundant comments and spinner from build scripts

Cleaned up code by removing unnecessary comments and the spinner utility from esbuild scripts in admin_default and huraga themes. Also simplified logic in API handler, currency entity, currency service, and profile client validator by removing redundant comments and streamlining null/empty checks.

* Add new terms to cspell custom dictionary

Added 'Spriter', 'spriter', 'dataurl', and 'tomselect' to the cspell custom words list to prevent false spelling errors for these terms.

* Potential fix for code scanning alert no. 422: Shell command built from environment values

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Potential fix for pull request finding 'Unused variable, import, function or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Potential fix for pull request finding 'Unused variable, import, function or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Potential fix for pull request finding 'Unused variable, import, function or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Refactor theme build to use custom SASS and PostCSS pipeline

Replaces direct SCSS imports in JS with a custom esbuild pipeline for both admin_default and huraga themes. Adds SASS and PostCSS (autoprefixer) processing via esbuild plugins, improves tilde (~) import resolution, and ensures CSS is post-processed and source maps are handled. This change modernizes and unifies the asset build process, making it more maintainable and extensible.

* Update sass import and flag-icons path in themes

Changed sass import to use namespace import in both admin_default and huraga esbuild.mjs files for consistency. Set $flag-icons-path in huraga _flags.scss to ensure correct path resolution for flag-icons assets.

* Refactor theme CSS build to use vendor bundles

Introduces separate vendor.css files for both admin_default and huraga themes, consolidating third-party CSS imports. Updates esbuild scripts to build and include these vendor bundles, removes tilde (~) importers, and adjusts SCSS to use CSS variables instead of direct SCSS variable imports. Twig templates are updated to load the new vendor.css files, and Huraga's theme variables are migrated to CSS custom properties for better maintainability.

* Update `package-lock.json` with new CKEditor 5 packages

Added and updated multiple @ckeditor/ckeditor5-* packages to version 47.3.0 and related dependencies. This change likely prepares the project for enhanced or new CKEditor 5 features and plugins.

* Refactor theme build scripts and add shared utils

Introduces a new `@fossbilling/frontend-build-utils` package with shared helpers and esbuild plugins for theme builds. Refactors admin_default and huraga esbuild scripts to use these utilities, improving maintainability and reducing code duplication. Removes unused `sprite.js` and updates asset handling. Updates workspace configuration in `package.json` and `package-lock.json`.

* Refactor theme asset build paths and add svg sprite helper

Migrates theme asset outputs to 'assets/build' directories for both admin_default and huraga themes, updating all references and build scripts accordingly. Adds a Twig function for inlining SVG sprites. Updates SQL defaults and patcher for new asset paths. Removes direct jQuery imports from theme JS entrypoints and uses an esbuild inject shim for global jQuery. Also includes minor CSS and manifest adjustments.

* Potential fix for pull request finding 'Unused variable, import, function or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Add PurgeCSS plugin and integrate with theme builds

Introduced a new PurgeCSS plugin in frontend-build-utils to remove unused CSS from bundled files. Updated package.json and package-lock.json to include PurgeCSS and its dependencies. Integrated the plugin into the esbuild scripts for admin_default and huraga themes to enable CSS purging in production builds.

* Set NODE_ENV=production for frontend build

Ensures the frontend assets are built with production optimizations by explicitly setting NODE_ENV=production during the build step in the release workflow.

* Fix static analysis warning in module directory scan

Updated the type check in the module directory scan to use a null coalescing operator, improving compatibility with static analysis tools like PHPStan.

* Update PHPStan baseline for ctype_alnum argument count

Added a new baseline entry to ignore an argument count warning for ctype_alnum in src/modules/Extension/Service.php.

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2025-12-30 09:40:04 +00:00
Adam Daley 407b43505d Add 'Servicemembership' to cspell dictionary (#3123)
Updated cspell.json to include 'Servicemembership' in the list of recognized words to prevent false spelling errors.
2025-12-27 22:53:27 +00:00
01612b9146 Dropped Paidsupport and Servicemembership (#3066)
* Dropped the "Paidsupport" module

* Patch to migrate existing orders and products to "custom"

* Dropped the "Servicemembership" module

* Update src/library/FOSSBilling/UpdatePatcher.php

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

* Update src/library/FOSSBilling/UpdatePatcher.php

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

* Improve PHPStan compatibility and static analysis

Added a PHPStan ignore pattern for polyfilled ctype function parameter count errors. Updated Extension Service to explicitly check variable type before calling ctype_alnum, aiding static analysis tools like PHPStan.

* Remove polyfill-php72 and update dependencies

Removed 'symfony/polyfill-php72' from composer.json replace section. Updated composer.lock with new versions of league/csv, php-debugbar/php-debugbar, phpunit/php-code-coverage, and rector/rector.

* Update `last_patch` setting to version 47

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

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-27 22:42:37 +00:00
Yağızhan Burak Yakar 74f9c4d584 Dropped Cypress tests (#3063)
* Dropped Cypress tests

* Removed accidental comma
2025-11-23 00:29:36 -08:00
e85b1eeff9 Update SpamChecker to be able to use Cloudflare Turnstile and hCaptcha (#3004)
* Do not include local dev database, which is used for debugging

* Revert of ceddc35aa7

* Add turnstile to config and a selector of providers

* Add turnstile's logic

* add turnstile variables to the API

* add turnstile to the macro and html_client

* Add hCaptcha

* Update src/modules/Spamchecker/Service.php

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

* Update src/modules/Spamchecker/Service.php

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

* Update src/modules/Spamchecker/Service.php

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

* Update src/modules/Spamchecker/html_admin/mod_spamchecker_settings.html.twig

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

* Fix bugs

* Fix space consistency in Guest.php

* Apply suggestion from @Copilot

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

* Fix macros

* Add link to hcaptcha's website

* Add and fix unit tests for the Spamchecker

* Fix cspell

* Reverse the "recaptcha_private/publickey" to "captcha_recaptcha_private/publickey"

* Apply suggestion from @Copilot

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

* Apply suggestion from @Copilot

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

* Update cspell.json with new terms and ignore paths

* Update src/modules/Spamchecker/html_client/mod_spamchecker_recaptcha.html.twig

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

* Update tests-legacy/modules/Spamchecker/Api/GuestTest.php

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

* Update tests-legacy/modules/Spamchecker/Api/GuestTest.php

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

* Update tests-legacy/modules/Spamchecker/Api/GuestTest.php

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

* Update tests-legacy/modules/Spamchecker/Api/GuestTest.php

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

* Update tests-legacy/modules/Spamchecker/Api/GuestTest.php

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

* Update tests-legacy/modules/Spamchecker/Api/GuestTest.php

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

* Update src/modules/Spamchecker/Service.php

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

* Fix array formatting in GuestTest

* Update tests-legacy/modules/Spamchecker/Api/GuestTest.php

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

* Update src/modules/Spamchecker/Service.php

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

* Update src/modules/Spamchecker/Service.php

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

* Update src/modules/Spamchecker/html_admin/mod_spamchecker_settings.html.twig

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

* Update src/modules/Spamchecker/Service.php

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

* Update src/modules/Spamchecker/Service.php

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

* Update src/modules/Spamchecker/Service.php

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

* Apply suggestion from @Copilot

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

* Rewrite toggleProviderSettings in vanilla JS

* Remove useless comment

* Update src/modules/Spamchecker/html_admin/mod_spamchecker_settings.html.twig

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2025-11-06 17:50:14 +00:00
Adam Daley bb9fd8c131 Revise README for clarity and feature emphasis (#3002)
* Revise README for clarity and feature emphasis

Update `README.md` to enhance visibility of key features and use cases, and reorganise sections for clarity.

* Revise README for clarity and structure
2025-11-02 10:16:11 -08:00
YağızhanandAdam Daley 06d2746017 Initial Doctrine setup and News rewrite (#2915)
* +Initial Doctrine EntityManager setup

* Doctrine support for Pagination

* Removed doctrine/migrations. Won't be using that yet.

* Reworked the News module using Doctrine

* Strict types

* A couple of fixes

* Add 'ONLYDIR' to cspell.json dictionary

* Removed the old Post model

* Typing

* Dev mode support

* +TimestampableInterface

* +Proxy settings

* Add missing `datetime` fields to `Post` entity

* Update Guest.php

* Add `doctrine/orm` and related dependencies

* Add Symfony serializer, property-access, and property-info

* Update Service.php

* Update cspell.json

* Adam's suggestions

* Update AGENTS.md to include Doctrine directives

* Reuse the post content

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2025-10-09 15:58:31 +03:00
Adam Daley f8a4078d7f Update GOVERNANCE.md (#2940) 2025-10-06 12:44:20 +01:00
Adam Daley dc84794645 Update Code of Conduct (#2933)
* Update Code of Conduct

Update Code of Conduct to latest Contributor Covenant Code of Conduct (3.0).

* Add 'cooldown' to cspell custom words list

Updated cspell.json to include 'cooldown' in the list of recognized words to prevent false spelling errors.

* Move `CODE_OF_CONDUCT.md` to `.github` directory

* Update Contributor Covenant badge in README

* Update Code of Conduct

Update Code of Conduct to latest Contributor Covenant Code of Conduct (3.0).

* Add 'cooldown' to cspell custom words list

Updated cspell.json to include 'cooldown' in the list of recognized words to prevent false spelling errors.

* Move `CODE_OF_CONDUCT.md` to `.github` directory

* Update Contributor Covenant badge in README

* Fix Code of Conduct link in `CONTRIBUTING.md`
2025-10-05 02:21:42 +01:00
Adam Daley a2054b87df Add AGENTS.md and introduce gemini-cli specific settings (#2880) 2025-08-27 17:55:34 +01:00
Adam Daley 312a66873b Add filp to cspell ignore list (#2776) 2025-06-05 12:47:16 +01: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
Belle Aerni 672c96cd5f Slightly improve session fingerprinting (#2560)
* Slightly improve session fingerprinting

* Spelling
2025-01-20 16:07:15 -08:00
Belle Aerni b35d902a6a Security dashboard & checks (#2503)
* Started implimenting a security dashboard and checks

* Wrote two functional checks

* Fix typos

* Update webserver.php

* + a new check

* Slight cleanup, made translatable

* Added some general checks

* Update cspell.json

* Typo

* Slight tweaks, add a permission to run checks
2025-01-08 10:52:07 +00: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 a5d15c2a99 Upgrade GeoIP functionality & replace the databases (#2471)
* Replaced Maxmind's IP database

* Began rebuilding GeoIP reader functionality

The GeoIP2 package does not worth with DB's that aren't built by maxmind themselves, making it rather unhelpful for us.

Since my long-term goal is for someone to be able to bring in their own DB, making a custom implementation seems like the reasonable choice.

(Plus my aim is already to replace the MaxMind DB due to it's licencing)

* Created an IP address lookup page

* + ASN info

* Bump last patch

* Make PHPStan happy

* Very minor refactor + PHPDocs
2024-10-31 19:31:50 +01:00
Adam Daley 4f5b0872c3 Update cspell.json (#2330)
* Update cspell.json

* Fix `system:releasenotes` command description
2024-07-03 05:20:11 +01:00
Adam Daley c0cc400b9d Fix Live Tests (#2325)
* Refactor `getExternalIP()` to use `RetryableHttpClient`

Refactor `FOSSBilling\Tools` `getExternalIP()` function to use `RetryableHttpClient`.

* Fix incorrect parameter names and add cURL timeout

* Disable Network Interface live-tests
2024-07-02 21:20:10 +01:00
Belle Aerni 8ac5b00fe9 Misc fixes + product configuration page improvements (#2292)
* Fixed our Rector config. Closes #2272

* Much improved the product configuration page

Fixed a bug and significantly improved the visuals for that page

* Place the period text after the cost

Closes #2242

* Misc changes

* Slightly shrunk the addon buttons, updated cspell
2024-06-04 21:30:59 -07:00
fc67657d6c Add an item quantity option when creating invoices (#2284)
* Resolves https://github.com/FOSSBilling/FOSSBilling/issues/2283

* Update cspell.json

---------

Co-authored-by: Devadatta Sahoo <webmaster@nettantra.com>
Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2024-06-04 14:30:34 -07:00
Belle Aerni b6686e7139 Significantly improve exchange rate functionality (#2189)
* Redid the currency rate provider UI

* Bug fix, implemented the syncing functionality

* Changes for CSpell

* This should fix the test

* Updated the UI / wording, added the data attribution

* Small tweaks

* Fix the cache key I duplicated

* Very small fixes

* Also ensure we reference the old key when syncing

Otherwise the next update would unexpectedly break this for people because their old config wouldn't apply anymore

* Slight UI improvement

* Fix accidental capitalization
2024-03-21 08:41:35 -07:00
Belle Aerni 7dbd3ea7d3 Added proper TLD validation (#2146)
* Added proper TLD validation

* Bug fix

* Remove the test that broke.. It doesn't really test anything

* Reduce the cache length if our final validation fails

* Switched to a different list

* Update cspell.json

* Small fix

* And another one, whoops
2024-02-17 16:56:50 -08:00
Belle Aerni 0493c3a3e5 Further test improvements (#2122)
* Slight structure change to the testcases

* Fix

* Ported some random low-level tests

* Spelling

* Ported over some other low-level tests

* Fixes

* And now other fixes

* Another one
2024-02-06 13:13:04 -08:00
Belle Aerni 8f4d0d4cac More tests and CI improvements (#2078)
* Wrote a few more tests, improvements

* Ran Rector & PHP-CS-Fixer

* Append a capital letter to the test client passwords

* Minor tweaks

* Display more info after the tests run

* Oops, I forgot to set the dir

* Fix cron behavior for test env, dropped legacy tests

* Rename the empty test suite so PHPUnit ignores it

* Update cspell.json

* Minor tweaks to the tests

* Fixes
2024-01-17 18:11:45 -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 1b0fba1922 Various additional tests (#2069)
* Various additional tests

* Fixes

* More fixes

* Fixed my other mistakes

* Final fix
2024-01-15 00:46:19 -08:00
Belle Aerni ccc97a3ec9 Initial implementation of CI against a live FOSSBilling Install (#2067)
* Rename tests to tests-legacy

* Groundwork for live tests

* Somewhat working tests on a live instance

* Hmmmmmm

* Fix

* Fixed the other bug

* Added a handful of various tests

* Typos, all these are admin endpoints

* Bypass this check for testing envs

* Disable it for now

* Mini cleanup

* Cleanup from debugging, ran PHP-CS-Fixer
2024-01-14 22:51:32 -08:00
Belle Aerni c054d6e2fa Added a basic blacklist for error reporting (#2032)
* Introduce a blacklist system for error reporting

* Spelling
2024-01-05 17:08:47 +00:00
Belle Aerni 713db7c9d0 Two 0.6.0 hotfixes (#1955)
* Restore missing JS for the currency selector

* Fixed the addons template for BS 5

* Actually make those a bit smaller

* Update cspell.json
2023-12-11 18:19:05 -08:00
Adam Daleyandrenovate[bot] 2a14679d2e Move Docker file and add automated Docker builds (#1916)
* Rework reusable workflows to use composite actions (#1918)

* Update FOSSBilling/.workflows digest to 5c7b960

* Update dependency apexcharts to v3.44.2

* Update CKEditor to v39.3.0 (minor) (#1931)

Update CKEditor to v39.3.0

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency core-js to v3.34.0 (#1932)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency cypress to v13.6.1

* Update dependency flag-icons to v7.0.3

* Update dependency phpunit/phpunit to v10.5.2

* Bump lcharette/webpack-encore-twig to v1.2 (#1933)

Bump lcharette/webpack-encore-twig

Bump lcharette/webpack-encore-twig to ^1.2 and remove symfony/webpack-encore-bundle override as now fixed upstream.

* Move Dockerfile from Docker repo

* Add Docker preview build and push to CI

* Add workflow to build and tag Docker builds on release

* Update workflow to build and tag Docker builds on release

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-07 17:29:45 +00:00
51cbebda71 Migrate Huraga and all client templates to bootstrap 5 (#1602)
* Begin migration from BS 3.4.1 to BS 4

This is still entirely untested, I just read the docs and made some quick changes to follow it. Now I need to actually dig in and fix what was broken by this.

This is going to be the most painful upgrade path as BS 4 basically rewrote everything

* Started porting Huraga over to bootstrap

* Fix public dashboard for guests

* Minor fix for a long-standing issue

Resolves #412

* Fix the breadcrumb placement

* Migrate the client balance page

* Migrate the order list template

* Migrated the news pages

* Fix & improve breadcrumbs

* Remove outdated options, update showcase

* Migrated the KB pages

* Removed the company name from the header

* Remove the order popup menu

The way it's done is ugly and I don't like it, so instead let's just have those buttons take you to the actual order page

* Migrate the error page

* Fix the mobile layout, make the menu work

This makes it actually functional on mobile, although the nav menu is hideous and needs more work

* Migrate the Invoice templates

* Replace old usage of bb-btn

* Migrate the profile page

* Improve invoice

* Migrated a bunch of templates

The order management screen needs work to make it usable, but the layout is done and functional

* Improved usability on small devices + nav fixes

* Migrated login, signup, and PW reset templates

* TOS, Privacy Policy, & About + made them full-page

* Migrated support related templates

* Completed order management page

* Mobile usability improvements

* Remove outdated table logic

* Enhance Huraga with Bootstrap 5 Support and Design Improvements (#1612)

* setup package json

* set encore and postcss config

* add Huraga sass and js

* partially bring in legacy Huraga design in BS5

* improve design

* replace f16 flag icons with flag-icons

* add more order status badge

* add breadcrumb and replace card design for footer pages

* improve card text color

* improve invoices index

* improve footer link color

* add failed_renew badge

* change paid invoice button color

* apply muted text color to whole footer texts

* replace bs colors with tailwind

* improve payment history and replace it with Wallet

* replace layout nav icons with MDI svg

* remove icon and rename ticket modal title

* improve order page design

* replace iframe with twig include and improve accordion

* fix tabs and improve account form

* remove accordion chevron icon

* add mistakenly removed postcode

* use tom-select for language selector

* fix the product config tabs and improve form

* improve order form

* fix and improve news module design

* improve and fix tabs of profile page

* fix spacing on card header

* improve public page design

* Improve emails card

* use API.js to login

* improve public pages by replacing jquery and bb-jquery

* improve contact us page and fix minor spacing

* improve Cookieconsent design

* minor improvements to auth error message

* fix toast message for funds form

* improve custom page card

* Improve Kb, servicedomain and orderbutton modules

* fix ticket modal submission

* improve Invoice page

* minor fixes

* Replace Google Font with local font for Inter

* Fix ticket modal

* add offcanvas and describedby

* fix service ticket modals

* set github markdown for support ticket conversation

* minor improvements to order and servicehosting

* improve error page design

* add flashMessage method

* Improve emails module

* hide warning on empty api key

* more improvements to Emails

* remove stripes from services table

* add BS5 support for pagination

* improve emails pagination

* place asterisk using js (Firefox does not support :has())

* add auth class for asterisk to be ignored

* Updated the npm lockfile, replaced BB_URL references

* Ported back some changes

* Use web-safe fonts (Verdana)

* Some adjustments

* Resolve issues after recent merger of KB and support

* Reviewed the BS 5 migration guide

* Remove the "proforma" labeling

AFAIK the old behavior was never truly proforma, but things have been changed since then anyways so now it's definitely not

* Bug fixes and removed unused deps

* Bug fixes

* Revised the KB article template

* Further improvements & fixes. New default config

* Update settings_data.json.example

* Fix: emails can change the page layout / styling

This was a PITA, but I got it to (mostly) work quite well.
The full list does as it should, but the individual email page didn't work correctly with the autosizing so that's just hardcoded in size.

I don't think most will use that page over the complete list, but even if they do an an email is too long a scroll bar will be visible so it's good enough till we find a better solution

* Spelling

* Ignore iframes for spelling

* Fix the checkout process

* Improved table consistency

* Migrated the new password reset template

* A create account button doesn't make sense there..

* QC: Replaced unnecessary custom JS code

* Fixed a grammatical error

Fix originates from PR #1868

Co-Authored-By: Duncan Bennie <33364216+DuncanBennie@users.noreply.github.com>

* Addressed feedback and suggestions

---------

Co-authored-by: Shamshid <shmshd12@gmail.com>
Co-authored-by: Duncan Bennie <33364216+DuncanBennie@users.noreply.github.com>
2023-11-24 12:28:43 -08:00
Belle Aerni cd002b4729 Rebuilt the requirements class (#1858)
* Rebuilt the requirements class

* Update cspell.json
2023-11-22 15:05:50 +03:00
Belle AerniandYağızhan 865b0b6159 Implemented PHP DebugBar (#1825)
* Brought in the debugbar extension

Co-Authored-By: Yağızhan <hi@yagiz.dev>

* Completely restructured

Redid the previous work to allow us to pass around a single instance of the debug bar, allowing us to leverage more types of data collection.

* Added some more time measurements

* Enabled HTML var dumper, added config collector

* Fix

---------

Co-authored-by: Yağızhan <hi@yagiz.dev>
2023-11-16 23:21:14 +00:00
Belle Aerni 63b1e66caf Massmailer bugfixes & improvements (#1817)
* Prevent Massmailer from duplicating recipients

* Minor optimization

We don't need this info as it's actually fetched in a later step. All we need from this step is the ID of each client

* Further optimize using the DISTINCT SQL query option

Thanks to @evrifaessa for pointing out this is an option.
Should be more efficient to let the SQL engine do the worth rather than doing it via PHP

* Further optimization, fixed filter selection in the UI

* Added the ability to see the list of recipients

* Update cspell.json
2023-11-13 10:42:23 +01:00
Belle Aerni 50cc54ed4e Improved email validation & spam prevention (#1806)
* Improved email validation

* Fixed spelling & PHPDoc, updated module description

* Removed accidental leftovers from debugging

* Rremoved PHP 81 pollyfil, assume email valid if there's an error
2023-11-11 21:44:08 +02: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 b8d3d35ad2 Significantly improve translation management (#1661)
* Started work on locale disable / enable functionality

* Implemented enable / disable functionality

* Implemented completion bar

* Update the preview workflow to use locale releases

* Fix typos, correct workflow

* Use the latest translation release

* Fix tests

* Fixed typo, removed crappy instructions

* fkn spelling
2023-09-30 22:19:15 +03:00
f2f9701359 Mark as paid now adds funds if the Payment Provider is "Custom". (#1487)
* When you press the "Mark as paid" Button on the invoice, you can now enter a transaction id.
If the Payment gateway of the Invoice is "Custom" and it's enabled, the transaction ID will be used to add transactions that add funds in the amount of the invoice to the customer. Then, it will be marked as paid, just like with any other payment provider.

* Added processTransaction method to the Custom Payment Gateway.
* Fixed tests by removing unnecessary tests for Payment Adapters that don't have the processTransaction method.


---------

Co-authored-by: Christoph Schläpfer <chris+github@cleverly.ch>
Co-authored-by: Belle Aerni <belleaerni@gmail.com>
Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
2023-09-28 13:14:06 +02:00
Belle Aerni 1881ff7bfb Bump PHPStan analysis level (#1641)
* Bump PHPStan to level 2
2023-09-28 09:06:58 +02:00
Christoph Schläpfer e96828b52a Cleanup & Spelling 2023-09-27 12:32:48 +02:00
Christoph Schläpfer fbc303a42a If accessing invoices via hash is disabled, logged in clients will be redirected to their invoice page if they are not the buyer on the invoice they are trying to view. 2023-09-27 12:25:38 +02:00
3ee7f29689 Reworked Password-Reset flow (#1627)
* Reworked Password-Reset flow
- No more Passwords sent via E-Mail
- Correct redirects.

* Fixed spelling & last redirect

* Small fixes and updated tests for pw-reset-flow

* Fixed tests for pw-reset-flow

* Fixed tests for the Password reset flow

* Fixed typos, resolved Feedback

* Renamed event before password reset

* Renamed event after password reset

* Tweak a few comments, send the reset email instantly

---------

Co-authored-by: Christoph Schläpfer <c.schlaepfer@datact.ch>
Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-09-22 18:15:18 -07:00
Belle Aerni 997fad4699 Improve .htaccess rules & prevent access to PHP files (#1522)
* Prevent browser access to cron and other files

* Prevent access to PHP files + enhanced htaccess

* Remove browser related stuff from cron.php

* Added the .htaccess file to our cspell ignore list
2023-08-08 14:26:39 +02:00