fixed tags and added phginx

This commit is contained in:
2026-09-21 11:22:45 +02:00
parent 9241e177ac
commit 624d94742a
5 changed files with 870 additions and 45 deletions
+2 -1
View File
@@ -54,10 +54,11 @@
"barryvdh/laravel-ide-helper": "^2.8", "barryvdh/laravel-ide-helper": "^2.8",
"brianium/paratest": "^7.1", "brianium/paratest": "^7.1",
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0",
"mockery/mockery": "^1.4.4", "mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0", "nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0", "phpunit/phpunit": "^10.0",
"laravel/sail": "^1.0", "robmorgan/phinx": "^0.16.12",
"spatie/laravel-ignition": "^2.0" "spatie/laravel-ignition": "^2.0"
}, },
"autoload": { "autoload": {
Generated
+752 -2
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "36e0265c4d1a5422d60fbaef9b95eb98", "content-hash": "32b2751ff3f31f7f8d63c265a0b8f5dd",
"packages": [ "packages": [
{ {
"name": "akaunting/laravel-setting", "name": "akaunting/laravel-setting",
@@ -7088,6 +7088,388 @@
], ],
"time": "2023-03-13T10:11:07+00:00" "time": "2023-03-13T10:11:07+00:00"
}, },
{
"name": "cakephp/chronos",
"version": "3.5.1",
"source": {
"type": "git",
"url": "https://github.com/cakephp/chronos.git",
"reference": "00c16f165a762226d58f9cf88f43e54e41093f84"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/chronos/zipball/00c16f165a762226d58f9cf88f43e54e41093f84",
"reference": "00c16f165a762226d58f9cf88f43e54e41093f84",
"shasum": ""
},
"require": {
"php": ">=8.1",
"psr/clock": "^1.0"
},
"provide": {
"psr/clock-implementation": "1.0"
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^5.0",
"phpunit/phpunit": "^10.5.58 || ^11.5.3 || ^12.1.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Cake\\Chronos\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brian Nesbitt",
"email": "brian@nesbot.com",
"homepage": "http://nesbot.com"
},
{
"name": "The CakePHP Team",
"homepage": "https://cakephp.org"
}
],
"description": "A simple API extension for DateTime.",
"homepage": "https://cakephp.org",
"keywords": [
"date",
"datetime",
"time"
],
"support": {
"issues": "https://github.com/cakephp/chronos/issues",
"source": "https://github.com/cakephp/chronos"
},
"time": "2026-09-06T02:30:12+00:00"
},
{
"name": "cakephp/core",
"version": "5.4.2",
"source": {
"type": "git",
"url": "https://github.com/cakephp/core.git",
"reference": "55c9f6ec8a11f6c946cad5bc6e8da18d6d98ae06"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/core/zipball/55c9f6ec8a11f6c946cad5bc6e8da18d6d98ae06",
"reference": "55c9f6ec8a11f6c946cad5bc6e8da18d6d98ae06",
"shasum": ""
},
"require": {
"cakephp/utility": "^5.4.0",
"league/container": "^5.1",
"php": ">=8.2",
"psr/container": "^1.1 || ^2.0"
},
"provide": {
"psr/container-implementation": "^2.0"
},
"suggest": {
"cakephp/cache": "To use Configure::store() and restore().",
"cakephp/event": "To use PluginApplicationInterface or plugin applications.",
"league/container": "To use Container and ServiceProvider classes"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-5.next": "5.5.x-dev"
}
},
"autoload": {
"files": [
"functions.php"
],
"psr-4": {
"Cake\\Core\\": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/core/graphs/contributors"
}
],
"description": "CakePHP Framework Core classes",
"homepage": "https://cakephp.org",
"keywords": [
"cakephp",
"core",
"framework"
],
"support": {
"forum": "https://stackoverflow.com/tags/cakephp",
"irc": "irc://irc.freenode.org/cakephp",
"issues": "https://github.com/cakephp/cakephp/issues",
"source": "https://github.com/cakephp/core"
},
"time": "2026-08-24T11:32:41+00:00"
},
{
"name": "cakephp/database",
"version": "5.4.2",
"source": {
"type": "git",
"url": "https://github.com/cakephp/database.git",
"reference": "91cf7b16e9ebe0050c64db0f4634ac4a76782564"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/database/zipball/91cf7b16e9ebe0050c64db0f4634ac4a76782564",
"reference": "91cf7b16e9ebe0050c64db0f4634ac4a76782564",
"shasum": ""
},
"require": {
"cakephp/chronos": "^3.3",
"cakephp/core": "^5.4.0",
"cakephp/datasource": "^5.4.0",
"cakephp/event": "^5.4.0",
"php": ">=8.2",
"psr/log": "^3.0"
},
"require-dev": {
"cakephp/i18n": "^5.4.0",
"cakephp/log": "^5.4.0",
"cakephp/utility": "^5.4.0"
},
"suggest": {
"cakephp/i18n": "If you are using locale-aware datetime formats.",
"cakephp/log": "If you want to use query logging without providing a logger yourself.",
"cakephp/utility": "If you want to use EnumLabelTrait."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-5.next": "5.5.x-dev"
}
},
"autoload": {
"psr-4": {
"Cake\\Database\\": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/database/graphs/contributors"
}
],
"description": "Flexible and powerful Database abstraction library with a familiar PDO-like API",
"homepage": "https://cakephp.org",
"keywords": [
"abstraction",
"cakephp",
"database",
"database abstraction",
"pdo"
],
"support": {
"forum": "https://stackoverflow.com/tags/cakephp",
"irc": "irc://irc.freenode.org/cakephp",
"issues": "https://github.com/cakephp/cakephp/issues",
"source": "https://github.com/cakephp/database"
},
"time": "2026-08-28T06:30:11+00:00"
},
{
"name": "cakephp/datasource",
"version": "5.4.2",
"source": {
"type": "git",
"url": "https://github.com/cakephp/datasource.git",
"reference": "cec80f34828d4aeaf24f75097055cd1466e1aec7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/datasource/zipball/cec80f34828d4aeaf24f75097055cd1466e1aec7",
"reference": "cec80f34828d4aeaf24f75097055cd1466e1aec7",
"shasum": ""
},
"require": {
"cakephp/core": "^5.4.0",
"php": ">=8.2",
"psr/simple-cache": "^2.0 || ^3.0"
},
"require-dev": {
"cakephp/cache": "^5.4.0",
"cakephp/collection": "^5.4.0",
"cakephp/utility": "^5.4.0"
},
"suggest": {
"cakephp/cache": "If you decide to use Query caching.",
"cakephp/collection": "If you decide to use ResultSetInterface.",
"cakephp/utility": "If you decide to use EntityTrait."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-5.next": "5.5.x-dev"
}
},
"autoload": {
"psr-4": {
"Cake\\Datasource\\": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/datasource/graphs/contributors"
}
],
"description": "Provides connection managing and traits for Entities and Queries that can be reused for different datastores",
"homepage": "https://cakephp.org",
"keywords": [
"cakephp",
"connection management",
"datasource",
"entity",
"query"
],
"support": {
"forum": "https://stackoverflow.com/tags/cakephp",
"irc": "irc://irc.freenode.org/cakephp",
"issues": "https://github.com/cakephp/cakephp/issues",
"source": "https://github.com/cakephp/datasource"
},
"time": "2026-08-24T11:32:41+00:00"
},
{
"name": "cakephp/event",
"version": "5.4.2",
"source": {
"type": "git",
"url": "https://github.com/cakephp/event.git",
"reference": "28e2797bda517cbac7fa683415f7bbc2774de103"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/event/zipball/28e2797bda517cbac7fa683415f7bbc2774de103",
"reference": "28e2797bda517cbac7fa683415f7bbc2774de103",
"shasum": ""
},
"require": {
"cakephp/core": "^5.4.0",
"php": ">=8.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-5.next": "5.5.x-dev"
}
},
"autoload": {
"psr-4": {
"Cake\\Event\\": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/event/graphs/contributors"
}
],
"description": "CakePHP event dispatcher library that helps implementing the observer pattern",
"homepage": "https://cakephp.org",
"keywords": [
"cakephp",
"dispatcher",
"event",
"observer pattern"
],
"support": {
"forum": "https://stackoverflow.com/tags/cakephp",
"irc": "irc://irc.freenode.org/cakephp",
"issues": "https://github.com/cakephp/cakephp/issues",
"source": "https://github.com/cakephp/event"
},
"time": "2026-08-24T11:32:41+00:00"
},
{
"name": "cakephp/utility",
"version": "5.4.2",
"source": {
"type": "git",
"url": "https://github.com/cakephp/utility.git",
"reference": "98376e5bbcdd84fdda6d6c4207ef6111fc5aed23"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/utility/zipball/98376e5bbcdd84fdda6d6c4207ef6111fc5aed23",
"reference": "98376e5bbcdd84fdda6d6c4207ef6111fc5aed23",
"shasum": ""
},
"require": {
"cakephp/core": "^5.4.0",
"php": ">=8.2"
},
"suggest": {
"ext-intl": "To use Text::transliterate() or Text::slug()",
"lib-ICU": "To use Text::transliterate() or Text::slug()"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-5.next": "5.5.x-dev"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Cake\\Utility\\": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/utility/graphs/contributors"
}
],
"description": "CakePHP Utility classes such as Inflector, String, Hash, and Security",
"homepage": "https://cakephp.org",
"keywords": [
"cakephp",
"hash",
"inflector",
"security",
"string",
"utility"
],
"support": {
"forum": "https://stackoverflow.com/tags/cakephp",
"irc": "irc://irc.freenode.org/cakephp",
"issues": "https://github.com/cakephp/cakephp/issues",
"source": "https://github.com/cakephp/utility"
},
"time": "2026-08-24T11:32:41+00:00"
},
{ {
"name": "composer/class-map-generator", "name": "composer/class-map-generator",
"version": "1.0.0", "version": "1.0.0",
@@ -7946,6 +8328,90 @@
}, },
"time": "2023-03-06T14:23:15+00:00" "time": "2023-03-06T14:23:15+00:00"
}, },
{
"name": "league/container",
"version": "5.2.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/container.git",
"reference": "58accbc032f0090a9bd08326f93062c5a658b2c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/container/zipball/58accbc032f0090a9bd08326f93062c5a658b2c5",
"reference": "58accbc032f0090a9bd08326f93062c5a658b2c5",
"shasum": ""
},
"require": {
"php": "^8.1",
"psr/container": "^2.0.2",
"psr/event-dispatcher": "^1.0"
},
"provide": {
"psr/container-implementation": "^1.0"
},
"replace": {
"orno/di": "~2.0"
},
"require-dev": {
"nette/php-generator": "^4.1",
"nikic/php-parser": "^5.0",
"phpstan/phpstan": "^2.1.11",
"phpunit/phpunit": "^10.5.45|^11.5.15|^12.0",
"roave/security-advisories": "dev-latest",
"scrutinizer/ocular": "^1.9",
"squizlabs/php_codesniffer": "^3.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-1.x": "1.x-dev",
"dev-2.x": "2.x-dev",
"dev-3.x": "3.x-dev",
"dev-4.x": "4.x-dev",
"dev-5.x": "5.x-dev",
"dev-master": "5.x-dev"
}
},
"autoload": {
"psr-4": {
"League\\Container\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Phil Bennett",
"email": "mail@philbennett.co.uk",
"role": "Developer"
}
],
"description": "A fast and intuitive dependency injection container.",
"homepage": "https://github.com/thephpleague/container",
"keywords": [
"container",
"dependency",
"di",
"injection",
"league",
"provider",
"service"
],
"support": {
"issues": "https://github.com/thephpleague/container/issues",
"source": "https://github.com/thephpleague/container/tree/5.2.0"
},
"funding": [
{
"url": "https://github.com/philipobenito",
"type": "github"
}
],
"time": "2026-03-19T18:52:39+00:00"
},
{ {
"name": "maximebf/debugbar", "name": "maximebf/debugbar",
"version": "v1.18.2", "version": "v1.18.2",
@@ -8925,6 +9391,141 @@
}, },
"time": "2021-02-03T23:26:27+00:00" "time": "2021-02-03T23:26:27+00:00"
}, },
{
"name": "psr/clock",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/clock.git",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Psr\\Clock\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for reading the clock.",
"homepage": "https://github.com/php-fig/clock",
"keywords": [
"clock",
"now",
"psr",
"psr-20",
"time"
],
"support": {
"issues": "https://github.com/php-fig/clock/issues",
"source": "https://github.com/php-fig/clock/tree/1.0.0"
},
"time": "2022-11-25T14:36:26+00:00"
},
{
"name": "robmorgan/phinx",
"version": "0.16.12",
"source": {
"type": "git",
"url": "https://github.com/cakephp/phinx.git",
"reference": "1cce44387a9146dc04c312e6a231b17fb30385cd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/phinx/zipball/1cce44387a9146dc04c312e6a231b17fb30385cd",
"reference": "1cce44387a9146dc04c312e6a231b17fb30385cd",
"shasum": ""
},
"require": {
"cakephp/database": "^5.0.2",
"composer-runtime-api": "^2.0",
"php-64bit": ">=8.1",
"psr/container": "^1.1|^2.0",
"symfony/config": "^4.0|^5.0|^6.0|^7.0|^8.0",
"symfony/console": "^6.0|^7.0|^8.0"
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^5.0",
"cakephp/i18n": "^5.0",
"ext-json": "*",
"ext-pdo": "*",
"phpunit/phpunit": "^10.5",
"symfony/yaml": "^4.0|^5.0|^6.0|^7.0|^8.0"
},
"suggest": {
"ext-json": "Install if using JSON configuration format",
"ext-pdo": "PDO extension is needed",
"symfony/yaml": "Install if using YAML configuration format"
},
"bin": [
"bin/phinx"
],
"type": "library",
"autoload": {
"psr-4": {
"Phinx\\": "src/Phinx/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rob Morgan",
"email": "robbym@gmail.com",
"homepage": "https://robmorgan.id.au",
"role": "Lead Developer"
},
{
"name": "Woody Gilk",
"email": "woody.gilk@gmail.com",
"homepage": "https://shadowhand.me",
"role": "Developer"
},
{
"name": "Richard Quadling",
"email": "rquadling@gmail.com",
"role": "Developer"
},
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/phinx/graphs/contributors",
"role": "Developer"
}
],
"description": "Phinx makes it ridiculously easy to manage the database migrations for your PHP app.",
"homepage": "https://phinx.org",
"keywords": [
"database",
"database migrations",
"db",
"migrations",
"phinx"
],
"support": {
"issues": "https://github.com/cakephp/phinx/issues",
"source": "https://github.com/cakephp/phinx/tree/0.16.12"
},
"time": "2026-07-03T07:27:17+00:00"
},
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
"version": "2.0.0", "version": "2.0.0",
@@ -10127,6 +10728,155 @@
], ],
"time": "2023-01-24T07:20:39+00:00" "time": "2023-01-24T07:20:39+00:00"
}, },
{
"name": "symfony/config",
"version": "v6.4.44",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
"reference": "6a5abf67fd5b138df96984fe6f8fd736fb7d6b29"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/6a5abf67fd5b138df96984fe6f8fd736fb7d6b29",
"reference": "6a5abf67fd5b138df96984fe6f8fd736fb7d6b29",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/filesystem": "^5.4|^6.0|^7.0",
"symfony/polyfill-ctype": "~1.8"
},
"conflict": {
"symfony/finder": "<5.4",
"symfony/service-contracts": "<2.5"
},
"require-dev": {
"symfony/event-dispatcher": "^5.4|^6.0|^7.0",
"symfony/finder": "^5.4|^6.0|^7.0",
"symfony/messenger": "^5.4|^6.0|^7.0",
"symfony/service-contracts": "^2.5|^3",
"symfony/yaml": "^5.4|^6.0|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Config\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Helps you find, load, combine, autofill and validate configuration values of any kind",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/config/tree/v6.4.44"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-08-20T09:38:57+00:00"
},
{
"name": "symfony/filesystem",
"version": "v7.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "90d412aa5277c6819db39e7605aa46b1019e3232"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/90d412aa5277c6819db39e7605aa46b1019e3232",
"reference": "90d412aa5277c6819db39e7605aa46b1019e3232",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.8"
},
"require-dev": {
"symfony/process": "^6.4|^7.0|^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v7.4.18"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-08-23T10:03:40+00:00"
},
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v6.2.7", "version": "v6.2.7",
@@ -10263,6 +11013,6 @@
"php": "^8.1.0", "php": "^8.1.0",
"ext-json": "*" "ext-json": "*"
}, },
"platform-dev": [], "platform-dev": {},
"plugin-api-version": "2.6.0" "plugin-api-version": "2.6.0"
} }
+42
View File
@@ -0,0 +1,42 @@
<?php
// Carica le variabili dal .env (stessa fonte della webapp)
$root = __DIR__;
if (file_exists($root . '/vendor/autoload.php')) {
require_once $root . '/vendor/autoload.php';
}
if (class_exists(\Dotenv\Dotenv::class)) {
$dotenv = \Dotenv\Dotenv::createImmutable($root);
$dotenv->safeLoad(); // safeLoad: non lancia errori se manca il .env
}
// Helper: legge da $_ENV, getenv() o usa un default
$env = function (string $key, $default = null) {
$v = $_ENV[$key] ?? getenv($key);
if ($v === false || $v === null) {
return $default;
}
// toglie eventuali virgolette attorno al valore
return trim($v, "\"'");
};
return [
'paths' => [
'migrations' => __DIR__ . '/db/migrations',
'seeds' => __DIR__ . '/db/seeds',
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_environment' => 'development',
'development' => [
'adapter' => $env('DB_CONNECTION', 'mysql'),
'host' => $env('DB_HOST', '127.0.0.1'),
'name' => $env('DB_DATABASE', 'casadocdb'),
'user' => $env('DB_USERNAME', 'root'),
'pass' => $env('DB_PASSWORD', ''),
'port' => (int) $env('DB_PORT', 3306),
'charset' => 'utf8mb4',
],
],
'version_order' => 'creation',
];
+57 -23
View File
@@ -4,10 +4,15 @@ include('include/headscript.php');
$conn = new mysqli($servername, $username, $password, $database); $conn = new mysqli($servername, $username, $password, $database);
$iduserlogin = $_SESSION['iduserlogin']; $iduserlogin = $_SESSION['iduserlogin'];
$idhome = isset($_GET['idhome']) ? intval($_GET['idhome']) : 0; $idhome = isset($_GET['idhome']) ? intval($_GET['idhome']) : 0;
$docpage = isset($_GET['slug']) ? $_GET['slug'] : 'legal'; // Slug principale per la pagina $docpage = isset($_GET['slug']) ? $_GET['slug'] : '';
$subSlug = isset($_GET['subSlug']) ? $_GET['subSlug'] : null; // Slug aggiuntivo opzionale
$showOnlyRequired = isset($_GET['showOnlyRequired']) && $_GET['showOnlyRequired'] === 'true'; $showOnlyRequired = isset($_GET['showOnlyRequired']) && $_GET['showOnlyRequired'] === 'true';
$sectionId = isset($_GET['sectionId']) ? $_GET['sectionId'] : null; $sectionId = (isset($_GET['sectionId']) && $_GET['sectionId'] !== '' && $_GET['sectionId'] !== 'null') ? $_GET['sectionId'] : null;
$searchName = (isset($_GET['searchName']) && $_GET['searchName'] !== '' && $_GET['searchName'] !== 'null') ? $_GET['searchName'] : null;
// Tag: lista di ID separati da virgola
$tagIds = [];
if (isset($_GET['tags']) && $_GET['tags'] !== '' && $_GET['tags'] !== 'null') {
$tagIds = array_values(array_filter(array_map('intval', explode(',', $_GET['tags']))));
}
$queryHome = $conn->prepare("SELECT * FROM home WHERE idhome = ? AND iduser = ?"); $queryHome = $conn->prepare("SELECT * FROM home WHERE idhome = ? AND iduser = ?");
$queryHome->bind_param('ii', $idhome, $iduserlogin); $queryHome->bind_param('ii', $idhome, $iduserlogin);
@@ -20,27 +25,42 @@ if (!$homeData) {
die(json_encode(['error' => 'Casa non trovata o accesso non autorizzato'])); die(json_encode(['error' => 'Casa non trovata o accesso non autorizzato']));
} }
$queryPageId = $conn->prepare("SELECT idpages FROM pages WHERE slug = ?"); // Modalità trasversale: se ci sono tag selezionati, si ignora la categoria
$queryPageId->bind_param('s', $docpage); $crossCutting = !empty($tagIds);
$queryPageId->execute();
$resultPageId = $queryPageId->get_result();
$pageData = $resultPageId->fetch_assoc();
if (!$pageData) { $page_id = null;
header('HTTP/1.1 400 Bad Request'); if (!$crossCutting) {
die(json_encode(['error' => 'Pagina non valida'])); $queryPageId = $conn->prepare("SELECT idpages FROM pages WHERE slug = ?");
$queryPageId->bind_param('s', $docpage);
$queryPageId->execute();
$resultPageId = $queryPageId->get_result();
$pageData = $resultPageId->fetch_assoc();
if (!$pageData) {
header('HTTP/1.1 400 Bad Request');
die(json_encode(['error' => 'Pagina non valida']));
}
$page_id = $pageData['idpages'];
} }
$page_id = $pageData['idpages'];
// Costruisci la query per i documenti // Costruisci la query per i documenti
$sql = " $sql = "
SELECT d.*, s.section_name AS section_name SELECT d.*, s.section_name AS section_name,
GROUP_CONCAT(DISTINCT t.tag_name ORDER BY t.tag_name SEPARATOR ', ') AS tags
FROM documents d FROM documents d
LEFT JOIN sections s ON d.idsections = s.idsections LEFT JOIN sections s ON d.idsections = s.idsections
WHERE d.page_id = ? LEFT JOIN document_tags dt ON dt.document_id = d.document_id
LEFT JOIN tags t ON t.tag_id = dt.tag_id
WHERE 1=1
"; ";
$params = [$page_id]; $params = [];
$types = '';
if (!$crossCutting) {
$sql .= " AND d.page_id = ?";
$params[] = $page_id;
$types .= 'i';
}
if ($showOnlyRequired) { if ($showOnlyRequired) {
$sql .= " AND d.is_required = 1"; $sql .= " AND d.is_required = 1";
@@ -49,19 +69,33 @@ if ($showOnlyRequired) {
if ($sectionId) { if ($sectionId) {
$sql .= " AND md5(s.section_name) = ?"; $sql .= " AND md5(s.section_name) = ?";
$params[] = $sectionId; $params[] = $sectionId;
$types .= 's';
} }
// Aggiungi filtro per subSlug (assumendo che i documenti abbiano un campo slug o un riferimento) if ($searchName) {
if ($subSlug) { $sql .= " AND d.document_name = ?";
$sql .= " AND d.slug = ?"; // Assumo che 'documents' abbia un campo 'slug' per il filtraggio $params[] = $searchName;
$params[] = $subSlug; $types .= 's';
} }
$sql .= " ORDER BY s.section_name, d.document_name"; // Filtro per tag (OR): il documento deve avere ALMENO UNO dei tag selezionati
if (!empty($tagIds)) {
$placeholders = implode(',', array_fill(0, count($tagIds), '?'));
$sql .= " AND d.document_id IN (
SELECT document_id FROM document_tags
WHERE tag_id IN ($placeholders)
)";
foreach ($tagIds as $tid) {
$params[] = $tid;
$types .= 'i';
}
}
$sql .= " GROUP BY d.document_id ORDER BY s.section_name, d.document_name";
$queryDocuments = $conn->prepare($sql); $queryDocuments = $conn->prepare($sql);
$types = str_repeat('s', count($params) - 1) . 'i'; // 's' per stringhe, 'i' per page_id if (!empty($params)) {
$queryDocuments->bind_param($types, ...$params); $queryDocuments->bind_param($types, ...$params);
}
$queryDocuments->execute(); $queryDocuments->execute();
$resultDocuments = $queryDocuments->get_result(); $resultDocuments = $queryDocuments->get_result();
+17 -19
View File
@@ -21,7 +21,7 @@ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
} }
// Imposta lo slug predefinito // Imposta lo slug predefinito
$docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal'; $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : '';
// Recupera tutti i tag disponibili // Recupera tutti i tag disponibili
$stmt = $pdo->query("SELECT tag_id, tag_name FROM tags ORDER BY tag_name"); $stmt = $pdo->query("SELECT tag_id, tag_name FROM tags ORDER BY tag_name");
@@ -95,7 +95,7 @@ $allTags = $stmt->fetchAll(PDO::FETCH_ASSOC);
<div class="col-md-6 position-relative mt-3"> <div class="col-md-6 position-relative mt-3">
<label class="form-label mb-1 fw-bold">Filtra per tag:</label> <label class="form-label mb-1 fw-bold">Filtra per tag:</label>
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle w-100" type="button" id="tagDropdown" data-bs-toggle="dropdown" aria-expanded="false"> <button class="btn btn-outline-secondary dropdown-toggle w-100" type="button" id="tagDropdown" data-toggle="dropdown" aria-expanded="false">
Seleziona tag... Seleziona tag...
</button> </button>
<div class="dropdown-menu w-100" aria-labelledby="tagDropdown"> <div class="dropdown-menu w-100" aria-labelledby="tagDropdown">
@@ -408,11 +408,9 @@ $allTags = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Gestione del checkbox "Solo obbligatori" // Gestione del checkbox "Solo obbligatori"
$("#showOnlyRequired").on('change', function() { $("#showOnlyRequired").on('change', function() {
if (currentSection) { const sectionName = $('.section-icon.active .section-name').text() || null;
const sectionName = $('.section-icon.active .section-name').text(); $('.document-preloader').show();
$('.document-preloader').show(); loadDocuments(currentCategory, currentSection, sectionName);
loadDocuments(currentCategory, currentSection, sectionName);
}
}); });
// Carica le sezioni per una categoria // Carica le sezioni per una categoria
@@ -531,11 +529,9 @@ $allTags = $stmt->fetchAll(PDO::FETCH_ASSOC);
name: tagName name: tagName
}); });
updateSelectedTags(); updateSelectedTags();
if (currentSection) { $('#documentSections').empty();
const sectionName = $('.section-icon.active .section-name').text(); $('.document-preloader').show();
$('.document-preloader').show(); loadDocuments(currentCategory, null, null);
loadDocuments(currentCategory, currentSection, sectionName);
}
} }
}); });
@@ -555,11 +551,9 @@ $allTags = $stmt->fetchAll(PDO::FETCH_ASSOC);
const tagId = $(this).data('tag-id'); const tagId = $(this).data('tag-id');
selectedTags = selectedTags.filter(t => t.id !== tagId); selectedTags = selectedTags.filter(t => t.id !== tagId);
updateSelectedTags(); updateSelectedTags();
if (currentSection) { $('#documentSections').empty();
const sectionName = $('.section-icon.active .section-name').text(); $('.document-preloader').show();
$('.document-preloader').show(); loadDocuments(currentCategory, null, null);
loadDocuments(currentCategory, currentSection, sectionName);
}
}); });
} }
@@ -620,8 +614,12 @@ $allTags = $stmt->fetchAll(PDO::FETCH_ASSOC);
html += ` html += `
<div class="accordion-item"> <div class="accordion-item">
<h2 class="accordion-header" id="heading-${md5(sectionKey)}"></h2> <h2 class="accordion-header" id="heading-${md5(sectionKey)}">
<div id="collapse-${md5(sectionKey)}" class="accordion-collapse collapse" aria-labelledby="heading-${md5(sectionKey)}" data-parent="#documentSections"> <button class="btn btn-link text-start w-100 fw-bold text-decoration-none" type="button" data-toggle="collapse" data-target="#collapse-${md5(sectionKey)}" aria-expanded="true">
${displaySectionName}
</button>
</h2>
<div id="collapse-${md5(sectionKey)}" class="accordion-collapse collapse show" aria-labelledby="heading-${md5(sectionKey)}" data-parent="#documentSections">
<div class="accordion-body"> <div class="accordion-body">
`; `;