diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7789632..25dd1f2 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -4,6 +4,7 @@ on: push: branches: - "main" + - "feature/glpi-11.0" tags: - "*" pull_request: @@ -20,7 +21,7 @@ jobs: name: "Generate CI matrix" uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1" with: - glpi-version: "10.0.x" + glpi-version: "11.0.x" ci: name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}" needs: "generate-ci-matrix" diff --git a/ajax/alert_preview.php b/ajax/alert_preview.php index 9f399de..80eca48 100644 --- a/ajax/alert_preview.php +++ b/ajax/alert_preview.php @@ -28,8 +28,6 @@ * ------------------------------------------------------------------------- */ -include('../../../inc/includes.php'); - Session::checkLoginUser(); PluginNewsAlert::displayAlert($_GET, [ diff --git a/ajax/display_alerts.php b/ajax/display_alerts.php index 264b712..dd3852e 100644 --- a/ajax/display_alerts.php +++ b/ajax/display_alerts.php @@ -29,7 +29,6 @@ */ $AJAX_INCLUDE = 1; -include('../../../inc/includes.php'); header('Content-Type: text/html; charset=UTF-8'); Html::header_nocache(); Session::checkLoginUser(); diff --git a/ajax/hide_alert.php b/ajax/hide_alert.php index 763b51c..c6c31f7 100644 --- a/ajax/hide_alert.php +++ b/ajax/hide_alert.php @@ -29,7 +29,6 @@ */ $AJAX_INCLUDE = 1; -include('../../../inc/includes.php'); header('Content-Type: text/html; charset=UTF-8'); Html::header_nocache(); Session::checkLoginUser(); diff --git a/ajax/targets.php b/ajax/targets.php index 0ee6c9b..bcb2bab 100644 --- a/ajax/targets.php +++ b/ajax/targets.php @@ -29,7 +29,6 @@ */ $AJAX_INCLUDE = 1; -include('../../../inc/includes.php'); header('Content-Type: text/html; charset=UTF-8'); Html::header_nocache(); diff --git a/composer.json b/composer.json index e22b77b..867074b 100644 --- a/composer.json +++ b/composer.json @@ -1,20 +1,25 @@ { "require": { - "php": ">=7.4" + "php": ">=8.2" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.75", "friendsoftwig/twigcs": "^6.1", "glpi-project/tools": "^0.7.4", "php-parallel-lint/php-parallel-lint": "^1.4", - "phpstan/phpstan": "^2.1" + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-deprecation-rules": "^2.0" }, "config": { "optimize-autoloader": true, "platform": { - "php": "7.4.0" + "php": "8.2.99" }, - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "phpstan/extension-installer": true + } }, "autoload-dev": { "psr-4": { diff --git a/composer.lock b/composer.lock index a599033..47d0424 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "197261e0cf26cf6d7555cf4d02fa8af8", + "content-hash": "ca8dbf91acbf18c3f8b411ceb8790e7b", "packages": [], "packages-dev": [ { @@ -511,16 +511,16 @@ }, { "name": "friendsoftwig/twigcs", - "version": "v6.1.0", + "version": "6.5.0", "source": { "type": "git", "url": "https://github.com/friendsoftwig/twigcs.git", - "reference": "3c36d606c4f19db0dd2a01b735ec7a8151b7f182" + "reference": "aaa3ba112bf4fcee7b51a00d9b45b13bc2cc23bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/friendsoftwig/twigcs/zipball/3c36d606c4f19db0dd2a01b735ec7a8151b7f182", - "reference": "3c36d606c4f19db0dd2a01b735ec7a8151b7f182", + "url": "https://api.github.com/repos/friendsoftwig/twigcs/zipball/aaa3ba112bf4fcee7b51a00d9b45b13bc2cc23bc", + "reference": "aaa3ba112bf4fcee7b51a00d9b45b13bc2cc23bc", "shasum": "" }, "require": { @@ -529,14 +529,14 @@ "ext-json": "*", "ext-mbstring": "*", "ext-simplexml": "*", - "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0", - "symfony/console": "^4.4 || ^5.3 || ^6.0", - "symfony/filesystem": "^4.4 || ^5.3 || ^6.0", - "symfony/finder": "^4.4 || ^5.3 || ^6.0" + "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", + "symfony/console": "^4.4 || ^5.3 || ^6.0 || ^7.0", + "symfony/filesystem": "^4.4 || ^5.3 || ^6.0 || ^7.0", + "symfony/finder": "^4.4 || ^5.3 || ^6.0 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^9.5.20", - "symfony/phpunit-bridge": "^6.2.3" + "phpunit/phpunit": "^9.6.19", + "symfony/phpunit-bridge": "^7.1.4" }, "bin": [ "bin/twigcs" @@ -560,9 +560,9 @@ "description": "Checkstyle automation for Twig", "support": { "issues": "https://github.com/friendsoftwig/twigcs/issues", - "source": "https://github.com/friendsoftwig/twigcs/tree/v6.1.0" + "source": "https://github.com/friendsoftwig/twigcs/tree/6.5.0" }, - "time": "2023-01-04T16:01:24+00:00" + "time": "2024-11-27T21:59:24+00:00" }, { "name": "glpi-project/tools", @@ -681,18 +681,66 @@ }, "time": "2024-03-27T12:14:49+00:00" }, + { + "name": "phpstan/extension-installer", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.0 || ^2.0" + }, + "require-dev": { + "composer/composer": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.4.3" + }, + "time": "2024-09-04T20:21:43+00:00" + }, { "name": "phpstan/phpstan", - "version": "2.1.11", + "version": "2.1.13", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "8ca5f79a8f63c49b2359065832a654e1ec70ac30" + "reference": "e55e03e6d4ac49cd1240907e5b08e5cd378572a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8ca5f79a8f63c49b2359065832a654e1ec70ac30", - "reference": "8ca5f79a8f63c49b2359065832a654e1ec70ac30", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e55e03e6d4ac49cd1240907e5b08e5cd378572a9", + "reference": "e55e03e6d4ac49cd1240907e5b08e5cd378572a9", "shasum": "" }, "require": { @@ -737,26 +785,78 @@ "type": "github" } ], - "time": "2025-03-24T13:45:00+00:00" + "time": "2025-04-27T12:28:25+00:00" + }, + { + "name": "phpstan/phpstan-deprecation-rules", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", + "reference": "9d8e7d4e32711715ad78a1fb6ec368df9af01fdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/9d8e7d4e32711715ad78a1fb6ec368df9af01fdf", + "reference": "9d8e7d4e32711715ad78a1fb6ec368df9af01fdf", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.1.13" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", + "support": { + "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/2.0.2" + }, + "time": "2025-04-26T19:59:57+00:00" }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -783,9 +883,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/event-dispatcher", @@ -839,30 +939,30 @@ }, { "name": "psr/log", - "version": "1.1.4", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -883,9 +983,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "react/cache", @@ -1415,29 +1515,29 @@ }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^11.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1469,7 +1569,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" }, "funding": [ { @@ -1477,56 +1578,51 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "symfony/console", - "version": "v5.4.47", + "version": "v6.4.20", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed" + "reference": "2e4af9c952617cc3f9559ff706aee420a8464c36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", - "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", + "url": "https://api.github.com/repos/symfony/console/zipball/2e4af9c952617cc3f9559ff706aee420a8464c36", + "reference": "2e4af9c952617cc3f9559ff706aee420a8464c36", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^5.4|^6.0|^7.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/lock": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -1560,7 +1656,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.47" + "source": "https://github.com/symfony/console/tree/v6.4.20" }, "funding": [ { @@ -1576,24 +1672,24 @@ "type": "tidelift" } ], - "time": "2024-11-06T11:30:55+00:00" + "time": "2025-03-03T17:16:38+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.4", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", - "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { @@ -1602,7 +1698,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.5-dev" } }, "autoload": { @@ -1627,7 +1723,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" }, "funding": [ { @@ -1643,48 +1739,43 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.4.45", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "72982eb416f61003e9bb6e91f8b3213600dcf9e9" + "reference": "910c5db85a5356d0fea57680defec4e99eb9c8c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/72982eb416f61003e9bb6e91f8b3213600dcf9e9", - "reference": "72982eb416f61003e9bb6e91f8b3213600dcf9e9", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/910c5db85a5356d0fea57680defec4e99eb9c8c1", + "reference": "910c5db85a5356d0fea57680defec4e99eb9c8c1", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/event-dispatcher-contracts": "^2|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.2", + "symfony/event-dispatcher-contracts": "^2.5|^3" }, "conflict": { - "symfony/dependency-injection": "<4.4" + "symfony/dependency-injection": "<6.4", + "symfony/service-contracts": "<2.5" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0" + "symfony/event-dispatcher-implementation": "2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^4.4|^5.0|^6.0", - "symfony/service-contracts": "^1.1|^2|^3", - "symfony/stopwatch": "^4.4|^5.0|^6.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/error-handler": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -1712,7 +1803,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.45" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.2.0" }, "funding": [ { @@ -1728,29 +1819,26 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.4", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f" + "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", - "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7642f5e970b672283b7823222ae8ef8bbc160b9f", + "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "psr/event-dispatcher": "^1" }, - "suggest": { - "symfony/event-dispatcher-implementation": "" - }, "type": "library", "extra": { "thanks": { @@ -1758,7 +1846,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.5-dev" } }, "autoload": { @@ -1791,7 +1879,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.4" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.1" }, "funding": [ { @@ -1807,30 +1895,29 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/filesystem", - "version": "v5.4.45", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "57c8294ed37d4a055b77057827c67f9558c95c54" + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/57c8294ed37d4a055b77057827c67f9558c95c54", - "reference": "57c8294ed37d4a055b77057827c67f9558c95c54", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b8dce482de9d7c9fe2891155035a7248ab5c7fdb", + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.8" }, "require-dev": { - "symfony/process": "^5.4|^6.4" + "symfony/process": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -1858,7 +1945,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.45" + "source": "https://github.com/symfony/filesystem/tree/v7.2.0" }, "funding": [ { @@ -1874,26 +1961,27 @@ "type": "tidelift" } ], - "time": "2024-10-22T13:05:35+00:00" + "time": "2024-10-25T15:15:23+00:00" }, { "name": "symfony/finder", - "version": "v5.4.45", + "version": "v7.2.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "63741784cd7b9967975eec610b256eed3ede022b" + "reference": "87a71856f2f56e4100373e92529eed3171695cfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/63741784cd7b9967975eec610b256eed3ede022b", - "reference": "63741784cd7b9967975eec610b256eed3ede022b", + "url": "https://api.github.com/repos/symfony/finder/zipball/87a71856f2f56e4100373e92529eed3171695cfb", + "reference": "87a71856f2f56e4100373e92529eed3171695cfb", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.2" + }, + "require-dev": { + "symfony/filesystem": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -1921,7 +2009,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.45" + "source": "https://github.com/symfony/finder/tree/v7.2.2" }, "funding": [ { @@ -1937,27 +2025,25 @@ "type": "tidelift" } ], - "time": "2024-09-28T13:32:08+00:00" + "time": "2024-12-30T19:00:17+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.4.45", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6" + "reference": "7da8fbac9dcfef75ffc212235d76b2754ce0cf50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6", - "reference": "74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/7da8fbac9dcfef75ffc212235d76b2754ce0cf50", + "reference": "7da8fbac9dcfef75ffc212235d76b2754ce0cf50", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3" }, "type": "library", "autoload": { @@ -1990,7 +2076,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.45" + "source": "https://github.com/symfony/options-resolver/tree/v7.2.0" }, "funding": [ { @@ -2006,7 +2092,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2024-11-20T11:17:29+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2326,82 +2412,6 @@ ], "time": "2024-09-09T11:45:10+00:00" }, - { - "name": "symfony/polyfill-php73", - "version": "v1.31.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", - "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.31.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-09-09T11:45:10+00:00" - }, { "name": "symfony/polyfill-php80", "version": "v1.31.0", @@ -2560,21 +2570,20 @@ }, { "name": "symfony/process", - "version": "v5.4.47", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d" + "reference": "87b7c93e57df9d8e39a093d32587702380ff045d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5d1662fb32ebc94f17ddb8d635454a776066733d", - "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d", + "url": "https://api.github.com/repos/symfony/process/zipball/87b7c93e57df9d8e39a093d32587702380ff045d", + "reference": "87b7c93e57df9d8e39a093d32587702380ff045d", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.2" }, "type": "library", "autoload": { @@ -2602,7 +2611,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.47" + "source": "https://github.com/symfony/process/tree/v7.2.5" }, "funding": [ { @@ -2618,33 +2627,30 @@ "type": "tidelift" } ], - "time": "2024-11-06T11:36:42+00:00" + "time": "2025-03-13T12:21:46+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.4", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f37b419f7aea2e9abf10abd261832cace12e3300" + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f37b419f7aea2e9abf10abd261832cace12e3300", - "reference": "f37b419f7aea2e9abf10abd261832cace12e3300", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0", + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "thanks": { @@ -2652,13 +2658,16 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.5-dev" } }, "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2685,7 +2694,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.4" + "source": "https://github.com/symfony/service-contracts/tree/v3.5.1" }, "funding": [ { @@ -2701,25 +2710,25 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.4.45", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "fb2c199cf302eb207f8c23e7ee174c1c31a5c004" + "reference": "5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/fb2c199cf302eb207f8c23e7ee174c1c31a5c004", - "reference": "fb2c199cf302eb207f8c23e7ee174c1c31a5c004", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd", + "reference": "5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/service-contracts": "^1|^2|^3" + "php": ">=8.2", + "symfony/service-contracts": "^2.5|^3" }, "type": "library", "autoload": { @@ -2747,7 +2756,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.45" + "source": "https://github.com/symfony/stopwatch/tree/v7.2.4" }, "funding": [ { @@ -2763,38 +2772,39 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2025-02-24T10:49:57+00:00" }, { "name": "symfony/string", - "version": "v5.4.47", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "136ca7d72f72b599f2631aca474a4f8e26719799" + "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/136ca7d72f72b599f2631aca474a4f8e26719799", - "reference": "136ca7d72f72b599f2631aca474a4f8e26719799", + "url": "https://api.github.com/repos/symfony/string/zipball/446e0d146f991dde3e73f45f2c97a9faad773c82", + "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/emoji": "^7.1", + "symfony/error-handler": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/intl": "^6.4|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -2833,7 +2843,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.47" + "source": "https://github.com/symfony/string/tree/v7.2.0" }, "funding": [ { @@ -2849,31 +2859,30 @@ "type": "tidelift" } ], - "time": "2024-11-10T20:33:58+00:00" + "time": "2024-11-13T13:31:26+00:00" }, { "name": "twig/twig", - "version": "v3.11.3", + "version": "v3.20.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "3b06600ff3abefaf8ff55d5c336cd1c4253f8c7e" + "reference": "3468920399451a384bef53cf7996965f7cd40183" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3b06600ff3abefaf8ff55d5c336cd1c4253f8c7e", - "reference": "3b06600ff3abefaf8ff55d5c336cd1c4253f8c7e", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/3468920399451a384bef53cf7996965f7cd40183", + "reference": "3468920399451a384bef53cf7996965f7cd40183", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1.0", "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php80": "^1.22", - "symfony/polyfill-php81": "^1.29" + "symfony/polyfill-mbstring": "^1.3" }, "require-dev": { + "phpstan/phpstan": "^2.0", "psr/container": "^1.0|^2.0", "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" }, @@ -2917,7 +2926,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.11.3" + "source": "https://github.com/twigphp/Twig/tree/v3.20.0" }, "funding": [ { @@ -2929,20 +2938,20 @@ "type": "tidelift" } ], - "time": "2024-11-07T12:34:41+00:00" + "time": "2025-02-13T08:34:43+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.4" + "php": ">=8.2" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { - "php": "7.4.0" + "php": "8.2.99" }, "plugin-api-version": "2.6.0" } diff --git a/front/alert.form.php b/front/alert.form.php index d96ffe3..8d381d2 100644 --- a/front/alert.form.php +++ b/front/alert.form.php @@ -30,8 +30,6 @@ use Glpi\Event; -include('../../../inc/includes.php'); - if (!isset($_GET['id'])) { $_GET['id'] = ''; } diff --git a/front/alert.php b/front/alert.php index 81a2395..43f8546 100644 --- a/front/alert.php +++ b/front/alert.php @@ -28,8 +28,6 @@ * ------------------------------------------------------------------------- */ -include('../../../inc/includes.php'); - Html::header( __('Alerts', 'news'), $_SERVER['PHP_SELF'], diff --git a/front/external.php b/front/external.php index 158a852..6ddb8d2 100644 --- a/front/external.php +++ b/front/external.php @@ -28,8 +28,6 @@ * ------------------------------------------------------------------------- */ -include('../../../inc/includes.php'); - Html::nullHeader(PluginNewsAlert::getTypeName()); $logged = isset($_SESSION['glpiID']); PluginNewsAlert::displayAlerts(['show_only_login_alerts' => !$logged]); diff --git a/front/hidden_alerts.php b/front/hidden_alerts.php index 82e24a2..4718445 100644 --- a/front/hidden_alerts.php +++ b/front/hidden_alerts.php @@ -28,8 +28,6 @@ * ------------------------------------------------------------------------- */ -include('../../../inc/includes.php'); - if ($_SESSION['glpiactiveprofile']['interface'] != 'central') { Html::helpHeader(__('Alerts', 'news'), $_SERVER['PHP_SELF'], $_SESSION['glpiname']); } else { diff --git a/hook.php b/hook.php index a3bece9..ec87983 100644 --- a/hook.php +++ b/hook.php @@ -45,7 +45,7 @@ function plugin_news_install() $white = PluginNewsAlert::WHITE; $dark = PluginNewsAlert::DARK; $medium = PluginNewsAlert::MEDIUM; - $DB->query(" + $DB->doQuery(" CREATE TABLE IF NOT EXISTS `$alert_table` ( `id` INT {$default_key_sign} NOT NULL AUTO_INCREMENT, `date_mod` TIMESTAMP NOT NULL, @@ -69,7 +69,7 @@ function plugin_news_install() ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC; "); } else { - $DB->updateOrDie( + $DB->update( PluginNewsAlert_User::getTable(), [ 'state' => PluginNewsAlert_User::VISIBLE, @@ -80,7 +80,6 @@ function plugin_news_install() PluginNewsAlert::getTable() . '.is_close_allowed' => 0, ], ], - '', [ 'JOIN' => [ PluginNewsAlert::getTable() => [ @@ -95,7 +94,7 @@ function plugin_news_install() } if (!$DB->tableExists('glpi_plugin_news_alerts_users')) { - $DB->query(" + $DB->doQuery(" CREATE TABLE IF NOT EXISTS `glpi_plugin_news_alerts_users` ( `id` INT {$default_key_sign} NOT NULL AUTO_INCREMENT, `plugin_news_alerts_id` INT {$default_key_sign} NOT NULL, @@ -109,7 +108,7 @@ function plugin_news_install() } if (!$DB->tableExists('glpi_plugin_news_alerts_targets')) { - $DB->query(" + $DB->doQuery(" CREATE TABLE IF NOT EXISTS `glpi_plugin_news_alerts_targets` ( `id` INT {$default_key_sign} NOT NULL AUTO_INCREMENT, `plugin_news_alerts_id` INT {$default_key_sign} NOT NULL, @@ -125,7 +124,7 @@ function plugin_news_install() /* Remove old table */ if ($DB->tableExists('glpi_plugin_news_profiles')) { - $DB->query('DROP TABLE IF EXISTS `glpi_plugin_news_profiles`;'); + $DB->doQuery('DROP TABLE IF EXISTS `glpi_plugin_news_profiles`;'); } // add displayed on login flag @@ -192,7 +191,7 @@ function plugin_news_install() (plugin_news_alerts_id, itemtype, items_id) SELECT id, 'Profile', profiles_id FROM $alert_table"; - $DB->query($query_targets) or die('fail to migration targets'); + $DB->doQuery($query_targets); //drop old field $migration->dropField($alert_table, 'profiles_id'); @@ -214,7 +213,7 @@ function plugin_news_install() $dpreferences = new DisplayPreference(); $found_dpref = $dpreferences->find(['itemtype' => ['LIKE', '%PluginNews%']]); if (count($found_dpref) == 0) { - $DB->query("INSERT INTO `glpi_displaypreferences` + $DB->doQuery("INSERT INTO `glpi_displaypreferences` (`itemtype`, `num`, `rank`, `users_id`) VALUES ('PluginNewsAlert', 2, 1, 0), @@ -349,12 +348,12 @@ function plugin_news_uninstall() /** @var DBmysql $DB */ global $DB; - $DB->query('DROP TABLE IF EXISTS `glpi_plugin_news_alerts`;'); - $DB->query('DROP TABLE IF EXISTS `glpi_plugin_news_profiles`;'); - $DB->query('DROP TABLE IF EXISTS `glpi_plugin_news_alerts_users`;'); - $DB->query('DROP TABLE IF EXISTS `glpi_plugin_news_alerts_targets`;'); - $DB->query("DELETE FROM `glpi_profiles` WHERE `name` LIKE '%plugin_news%';"); - $DB->query("DELETE FROM `glpi_displaypreferences` WHERE `itemtype` LIKE '%PluginNews%';"); + $DB->doQuery('DROP TABLE IF EXISTS `glpi_plugin_news_alerts`;'); + $DB->doQuery('DROP TABLE IF EXISTS `glpi_plugin_news_profiles`;'); + $DB->doQuery('DROP TABLE IF EXISTS `glpi_plugin_news_alerts_users`;'); + $DB->doQuery('DROP TABLE IF EXISTS `glpi_plugin_news_alerts_targets`;'); + $DB->doQuery("DELETE FROM `glpi_profiles` WHERE `name` LIKE '%plugin_news%';"); + $DB->doQuery("DELETE FROM `glpi_displaypreferences` WHERE `itemtype` LIKE '%PluginNews%';"); return true; } diff --git a/inc/alert.class.php b/inc/alert.class.php index 99e615b..ef160dc 100644 --- a/inc/alert.class.php +++ b/inc/alert.class.php @@ -32,7 +32,8 @@ use Glpi\Toolbox\Sanitizer; if (!defined('GLPI_ROOT')) { - die("Sorry. You can't access directly to this file"); + echo "Sorry. You can't access directly to this file"; + return; } class PluginNewsAlert extends CommonDBTM @@ -71,7 +72,7 @@ class PluginNewsAlert extends CommonDBTM public const YELLOW = 'yellow'; public const LIME = 'lime'; - public static function canDelete() + public static function canDelete(): bool { return self::canPurge(); } @@ -532,6 +533,9 @@ public static function displayOnTicket() public static function displayAlerts($params = []) { + /** @var array $CFG_GLPI */ + global $CFG_GLPI; + $p['show_only_login_alerts'] = false; $p['show_only_central_alerts'] = false; $p['show_hidden_alerts'] = false; @@ -562,7 +566,7 @@ public static function displayAlerts($params = []) && !$p['show_hidden_alerts'] ) { echo "
"; - echo ""; + echo ""; echo __('You have hidden alerts valid for current date', 'news'); echo ''; echo '
'; @@ -609,7 +613,7 @@ public static function displayAlert($alert, $p) $twig->display('@news/display_alert.html.twig', [ 'size' => self::getSizeClasses($alert['size']), 'alert_fields' => $alert, - 'content' => Sanitizer::unsanitize($alert['message']), + 'content' => $alert['message'], 'can_close' => $alert['is_close_allowed'] && !$p['show_hidden_alerts'], 'show_only_login_alerts' => $p['show_only_login_alerts'], ]); diff --git a/inc/alert_target.class.php b/inc/alert_target.class.php index f80e1fc..37768b6 100644 --- a/inc/alert_target.class.php +++ b/inc/alert_target.class.php @@ -29,7 +29,8 @@ */ if (!defined('GLPI_ROOT')) { - die("Sorry. You can't access directly to this file"); + echo "Sorry. You can't access directly to this file"; + return; } // @codingStandardsIgnoreStart @@ -43,12 +44,12 @@ public static function getTypeName($nb = 0) return _n('Target', 'Targets', $nb, 'news'); } - public static function canDelete() + public static function canDelete(): bool { return self::canUpdate(); } - public static function canPurge() + public static function canPurge(): bool { return self::canUpdate(); } @@ -119,6 +120,8 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ public static function showForAlert(PluginNewsAlert $alert) { + /** @var array $CFG_GLPI */ + global $CFG_GLPI; $rand = mt_rand(); echo "
"; @@ -138,7 +141,7 @@ public static function showForAlert(PluginNewsAlert $alert) Ajax::updateItemOnSelectEvent( 'dropdown_itemtype' . $addrand, "visibility$rand", - Plugin::getWebDir('news') . '/ajax/targets.php', + $CFG_GLPI['root_doc'] . '/plugins/news/ajax/targets.php', $params, ); echo ''; diff --git a/inc/alert_user.class.php b/inc/alert_user.class.php index 16a6a1f..f4813ef 100644 --- a/inc/alert_user.class.php +++ b/inc/alert_user.class.php @@ -29,7 +29,8 @@ */ if (!defined('GLPI_ROOT')) { - die("Sorry. You can't access directly to this file"); + echo "Sorry. You can't access directly to this file"; + return; } // @codingStandardsIgnoreStart @@ -71,7 +72,7 @@ public static function hideAlert($params = []) ); } - public function canCreateItem() + public function canCreateItem(): bool { if ($this->fields['users_id'] != Session::getLoginUserID()) { return false; diff --git a/phpstan.neon b/phpstan.neon index 455f2e7..ebf8ffd 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,8 +2,6 @@ parameters: parallel: maximumNumberOfProcesses: 2 level: 5 - bootstrapFiles: - - ../../inc/based_config.php paths: - inc - front diff --git a/css/styles.css b/public/css/styles.css similarity index 100% rename from css/styles.css rename to public/css/styles.css diff --git a/js/news.js b/public/js/news.js similarity index 96% rename from js/news.js rename to public/js/news.js index d948468..85450c5 100644 --- a/js/news.js +++ b/public/js/news.js @@ -30,7 +30,7 @@ pluginNewsCloseAlerts = function() { $(document).on("mousedown", ".plugin_news_alert .alert a[data-bs-dismiss=alert]", function(event) { var alert = $(this).closest(".plugin_news_alert"); var id = alert.attr('data-id'); - var a_url = CFG_GLPI.root_doc+"/"+GLPI_PLUGINS_PATH.news+"/ajax"; + var a_url = CFG_GLPI.root_doc+"/plugins/news/ajax"; $.post(a_url+"/hide_alert.php", {'id' : id}); }); }; diff --git a/pics/icon.png b/public/pics/icon.png similarity index 100% rename from pics/icon.png rename to public/pics/icon.png diff --git a/pics/toggle_down.png b/public/pics/toggle_down.png similarity index 100% rename from pics/toggle_down.png rename to public/pics/toggle_down.png diff --git a/pics/toggle_up.png b/public/pics/toggle_up.png similarity index 100% rename from pics/toggle_up.png rename to public/pics/toggle_up.png diff --git a/setup.php b/setup.php index dff119b..84a30b7 100644 --- a/setup.php +++ b/setup.php @@ -31,9 +31,9 @@ define('PLUGIN_NEWS_VERSION', '1.12.4'); // Minimal GLPI version, inclusive -define('PLUGIN_NEWS_MIN_GLPI', '10.0.0'); +define('PLUGIN_NEWS_MIN_GLPI', '11.0.0'); // Maximum GLPI version, exclusive -define('PLUGIN_NEWS_MAX_GLPI', '10.0.99'); +define('PLUGIN_NEWS_MAX_GLPI', '11.0.99'); function plugin_init_news() { diff --git a/templates/alert_form.html.twig b/templates/alert_form.html.twig index 1701e1c..9f68d41 100644 --- a/templates/alert_form.html.twig +++ b/templates/alert_form.html.twig @@ -181,7 +181,7 @@ // Load preview $(".alert-preview").load( - "{{ get_plugin_web_dir('news') }}/ajax/alert_preview.php", + "{{ path('/plugins/news/ajax/alert_preview.php') }}", $("form[name=asset_form]").serialize() ); }; diff --git a/templates/display_alert.html.twig b/templates/display_alert.html.twig index 2bbc131..23881c7 100644 --- a/templates/display_alert.html.twig +++ b/templates/display_alert.html.twig @@ -50,7 +50,7 @@

- {{ alert_fields.name|verbatim_value }} + {{ alert_fields.name }} {% if show_only_login_alerts %} {% endif %}