From 601139b866b2721eca1eb430a967ae7a86a28bd0 Mon Sep 17 00:00:00 2001 From: Edogusma <134616796+Edogusma@users.noreply.github.com> Date: Tue, 4 Feb 2025 00:42:48 +0100 Subject: [PATCH] update to support PHP 8.1.0 (#1270) * update to support PHP 8.1.0 * localized date * reverted for compatibility up to PHP 7.4 * PHP 8.4 support * remove unused images --------- Co-authored-by: Tim Zandbergen --- composer.json | 25 +- composer.lock | 810 ++++++++++++++---- cron/status.cron.php | 10 +- src/config/services.xml | 6 +- src/includes/functions.inc.php | 95 +- src/psm/Module/AbstractController.php | 4 +- .../Config/Controller/ConfigController.php | 2 +- src/psm/Module/ControllerInterface.php | 2 +- .../Error/Controller/ErrorController.php | 2 +- .../Install/Controller/InstallController.php | 2 +- .../Controller/AbstractServerController.php | 2 +- .../Server/Controller/LogController.php | 2 +- .../Server/Controller/ServerController.php | 8 +- .../Server/Controller/StatusController.php | 15 +- .../Server/Controller/UpdateController.php | 2 +- .../User/Controller/LoginController.php | 2 +- .../User/Controller/ProfileController.php | 2 +- .../Module/User/Controller/UserController.php | 2 +- src/psm/Router.php | 2 +- src/psm/Util/Module/Modal.php | 6 +- src/psm/Util/Module/ModalInterface.php | 2 +- src/psm/Util/Module/Sidebar.php | 4 +- src/psm/Util/Module/SidebarInterface.php | 2 +- src/psm/Util/Server/HistoryGraph.php | 8 +- .../module/server/server/view.tpl.html | 4 +- 25 files changed, 781 insertions(+), 240 deletions(-) diff --git a/composer.json b/composer.json index dea815af..89cb59ea 100644 --- a/composer.json +++ b/composer.json @@ -4,20 +4,22 @@ "license": "GPL-3.0-or-later", "homepage": "https://www.phpservermonitor.org", "require": { - "php": "^5.5.9|>=7.0.8", + "php": "^7.4|>=8.1", "ext-curl": "*", "ext-json": "*", "ext-pdo": "*", "ext-xml": "*", - "phpmailer/phpmailer": ">=6.5.0 ~6.0", - "symfony/config": "~3.4", - "symfony/dependency-injection": "~4.0", - "symfony/event-dispatcher": "~3.4", - "symfony/http-foundation": ">=3.4.35 ~3.4", - "symfony/filesystem": "~3.4", - "php-pushover/php-pushover": "dev-master", + "phpmailer/phpmailer": "^6.9", + "symfony/config": "6.4", + "symfony/dependency-injection": "6.4", + "symfony/event-dispatcher": "6.4", + "symfony/http-foundation": "6.4.16", + "symfony/filesystem": "6.4", + "symfony/deprecation-contracts": "^2.5", + "symfony/event-dispatcher-contracts": "^2.5", + "php-pushover/php-pushover": "^1.0", "paragonie/random_compat": "^9.99", - "twig/twig": "~1.35", + "twig/twig": "^3.8", "jaxl/jaxl": "^3.1", "viharm/psm-ldap-auth": "^1.1" }, @@ -29,5 +31,10 @@ "psr-4": { "psm\\": "src/psm/" } + }, + "config": { + "allow-plugins": { + "mnsami/composer-custom-directory-installer": true + } } } \ No newline at end of file diff --git a/composer.lock b/composer.lock index 7d7066fc..3988beba 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": "fea47a06785a33c2f4e0c9bc1b99f0f0", + "content-hash": "58126e08e315755f4364c2bd87f6cfd1", "packages": [ { "name": "jaxl/jaxl", @@ -192,19 +192,18 @@ }, { "name": "php-pushover/php-pushover", - "version": "dev-master", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/cschalenborgh/php-pushover.git", - "reference": "ef1df985bf3acb17b1f1f8fe2df2c3c9a16bef32" + "reference": "b2d060efacf48e4c6821427691b19db0315ccedd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cschalenborgh/php-pushover/zipball/ef1df985bf3acb17b1f1f8fe2df2c3c9a16bef32", - "reference": "ef1df985bf3acb17b1f1f8fe2df2c3c9a16bef32", + "url": "https://api.github.com/repos/cschalenborgh/php-pushover/zipball/b2d060efacf48e4c6821427691b19db0315ccedd", + "reference": "b2d060efacf48e4c6821427691b19db0315ccedd", "shasum": "" }, - "default-branch": true, "type": "library", "autoload": { "files": [ @@ -223,7 +222,7 @@ "issues": "https://github.com/cschalenborgh/php-pushover/issues", "source": "https://github.com/cschalenborgh/php-pushover/tree/master" }, - "time": "2021-01-12T12:43:39+00:00" + "time": "2019-09-26T19:38:11+00:00" }, { "name": "phpmailer/phpmailer", @@ -308,22 +307,27 @@ }, { "name": "psr/container", - "version": "1.1.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -350,41 +354,90 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { - "name": "symfony/config", - "version": "v3.4.47", + "name": "psr/event-dispatcher", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f" + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", - "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0", + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "symfony/config", + "version": "v6.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "5d33e0fb707d603330e0edfd4691803a1253572e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/5d33e0fb707d603330e0edfd4691803a1253572e", + "reference": "5d33e0fb707d603330e0edfd4691803a1253572e", + "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/dependency-injection": "<3.3", - "symfony/finder": "<3.3" + "symfony/finder": "<5.4", + "symfony/service-contracts": "<2.5" }, "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" + "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": { @@ -409,10 +462,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Config Component", + "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/v3.4.47" + "source": "https://github.com/symfony/config/tree/v6.4.0" }, "funding": [ { @@ -428,46 +481,44 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2023-11-09T08:28:32+00:00" }, { "name": "symfony/dependency-injection", - "version": "v4.0.15", + "version": "v6.4.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "36401d55d9be1fddd4e8be983b2a7e0b9a5f29ac" + "reference": "5dc8ad5f2bbba7046f5947682bf7d868ce80d4e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/36401d55d9be1fddd4e8be983b2a7e0b9a5f29ac", - "reference": "36401d55d9be1fddd4e8be983b2a7e0b9a5f29ac", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/5dc8ad5f2bbba7046f5947682bf7d868ce80d4e8", + "reference": "5dc8ad5f2bbba7046f5947682bf7d868ce80d4e8", "shasum": "" }, "require": { - "php": "^7.1.3", - "psr/container": "^1.0" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/service-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^6.2.10|^7.0" }, "conflict": { - "symfony/config": "<3.4", - "symfony/finder": "<3.4", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<3.4" + "ext-psr": "<1.1|>=2", + "symfony/config": "<6.1", + "symfony/finder": "<5.4", + "symfony/proxy-manager-bridge": "<6.3", + "symfony/yaml": "<5.4" }, "provide": { - "psr/container-implementation": "1.0" + "psr/container-implementation": "1.1|2.0", + "symfony/service-implementation": "1.1|2.0|3.0" }, "require-dev": { - "symfony/config": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" + "symfony/config": "^6.1|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0" }, "type": "library", "extra": { @@ -497,44 +548,129 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony DependencyInjection Component", + "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/4.0" + "source": "https://github.com/symfony/dependency-injection/tree/v6.4.0" }, - "time": "2018-08-01T08:23:45+00:00" + "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": "2023-10-31T08:40:20+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v3.4.47", + "name": "symfony/deprecation-contracts", + "version": "v2.5.4", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "31fde73757b6bad247c54597beef974919ec6860" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/31fde73757b6bad247c54597beef974919ec6860", - "reference": "31fde73757b6bad247c54597beef974919ec6860", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "2.5-dev" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "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": "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" + }, + "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-25T14:11:13+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v6.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "d76d2632cfc2206eecb5ad2b26cd5934082941b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d76d2632cfc2206eecb5ad2b26cd5934082941b6", + "reference": "d76d2632cfc2206eecb5ad2b26cd5934082941b6", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/event-dispatcher-contracts": "^2.5|^3" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<5.4", + "symfony/service-contracts": "<2.5" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/debug": "~3.4|~4.4", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -559,10 +695,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "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/v3.4.47" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.0" }, "funding": [ { @@ -578,25 +714,105 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2023-07-27T06:52:43+00:00" }, { - "name": "symfony/filesystem", - "version": "v3.4.47", + "name": "symfony/event-dispatcher-contracts", + "version": "v2.5.4", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3" + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e58d7841cddfed6e846829040dca2cca0ebbbbb3", - "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", + "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "psr/event-dispatcher": "^1" + }, + "suggest": { + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "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": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.4" + }, + "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-25T14:11:13+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v6.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/952a8cb588c3bc6ce76f6023000fb932f16a6e59", + "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", "autoload": { @@ -621,10 +837,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v3.4.47" + "source": "https://github.com/symfony/filesystem/tree/v6.4.0" }, "funding": [ { @@ -640,29 +856,40 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2023-07-26T17:27:13+00:00" }, { "name": "symfony/http-foundation", - "version": "v3.4.47", + "version": "v6.4.16", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "b9885fcce6fe494201da4f70a9309770e9d13dc8" + "reference": "431771b7a6f662f1575b3cfc8fd7617aa9864d57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/b9885fcce6fe494201da4f70a9309770e9d13dc8", - "reference": "b9885fcce6fe494201da4f70a9309770e9d13dc8", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/431771b7a6f662f1575b3cfc8fd7617aa9864d57", + "reference": "431771b7a6f662f1575b3cfc8fd7617aa9864d57", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php70": "~1.6" + "symfony/polyfill-php83": "^1.27" + }, + "conflict": { + "symfony/cache": "<6.4.12|>=7.0,<7.1.5" }, "require-dev": { - "symfony/expression-language": "~2.8|~3.0|~4.0" + "doctrine/dbal": "^2.13.1|^3|^4", + "predis/predis": "^1.1|^2.0", + "symfony/cache": "^6.4.12|^7.1.5", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4|^7.0", + "symfony/mime": "^5.4|^6.0|^7.0", + "symfony/rate-limiter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -687,10 +914,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony HttpFoundation Component", + "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v3.4.47" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.16" }, "funding": [ { @@ -706,45 +933,45 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2024-11-13T18:58:10+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -769,7 +996,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" }, "funding": [ { @@ -785,45 +1012,45 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2df51500adbaebdc4c38dea4c89a2e131c45c8a1", - "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" }, "suggest": { "ext-mbstring": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -849,7 +1076,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -865,35 +1092,43 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:27:20+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/polyfill-php70", - "version": "v1.20.0", + "name": "symfony/polyfill-php81", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, - "type": "metapackage", + "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.20-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -908,7 +1143,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -917,7 +1152,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" }, "funding": [ { @@ -933,40 +1168,277 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "twig/twig", - "version": "v1.44.4", + "name": "symfony/polyfill-php83", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "4d400421528e9fa40caaffcf7824c172526dd99d" + "url": "https://github.com/symfony/polyfill-php83.git", + "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/4d400421528e9fa40caaffcf7824c172526dd99d", - "reference": "4d400421528e9fa40caaffcf7824c172526dd99d", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491", + "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "psr/container": "^1.0", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.44-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-0": { - "Twig_": "lib/" + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php83\\": "" }, + "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 8.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php83/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/service-contracts", + "version": "v3.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0", + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "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": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.5.1" + }, + "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-25T14:20:29+00:00" + }, + { + "name": "symfony/var-exporter", + "version": "v7.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-exporter.git", + "reference": "1a6a89f95a46af0f142874c9d650a6358d13070d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/1a6a89f95a46af0f142874c9d650a6358d13070d", + "reference": "1a6a89f95a46af0f142874c9d650a6358d13070d", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "symfony/property-access": "^6.4|^7.0", + "symfony/serializer": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\VarExporter\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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": "Allows exporting any serializable PHP data structure to plain PHP code", + "homepage": "https://symfony.com", + "keywords": [ + "clone", + "construct", + "export", + "hydrate", + "instantiate", + "lazy-loading", + "proxy", + "serialize" + ], + "support": { + "source": "https://github.com/symfony/var-exporter/tree/v7.2.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-10-18T07:58:17+00:00" + }, + { + "name": "twig/twig", + "version": "v3.18.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "acffa88cc2b40dbe42eaf3a5025d6c0d4600cc50" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/acffa88cc2b40dbe42eaf3a5025d6c0d4600cc50", + "reference": "acffa88cc2b40dbe42eaf3a5025d6c0d4600cc50", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php81": "^1.29" + }, + "require-dev": { + "phpstan/phpstan": "^2.0", + "psr/container": "^1.0|^2.0", + "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/Resources/core.php", + "src/Resources/debug.php", + "src/Resources/escaper.php", + "src/Resources/string_loader.php" + ], "psr-4": { "Twig\\": "src/" } @@ -999,7 +1471,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v1.44.4" + "source": "https://github.com/twigphp/Twig/tree/v3.18.0" }, "funding": [ { @@ -1011,7 +1483,7 @@ "type": "tidelift" } ], - "time": "2021-05-16T12:11:20+00:00" + "time": "2024-12-29T10:51:50+00:00" }, { "name": "viharm/php-db-auth", @@ -1211,13 +1683,11 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "php-pushover/php-pushover": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^5.5.9|>=7.0.8", + "php": "^7.4|>=8.1", "ext-curl": "*", "ext-json": "*", "ext-pdo": "*", diff --git a/cron/status.cron.php b/cron/status.cron.php index a4f541e5..f09633ba 100644 --- a/cron/status.cron.php +++ b/cron/status.cron.php @@ -69,7 +69,7 @@ namespace { } $cron_timeout = PSM_CRON_TIMEOUT; -// parse a couple of arguments + // parse a couple of arguments if (!empty($_SERVER['argv'])) { foreach ($_SERVER['argv'] as $argv) { $argi = explode('=', ltrim($argv, '--')); @@ -89,10 +89,10 @@ namespace { } } -// prevent cron from running twice at the same time -// however if the cron has been running for X mins, we'll assume it died and run anyway -// if you want to change PSM_CRON_TIMEOUT, have a look in src/includes/psmconfig.inc.php. -// or you can provide the --timeout=x argument + // prevent cron from running twice at the same time + // however if the cron has been running for X mins, we'll assume it died and run anyway + // if you want to change PSM_CRON_TIMEOUT, have a look in src/includes/psmconfig.inc.php. + // or you can provide the --timeout=x argument $status = null; if (PHP_SAPI === 'cli') { diff --git a/src/config/services.xml b/src/config/services.xml index 43446dcd..4b3f3e24 100644 --- a/src/config/services.xml +++ b/src/config/services.xml @@ -42,16 +42,16 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/sc %db.port% - + - + %path.templates%/%config.theme% - + diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index 3cfe5e38..d1cd3124 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -495,20 +495,15 @@ namespace { $time = strtotime($time); } if ($time < strtotime(date('Y-m-d 00:00:00')) - 60 * 60 * 24 * 3) { - $format = psm_get_lang('system', (date('Y') !== date('Y', $time)) ? - 'long_day_format' : 'short_day_format'); - // Check for Windows to find and replace the %e - // modifier correctly - if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { - $format = preg_replace('#(?= 60 * 60 * 24) { $format = psm_get_lang('system', (date('l', time() - 60 * 60 * 24) == date('l', $time)) ? - 'yesterday_format' : 'other_day_format'); - return strftime($format, $time); + 'yesterday_format' : 'other_day_format'); + return formatLanguage($format, $time); } if ($d >= 60 * 60 * 2) { return sprintf(psm_get_lang('system', 'hours_ago'), intval($d / (60 * 60))); @@ -539,7 +534,7 @@ namespace { if (empty($time) || $time == '0000-00-00 00:00:00') { return psm_get_lang('system', 'never'); } - return strftime('%x %X', strtotime($time)); + return formatLanguage('%x %X', strtotime($time)); } /** @@ -1012,13 +1007,81 @@ namespace { return $decrypted; } - + /** - * Send notification to Telegram - * - * @return string - * @author Tim Zandbergen + * Convert strftime format to php date format + * @param $strftimeformat + * @return string|string[] + * @throws Exception */ + function strftimeFormatToDateFormat($strftimeformat){ + $unsupported = ['%U', '%V', '%C', '%g', '%G']; + $foundunsupported = []; + foreach($unsupported as $unsup){ + if (strpos($strftimeformat, $unsup) !== false){ + $foundunsupported[] = $unsup; + } + } + if (!empty($foundunsupported)){ + throw new \Exception("Found these unsupported chars: ".implode(",", $foundunsupported).' in '.$strftimeformat); + } + // It is important to note that some do not translate accurately ie. lowercase L is supposed to convert to number with a preceding space if it is under 10, there is no accurate conversion so we just use 'g' + $phpdateformat = str_replace( + ['%a','%A','%d','%e','%u','%w','%W','%b','%h','%B','%m','%y','%Y', '%D', '%F', '%x', '%n', '%t', '%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r' /* %I:%M:%S %p */, '%R' /* %H:%M */, '%S', '%T' /* %H:%M:%S */, '%X', '%z', '%Z', + '%c', '%s', + '%%'], + ['D','l', 'd', 'j', 'N', 'w', 'W', 'M', 'M', 'F', 'm', 'y', 'Y', 'm/d/y', 'Y-m-d', 'm/d/y',"\n","\t", 'H', 'G', 'h', 'g', 'i', 'A', 'a', 'h:i:s A', 'H:i', 's', 'H:i:s', 'H:i:s', 'O', 'T', + 'D M j H:i:s Y' /*Tue Feb 5 00:45:10 2009*/, 'U', + '%'], + $strftimeformat + ); + return $phpdateformat; + } + + function formatLanguage(string $formatSTRF,int $timestamp) : string { + $format = strftimeFormatToDateFormat($formatSTRF); + + $dt = new DateTime(); + $dt->setTimestamp($timestamp); + + $language = isset($GLOBALS['sm_lang']) ? $GLOBALS['sm_lang']['locale'][1] : $GLOBALS['sm_lang_default']['locale'][1]; + $curTz = $dt->getTimezone(); + if($curTz->getName() === 'Z'){ + //INTL don't know Z + $curTz = new DateTimeZone('UTC'); + } + + $formatPattern = strtr($format,array( + 'D' => '{#1}', + 'l' => '{#2}', + 'M' => '{#3}', + 'F' => '{#4}', + )); + $strDate = $dt->format($formatPattern); + $regEx = '~\{#\d\}~'; + while(preg_match($regEx,$strDate,$match)) { + $IntlFormat = strtr($match[0],array( + '{#1}' => 'E', + '{#2}' => 'EEEE', + '{#3}' => 'MMM', + '{#4}' => 'MMMM', + )); + $fmt = datefmt_create($language, IntlDateFormatter::FULL, IntlDateFormatter::FULL, + $curTz, IntlDateFormatter::GREGORIAN, $IntlFormat + ); + $replace = $fmt ? datefmt_format( $fmt ,$dt) : "???"; + $strDate = str_replace($match[0], $replace, $strDate); + } + + return $strDate; + } + + /** + * Send notification to Telegram + * + * @return string + * @author Tim Zandbergen + */ class Telegram { private $token; diff --git a/src/psm/Module/AbstractController.php b/src/psm/Module/AbstractController.php index d5cc0187..fb5d2be9 100644 --- a/src/psm/Module/AbstractController.php +++ b/src/psm/Module/AbstractController.php @@ -109,7 +109,7 @@ abstract class AbstractController implements ControllerInterface /** * Twig object - * @var \Twig_Environment $twig + * @var \Twig\Environment $twig */ protected $twig; @@ -146,7 +146,7 @@ abstract class AbstractController implements ControllerInterface */ protected $xhr = false; - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { $this->db = $db; $this->twig = $twig; diff --git a/src/psm/Module/Config/Controller/ConfigController.php b/src/psm/Module/Config/Controller/ConfigController.php index b86931b2..c4448ff6 100644 --- a/src/psm/Module/Config/Controller/ConfigController.php +++ b/src/psm/Module/Config/Controller/ConfigController.php @@ -114,7 +114,7 @@ class ConfigController extends AbstractController private $default_tab = 'general'; - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { parent::__construct($db, $twig); diff --git a/src/psm/Module/ControllerInterface.php b/src/psm/Module/ControllerInterface.php index 672fbe1a..d16fa5bd 100644 --- a/src/psm/Module/ControllerInterface.php +++ b/src/psm/Module/ControllerInterface.php @@ -35,7 +35,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; interface ControllerInterface extends ContainerAwareInterface { - public function __construct(Database $db, \Twig_Environment $twig); + public function __construct(Database $db, \Twig\Environment $twig); /** * Run the controller diff --git a/src/psm/Module/Error/Controller/ErrorController.php b/src/psm/Module/Error/Controller/ErrorController.php index 83d4a0fe..23c1ac20 100644 --- a/src/psm/Module/Error/Controller/ErrorController.php +++ b/src/psm/Module/Error/Controller/ErrorController.php @@ -35,7 +35,7 @@ use psm\Service\Database; class ErrorController extends AbstractController { - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { parent::__construct($db, $twig); diff --git a/src/psm/Module/Install/Controller/InstallController.php b/src/psm/Module/Install/Controller/InstallController.php index d96c958c..1ce9755c 100644 --- a/src/psm/Module/Install/Controller/InstallController.php +++ b/src/psm/Module/Install/Controller/InstallController.php @@ -47,7 +47,7 @@ class InstallController extends AbstractController */ protected $path_config_old; - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { parent::__construct($db, $twig); diff --git a/src/psm/Module/Server/Controller/AbstractServerController.php b/src/psm/Module/Server/Controller/AbstractServerController.php index ffe25e84..a211d90f 100644 --- a/src/psm/Module/Server/Controller/AbstractServerController.php +++ b/src/psm/Module/Server/Controller/AbstractServerController.php @@ -81,7 +81,7 @@ abstract class AbstractServerController extends AbstractController `s`.`active`, `s`.`email`, `s`.`sms`, - `s`.`discord`, + `s`.`discord`, `s`.`webhook`, `s`.`pushover`, `s`.`telegram`, diff --git a/src/psm/Module/Server/Controller/LogController.php b/src/psm/Module/Server/Controller/LogController.php index 39817695..2f68f79b 100644 --- a/src/psm/Module/Server/Controller/LogController.php +++ b/src/psm/Module/Server/Controller/LogController.php @@ -36,7 +36,7 @@ use psm\Service\Database; class LogController extends AbstractServerController { - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { parent::__construct($db, $twig); diff --git a/src/psm/Module/Server/Controller/ServerController.php b/src/psm/Module/Server/Controller/ServerController.php index 6aa3b7c1..97210f74 100644 --- a/src/psm/Module/Server/Controller/ServerController.php +++ b/src/psm/Module/Server/Controller/ServerController.php @@ -42,7 +42,7 @@ class ServerController extends AbstractServerController */ protected $server_id; - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { parent::__construct($db, $twig); @@ -535,14 +535,14 @@ class ServerController extends AbstractServerController 'label' => $server_available['label'], ); } - + $tpl_data['last_output_truncated'] = $tpl_data['last_output']; $tpl_data['last_error_output_truncated'] = $tpl_data['last_error_output']; - + if (strlen($tpl_data['last_output']) > 255) { $tpl_data['last_output_truncated'] = substr($tpl_data['last_output'], 0, 255) . '...'; } - + if (strlen($tpl_data['last_error_output']) > 255) { $tpl_data['last_error_output_truncated'] = substr($tpl_data['last_error_output'], 0, 255) . '...'; } diff --git a/src/psm/Module/Server/Controller/StatusController.php b/src/psm/Module/Server/Controller/StatusController.php index d4ee083d..43dbf2c3 100644 --- a/src/psm/Module/Server/Controller/StatusController.php +++ b/src/psm/Module/Server/Controller/StatusController.php @@ -37,7 +37,7 @@ use psm\Service\Database; class StatusController extends AbstractServerController { - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { parent::__construct($db, $twig); @@ -70,6 +70,13 @@ class StatusController extends AbstractServerController 'layout' => $layout, 'url_save' => psm_build_url(array('mod' => 'server', 'action' => 'edit')), ); + + $auto_refresh_seconds = psm_get_conf('auto_refresh_servers'); + if (intval($auto_refresh_seconds) > 0) { + $this->twig->addGlobal('auto_refresh', true); + $this->twig->addGlobal('auto_refresh_seconds', $auto_refresh_seconds); + } + $this->setHeaderAccessories($this->twig->render('module/server/status/header.tpl.html', $layout_data)); $this->addFooter(false); @@ -107,12 +114,6 @@ class StatusController extends AbstractServerController } } - $auto_refresh_seconds = psm_get_conf('auto_refresh_servers'); - if (intval($auto_refresh_seconds) > 0) { - $this->twig->addGlobal('auto_refresh', true); - $this->twig->addGlobal('auto_refresh_seconds', $auto_refresh_seconds); - } - if ($this->isXHR() || isset($_SERVER["HTTP_X_REQUESTED_WITH"])) { $this->xhr = true; //disable auto refresh in ajax return html diff --git a/src/psm/Module/Server/Controller/UpdateController.php b/src/psm/Module/Server/Controller/UpdateController.php index d2addcac..8b92c7b9 100644 --- a/src/psm/Module/Server/Controller/UpdateController.php +++ b/src/psm/Module/Server/Controller/UpdateController.php @@ -36,7 +36,7 @@ use psm\Service\Database; class UpdateController extends AbstractController { - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { parent::__construct($db, $twig); diff --git a/src/psm/Module/User/Controller/LoginController.php b/src/psm/Module/User/Controller/LoginController.php index ca62f587..1e248d00 100644 --- a/src/psm/Module/User/Controller/LoginController.php +++ b/src/psm/Module/User/Controller/LoginController.php @@ -35,7 +35,7 @@ use psm\Service\Database; class LoginController extends AbstractController { - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { parent::__construct($db, $twig); diff --git a/src/psm/Module/User/Controller/ProfileController.php b/src/psm/Module/User/Controller/ProfileController.php index 6b9b0cf1..2c285a43 100644 --- a/src/psm/Module/User/Controller/ProfileController.php +++ b/src/psm/Module/User/Controller/ProfileController.php @@ -41,7 +41,7 @@ class ProfileController extends AbstractController protected $profile_fields = array('name', 'user_name', 'email', 'mobile', 'pushover_key', 'pushover_device', 'discord', 'webhook_url', 'webhook_json', 'telegram_id', 'jabber'); - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { parent::__construct($db, $twig); diff --git a/src/psm/Module/User/Controller/UserController.php b/src/psm/Module/User/Controller/UserController.php index ba55a0e2..5423eee0 100644 --- a/src/psm/Module/User/Controller/UserController.php +++ b/src/psm/Module/User/Controller/UserController.php @@ -39,7 +39,7 @@ class UserController extends AbstractController { public $servers = array(); - public function __construct(Database $db, \Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { parent::__construct($db, $twig); diff --git a/src/psm/Router.php b/src/psm/Router.php index 41533989..5ed5c634 100644 --- a/src/psm/Router.php +++ b/src/psm/Router.php @@ -231,7 +231,7 @@ class Router } $twig->addFunction( - new \Twig_SimpleFunction( + new \Twig\TwigFunction( 'csrf_token', function ($lock_to = null) use ($session) { if (empty($lock_to)) { diff --git a/src/psm/Util/Module/Modal.php b/src/psm/Util/Module/Modal.php index 21176096..ce5e4c9e 100644 --- a/src/psm/Util/Module/Modal.php +++ b/src/psm/Util/Module/Modal.php @@ -67,11 +67,11 @@ class Modal implements ModalInterface /** * Twig environment - * @var \Twig_Environment $twig + * @var \Twig\Environment $twig */ protected $twig; - public function __construct(\Twig_Environment $twig, $modal_id = 'main', $type = self::MODAL_TYPE_OK) + public function __construct(\Twig\Environment $twig, $modal_id = 'main', $type = self::MODAL_TYPE_OK) { $this->modal_id = $modal_id; $this->twig = $twig; @@ -142,7 +142,7 @@ class Modal implements ModalInterface } } - $tpl = $this->twig->loadTemplate('util/module/modal.tpl.html'); + $tpl = $this->twig->load('util/module/modal.tpl.html'); $html = $tpl->render(array( 'modal_id' => $this->modal_id, 'modal_title' => !empty($this->title) ? $this->title : psm_get_conf('site_title', psm_get_lang('system', 'title')), diff --git a/src/psm/Util/Module/ModalInterface.php b/src/psm/Util/Module/ModalInterface.php index a7d79bb3..e5c0d2c6 100644 --- a/src/psm/Util/Module/ModalInterface.php +++ b/src/psm/Util/Module/ModalInterface.php @@ -32,7 +32,7 @@ namespace psm\Util\Module; interface ModalInterface { - public function __construct(\Twig_Environment $twig); + public function __construct(\Twig\Environment $twig); public function getModalID(); public function createHTML(); diff --git a/src/psm/Util/Module/Sidebar.php b/src/psm/Util/Module/Sidebar.php index 26f05c0d..ae16726d 100644 --- a/src/psm/Util/Module/Sidebar.php +++ b/src/psm/Util/Module/Sidebar.php @@ -57,7 +57,7 @@ class Sidebar implements SidebarInterface */ protected $twig; - public function __construct(\Twig_Environment $twig) + public function __construct(\Twig\Environment $twig) { $this->twig = $twig; } @@ -182,7 +182,7 @@ class Sidebar implements SidebarInterface } } - $tpl = $this->twig->loadTemplate('util/module/sidebar.tpl.html'); + $tpl = $this->twig->load('util/module/sidebar.tpl.html'); $html = $tpl->render($tpl_data); return $html; diff --git a/src/psm/Util/Module/SidebarInterface.php b/src/psm/Util/Module/SidebarInterface.php index f99775a7..a7e4eb4b 100644 --- a/src/psm/Util/Module/SidebarInterface.php +++ b/src/psm/Util/Module/SidebarInterface.php @@ -31,7 +31,7 @@ namespace psm\Util\Module; interface SidebarInterface { - public function __construct(\Twig_Environment $twig); + public function __construct(\Twig\Environment $twig); public function createHTML(); } diff --git a/src/psm/Util/Server/HistoryGraph.php b/src/psm/Util/Server/HistoryGraph.php index c61e07b5..d295ff57 100644 --- a/src/psm/Util/Server/HistoryGraph.php +++ b/src/psm/Util/Server/HistoryGraph.php @@ -32,7 +32,7 @@ namespace psm\Util\Server; use DateTime; use psm\Service\Database; use Twig\Error\Error; -use Twig_Environment; +use Twig\Environment; /** * History util, create HTML for server graphs @@ -52,7 +52,7 @@ class HistoryGraph */ protected $twig; - public function __construct(Database $db, Twig_Environment $twig) + public function __construct(Database $db, \Twig\Environment $twig) { $this->db = $db; $this->twig = $twig; @@ -310,7 +310,7 @@ class HistoryGraph // Previous datapoint was offline : ['x' => $time_ms, 'y' => null]; // new outage start - $lines['offline'][] = ['x' => $time_ms, 'y' => $highest_latency]; + $lines['offline'][] = ['x' => $time_ms, 'y' => 0]; if ($prev_downtime === 0) { $prev_downtime = $time; @@ -322,7 +322,7 @@ class HistoryGraph // Previous datapoint was online ? ['x' => $time_ms, 'y' => null] // Previous datapoint was offline - : ['x' => $time_ms, 'y' => $highest_latency]; + : ['x' => $time_ms, 'y' => 0]; $lines['online'][] = ['x' => $time_ms, 'y' => round($record['latency'] * 1000, 3)]; if ($prev_downtime !== 0) { diff --git a/src/templates/default/module/server/server/view.tpl.html b/src/templates/default/module/server/server/view.tpl.html index e6d37498..76be3990 100644 --- a/src/templates/default/module/server/server/view.tpl.html +++ b/src/templates/default/module/server/server/view.tpl.html @@ -237,7 +237,7 @@
  • {{ label_last_output }}:
    -
    {{ last_output_truncated|nl2br }}
    +
    {{ last_output_truncated|raw|nl2br }}
    {% if last_output_truncated != last_output %}
    @@ -420,7 +420,7 @@