diff --git a/composer.lock b/composer.lock index dfaed67ff..b288870e4 100644 --- a/composer.lock +++ b/composer.lock @@ -203,7 +203,7 @@ "version": "1.12.4", "source": { "type": "git", - "url": "https://github.com/jquery/jquery-dist.git", + "url": "git@github.com:jquery/jquery-dist.git", "reference": "5e89585e0121e72ff47de177c5ef604f3089a53d" }, "dist": { @@ -242,7 +242,7 @@ "version": "v2.2.1", "source": { "type": "git", - "url": "https://github.com/js-cookie/js-cookie.git", + "url": "git@github.com:js-cookie/js-cookie.git", "reference": "54962f884e9ae33f93e13ac903ffaf1d5a523598" }, "dist": { @@ -602,12 +602,12 @@ "source": { "type": "git", "url": "https://github.com/predis/predis.git", - "reference": "bb8cce7bcf0d790dd17dde01922230d411efb99b" + "reference": "deee2b6d605eb6401446f6f6354414ab7571a5a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/predis/predis/zipball/bb8cce7bcf0d790dd17dde01922230d411efb99b", - "reference": "bb8cce7bcf0d790dd17dde01922230d411efb99b", + "url": "https://api.github.com/repos/predis/predis/zipball/deee2b6d605eb6401446f6f6354414ab7571a5a0", + "reference": "deee2b6d605eb6401446f6f6354414ab7571a5a0", "shasum": "" }, "require": { @@ -660,7 +660,7 @@ "type": "github" } ], - "time": "2023-01-10T16:48:39+00:00" + "time": "2023-09-19T16:11:21+00:00" }, { "name": "psr/simple-cache", @@ -830,16 +830,16 @@ }, { "name": "shish/ffsphp", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/shish/ffsphp.git", - "reference": "47d7e96a129502275fb8a4ae0c4f36bd3f59e95b" + "reference": "a2a1f0fe59606b90460513b48bacb442630dd253" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/shish/ffsphp/zipball/47d7e96a129502275fb8a4ae0c4f36bd3f59e95b", - "reference": "47d7e96a129502275fb8a4ae0c4f36bd3f59e95b", + "url": "https://api.github.com/repos/shish/ffsphp/zipball/a2a1f0fe59606b90460513b48bacb442630dd253", + "reference": "a2a1f0fe59606b90460513b48bacb442630dd253", "shasum": "" }, "require": { @@ -873,9 +873,9 @@ "homepage": "https://github.com/shish/ffsphp", "support": { "issues": "https://github.com/shish/ffsphp/issues", - "source": "https://github.com/shish/ffsphp/tree/v1.1.0" + "source": "https://github.com/shish/ffsphp/tree/v1.2.0" }, - "time": "2023-02-04T12:34:44+00:00" + "time": "2023-08-28T15:51:16+00:00" }, { "name": "shish/gqla", @@ -932,16 +932,16 @@ }, { "name": "shish/microcrud", - "version": "v2.1.0", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/shish/microcrud.git", - "reference": "c7398edf6b1ed0ee508769a73d656deca8f6a4be" + "reference": "8f0c38af61e2543c2e11ad6face37ae34e4571cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/shish/microcrud/zipball/c7398edf6b1ed0ee508769a73d656deca8f6a4be", - "reference": "c7398edf6b1ed0ee508769a73d656deca8f6a4be", + "url": "https://api.github.com/repos/shish/microcrud/zipball/8f0c38af61e2543c2e11ad6face37ae34e4571cf", + "reference": "8f0c38af61e2543c2e11ad6face37ae34e4571cf", "shasum": "" }, "require": { @@ -981,9 +981,9 @@ ], "support": { "issues": "https://github.com/shish/microcrud/issues", - "source": "https://github.com/shish/microcrud/tree/v2.1.0" + "source": "https://github.com/shish/microcrud/tree/v2.1.1" }, - "time": "2023-02-04T13:09:53+00:00" + "time": "2023-11-11T21:25:53+00:00" }, { "name": "shish/microhtml", @@ -1121,16 +1121,16 @@ }, { "name": "webonyx/graphql-php", - "version": "v15.4.0", + "version": "v15.7.0", "source": { "type": "git", "url": "https://github.com/webonyx/graphql-php.git", - "reference": "99290f7945a5b39ad823f7600fa196de62597e9d" + "reference": "44ff70977ee020c0b24bfdfaf947be56943de505" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/99290f7945a5b39ad823f7600fa196de62597e9d", - "reference": "99290f7945a5b39ad823f7600fa196de62597e9d", + "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/44ff70977ee020c0b24bfdfaf947be56943de505", + "reference": "44ff70977ee020c0b24bfdfaf947be56943de505", "shasum": "" }, "require": { @@ -1141,20 +1141,21 @@ "require-dev": { "amphp/amp": "^2.6", "amphp/http-server": "^2.1", - "dms/phpunit-arraysubset-asserts": "^0.4", + "dms/phpunit-arraysubset-asserts": "dev-master", "ergebnis/composer-normalize": "^2.28", - "mll-lab/php-cs-fixer-config": "^5.0", + "friendsofphp/php-cs-fixer": "3.30.0", + "mll-lab/php-cs-fixer-config": "^5", "nyholm/psr7": "^1.5", "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "1.10.15", - "phpstan/phpstan-phpunit": "1.3.11", + "phpstan/phpstan": "1.10.37", + "phpstan/phpstan-phpunit": "1.3.14", "phpstan/phpstan-strict-rules": "1.5.1", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.5 || ^10", "psr/http-message": "^1 || ^2", "react/http": "^1.6", "react/promise": "^2.9", - "rector/rector": "^0.16.0", + "rector/rector": "^0.18", "symfony/polyfill-php81": "^1.23", "symfony/var-exporter": "^5 || ^6", "thecodingmachine/safe": "^1.3 || ^2" @@ -1182,7 +1183,7 @@ ], "support": { "issues": "https://github.com/webonyx/graphql-php/issues", - "source": "https://github.com/webonyx/graphql-php/tree/v15.4.0" + "source": "https://github.com/webonyx/graphql-php/tree/v15.7.0" }, "funding": [ { @@ -1190,7 +1191,7 @@ "type": "open_collective" } ], - "time": "2023-05-11T10:26:08+00:00" + "time": "2023-10-04T09:10:34+00:00" } ], "packages-dev": [ @@ -1200,12 +1201,12 @@ "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", "shasum": "" }, "require": { @@ -1248,7 +1249,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.0" + "source": "https://github.com/composer/pcre/tree/3.1.1" }, "funding": [ { @@ -1264,7 +1265,7 @@ "type": "tidelift" } ], - "time": "2022-11-17T09:50:14+00:00" + "time": "2023-10-11T07:11:09+00:00" }, { "name": "composer/semver", @@ -1272,12 +1273,12 @@ "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "fa1ec24f0ab1efe642671ec15c51a3ab879f59bf" + "reference": "1d09200268e7d1052ded8e5da9c73c96a63d18f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/fa1ec24f0ab1efe642671ec15c51a3ab879f59bf", - "reference": "fa1ec24f0ab1efe642671ec15c51a3ab879f59bf", + "url": "https://api.github.com/repos/composer/semver/zipball/1d09200268e7d1052ded8e5da9c73c96a63d18f5", + "reference": "1d09200268e7d1052ded8e5da9c73c96a63d18f5", "shasum": "" }, "require": { @@ -1346,7 +1347,7 @@ "type": "tidelift" } ], - "time": "2023-01-13T15:47:53+00:00" + "time": "2023-08-31T12:20:31+00:00" }, { "name": "composer/xdebug-handler", @@ -1420,12 +1421,12 @@ "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "4b68cf86b766ec429f4f68af648817cdfb360582" + "reference": "94f40ad7ecbc6931958faa8a57c48dce5da2b468" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/4b68cf86b766ec429f4f68af648817cdfb360582", - "reference": "4b68cf86b766ec429f4f68af648817cdfb360582", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/94f40ad7ecbc6931958faa8a57c48dce5da2b468", + "reference": "94f40ad7ecbc6931958faa8a57c48dce5da2b468", "shasum": "" }, "require": { @@ -1489,78 +1490,36 @@ "issues": "https://github.com/doctrine/annotations/issues", "source": "https://github.com/doctrine/annotations/tree/2.0.x" }, - "time": "2023-03-27T17:43:32+00:00" - }, - { - "name": "doctrine/deprecations", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "shasum": "" - }, - "require": { - "php": "^7.1|^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5|^8.5|^9.5", - "psr/log": "^1|^2|^3" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "support": { - "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" - }, - "time": "2022-05-02T15:47:09+00:00" + "time": "2023-08-23T17:36:07+00:00" }, { "name": "doctrine/instantiator", - "version": "1.5.x-dev", + "version": "2.0.x-dev", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "f49f6a836a816609c853718ba2ea422dc18a8e4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f49f6a836a816609c853718ba2ea422dc18a8e4a", + "reference": "f49f6a836a816609c853718ba2ea422dc18a8e4a", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^10.1.0", + "vimeo/psalm": "^5.4" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -1586,7 +1545,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.x" }, "funding": [ { @@ -1602,34 +1561,32 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2023-08-24T20:23:35+00:00" }, { "name": "doctrine/lexer", - "version": "2.1.x-dev", + "version": "3.1.x-dev", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "e74756f7517d72c238b9163fcd1ed54eb1f92bd0" + "reference": "0d54c073afb397d5896df60cc34170cf37dfad5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e74756f7517d72c238b9163fcd1ed54eb1f92bd0", - "reference": "e74756f7517d72c238b9163fcd1ed54eb1f92bd0", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/0d54c073afb397d5896df60cc34170cf37dfad5e", + "reference": "0d54c073afb397d5896df60cc34170cf37dfad5e", "shasum": "" }, "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^9.5", "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^4.11 || ^5.0" + "vimeo/psalm": "^5.0" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -1665,7 +1622,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/2.1.x" + "source": "https://github.com/doctrine/lexer/tree/3.1.x" }, "funding": [ { @@ -1681,27 +1638,25 @@ "type": "tidelift" } ], - "time": "2022-12-29T09:22:42+00:00" + "time": "2023-07-05T07:23:35+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.17.0", + "version": "v3.38.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "3f0ed862f22386c55a767461ef5083bddceeed79" + "reference": "7e6070026e76aa09d77a47519625c86593fb8e31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/3f0ed862f22386c55a767461ef5083bddceeed79", - "reference": "3f0ed862f22386c55a767461ef5083bddceeed79", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7e6070026e76aa09d77a47519625c86593fb8e31", + "reference": "7e6070026e76aa09d77a47519625c86593fb8e31", "shasum": "" }, "require": { "composer/semver": "^3.3", "composer/xdebug-handler": "^3.0.3", - "doctrine/annotations": "^2", - "doctrine/lexer": "^2 || ^3", "ext-json": "*", "ext-tokenizer": "*", "php": "^7.4 || ^8.0", @@ -1718,6 +1673,7 @@ "symfony/stopwatch": "^5.4 || ^6.0" }, "require-dev": { + "facile-it/paraunit": "^1.3 || ^2.0", "justinrainbow/json-schema": "^5.2", "keradus/cli-executor": "^2.0", "mikey179/vfsstream": "^1.6.11", @@ -1728,8 +1684,6 @@ "phpspec/prophecy": "^1.16", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "phpunitgoodpractices/polyfill": "^1.6", - "phpunitgoodpractices/traits": "^1.9.2", "symfony/phpunit-bridge": "^6.2.3", "symfony/yaml": "^5.4 || ^6.0" }, @@ -1769,7 +1723,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.17.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.38.0" }, "funding": [ { @@ -1777,26 +1731,26 @@ "type": "github" } ], - "time": "2023-05-22T19:59:32+00:00" + "time": "2023-11-07T08:44:54+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.7.x-dev", + "version": "7.9.x-dev", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5" + "reference": "d95d9ab74822c2ca06b31477cd6775a4a299b8e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/fb7566caccf22d74d1ab270de3551f72a58399f5", - "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d95d9ab74822c2ca06b31477cd6775a4a299b8e8", + "reference": "d95d9ab74822c2ca06b31477cd6775a4a299b8e8", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0", - "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", + "guzzlehttp/promises": "^1.5.3 || ^2.0.1", + "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -1817,7 +1771,6 @@ "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, - "default-branch": true, "type": "library", "extra": { "bamarni-bin": { @@ -1888,7 +1841,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.7.0" + "source": "https://github.com/guzzle/guzzle/tree/7.8" }, "funding": [ { @@ -1904,7 +1857,7 @@ "type": "tidelift" } ], - "time": "2023-05-21T14:04:53+00:00" + "time": "2023-09-11T09:12:01+00:00" }, { "name": "guzzlehttp/promises", @@ -1912,12 +1865,12 @@ "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "4a94655427efd6906ed3eb628c79693291264713" + "reference": "71b12f952d8be69a239989db2fe08314a5189e3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/4a94655427efd6906ed3eb628c79693291264713", - "reference": "4a94655427efd6906ed3eb628c79693291264713", + "url": "https://api.github.com/repos/guzzle/promises/zipball/71b12f952d8be69a239989db2fe08314a5189e3b", + "reference": "71b12f952d8be69a239989db2fe08314a5189e3b", "shasum": "" }, "require": { @@ -1988,7 +1941,7 @@ "type": "tidelift" } ], - "time": "2023-05-21T19:15:14+00:00" + "time": "2023-08-27T10:15:36+00:00" }, { "name": "guzzlehttp/psr7", @@ -1996,12 +1949,12 @@ "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6" + "reference": "38ef514a6c21335f29d9be64b097d2582ecbf8e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/b635f279edd83fc275f822a1188157ffea568ff6", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/38ef514a6c21335f29d9be64b097d2582ecbf8e4", + "reference": "38ef514a6c21335f29d9be64b097d2582ecbf8e4", "shasum": "" }, "require": { @@ -2022,6 +1975,7 @@ "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, + "default-branch": true, "type": "library", "extra": { "bamarni-bin": { @@ -2088,7 +2042,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.5.0" + "source": "https://github.com/guzzle/psr7/tree/2.6" }, "funding": [ { @@ -2104,7 +2058,7 @@ "type": "tidelift" } ], - "time": "2023-04-17T16:11:26+00:00" + "time": "2023-09-10T16:11:14+00:00" }, { "name": "jms/metadata", @@ -2112,19 +2066,19 @@ "source": { "type": "git", "url": "https://github.com/schmittjoh/metadata.git", - "reference": "7ca240dcac0c655eb15933ee55736ccd2ea0d7a6" + "reference": "1e72a1482cb6faa15915ba79086fa42a0ed2ec54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/7ca240dcac0c655eb15933ee55736ccd2ea0d7a6", - "reference": "7ca240dcac0c655eb15933ee55736ccd2ea0d7a6", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/1e72a1482cb6faa15915ba79086fa42a0ed2ec54", + "reference": "1e72a1482cb6faa15915ba79086fa42a0ed2ec54", "shasum": "" }, "require": { "php": "^7.2|^8.0" }, "require-dev": { - "doctrine/cache": "^1.0", + "doctrine/cache": "^1.0|^2.0", "doctrine/coding-standard": "^8.0", "mikey179/vfsstream": "^1.6.7", "phpunit/phpunit": "^8.5|^9.0", @@ -2167,9 +2121,9 @@ ], "support": { "issues": "https://github.com/schmittjoh/metadata/issues", - "source": "https://github.com/schmittjoh/metadata/tree/2.8.0" + "source": "https://github.com/schmittjoh/metadata/tree/master" }, - "time": "2023-02-15T13:44:18+00:00" + "time": "2023-08-04T08:12:29+00:00" }, { "name": "jms/serializer", @@ -2177,43 +2131,43 @@ "source": { "type": "git", "url": "https://github.com/schmittjoh/serializer.git", - "reference": "d5cc4674015e362370cbd370948e2ae03496a7cc" + "reference": "f24027583f8ad3c1789bff412b039013132316ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/d5cc4674015e362370cbd370948e2ae03496a7cc", - "reference": "d5cc4674015e362370cbd370948e2ae03496a7cc", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/f24027583f8ad3c1789bff412b039013132316ac", + "reference": "f24027583f8ad3c1789bff412b039013132316ac", "shasum": "" }, "require": { - "doctrine/annotations": "^1.13 || ^2.0", - "doctrine/instantiator": "^1.0.3", - "doctrine/lexer": "^1.1 || ^2", + "doctrine/annotations": "^1.14 || ^2.0", + "doctrine/instantiator": "^1.3.1 || ^2.0", + "doctrine/lexer": "^2.0 || ^3.0", "jms/metadata": "^2.6", - "php": "^7.2||^8.0", - "phpstan/phpdoc-parser": "^0.4 || ^0.5 || ^1.0" + "php": "^7.2 || ^8.0", + "phpstan/phpdoc-parser": "^1.20" }, "require-dev": { - "doctrine/coding-standard": "^8.1", - "doctrine/orm": "~2.1", - "doctrine/persistence": "^1.3.3|^2.0|^3.0", - "doctrine/phpcr-odm": "^1.3|^2.0", + "doctrine/coding-standard": "^12.0", + "doctrine/orm": "^2.14", + "doctrine/persistence": "^2.5.2 || ^3.0", + "doctrine/phpcr-odm": "^1.5.2 || ^2.0", "ext-pdo_sqlite": "*", - "jackalope/jackalope-doctrine-dbal": "^1.1.5", - "ocramius/proxy-manager": "^1.0|^2.0", + "jackalope/jackalope-doctrine-dbal": "^1.3", + "ocramius/proxy-manager": "^1.0 || ^2.0", "phpbench/phpbench": "^1.0", "phpstan/phpstan": "^1.0.2", - "phpunit/phpunit": "^8.5.21||^9.0||^10.0", - "psr/container": "^1.0|^2.0", - "symfony/dependency-injection": "^3.0|^4.0|^5.0|^6.0", - "symfony/expression-language": "^3.2|^4.0|^5.0|^6.0", - "symfony/filesystem": "^3.0|^4.0|^5.0|^6.0", - "symfony/form": "^3.0|^4.0|^5.0|^6.0", - "symfony/translation": "^3.0|^4.0|^5.0|^6.0", - "symfony/uid": "^5.1|^6.0", - "symfony/validator": "^3.1.9|^4.0|^5.0|^6.0", - "symfony/yaml": "^3.3|^4.0|^5.0|^6.0", - "twig/twig": "~1.34|~2.4|^3.0" + "phpunit/phpunit": "^8.5.21 || ^9.0 || ^10.0", + "psr/container": "^1.0 || ^2.0", + "symfony/dependency-injection": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "symfony/expression-language": "^3.2 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "symfony/filesystem": "^4.2 || ^5.0 || ^6.0 || ^7.0", + "symfony/form": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "symfony/translation": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "symfony/uid": "^5.1 || ^6.0 || ^7.0", + "symfony/validator": "^3.1.9 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "twig/twig": "^1.34 || ^2.4 || ^3.0" }, "suggest": { "doctrine/collections": "Required if you like to use doctrine collection types as ArrayCollection.", @@ -2266,7 +2220,7 @@ "type": "github" } ], - "time": "2023-05-18T04:58:29+00:00" + "time": "2023-10-29T15:36:01+00:00" }, { "name": "myclabs/deep-copy", @@ -2274,12 +2228,12 @@ "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "928a96f585b86224ebc78f8f09d0482cf15b04f5" + "reference": "202aaf6b7c2e1e0a622b0298e9f3f537e4d84018" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/928a96f585b86224ebc78f8f09d0482cf15b04f5", - "reference": "928a96f585b86224ebc78f8f09d0482cf15b04f5", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/202aaf6b7c2e1e0a622b0298e9f3f537e4d84018", + "reference": "202aaf6b7c2e1e0a622b0298e9f3f537e4d84018", "shasum": "" }, "require": { @@ -2327,7 +2281,7 @@ "type": "tidelift" } ], - "time": "2023-03-08T17:24:01+00:00" + "time": "2023-11-01T08:01:43+00:00" }, { "name": "nikic/php-parser", @@ -2335,12 +2289,12 @@ "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c9e5a13d68486e9fd75f9be1b4639644e54e7f4f" + "reference": "402b6cf3452c21c58aa11d9549cee6205d14e347" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c9e5a13d68486e9fd75f9be1b4639644e54e7f4f", - "reference": "c9e5a13d68486e9fd75f9be1b4639644e54e7f4f", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/402b6cf3452c21c58aa11d9549cee6205d14e347", + "reference": "402b6cf3452c21c58aa11d9549cee6205d14e347", "shasum": "" }, "require": { @@ -2351,7 +2305,6 @@ "ircmaxell/php-yacc": "^0.0.7", "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, - "default-branch": true, "bin": [ "bin/php-parse" ], @@ -2384,7 +2337,7 @@ "issues": "https://github.com/nikic/PHP-Parser/issues", "source": "https://github.com/nikic/PHP-Parser/tree/4.x" }, - "time": "2023-05-21T19:22:47+00:00" + "time": "2023-11-01T20:31:02+00:00" }, { "name": "phar-io/manifest", @@ -2392,12 +2345,12 @@ "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "36d8a21e851a9512db2b086dc5ac2c61308f0138" + "reference": "67729272c564ab9f953c81f48db44e8b1cb1e1c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/36d8a21e851a9512db2b086dc5ac2c61308f0138", - "reference": "36d8a21e851a9512db2b086dc5ac2c61308f0138", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/67729272c564ab9f953c81f48db44e8b1cb1e1c3", + "reference": "67729272c564ab9f953c81f48db44e8b1cb1e1c3", "shasum": "" }, "require": { @@ -2406,7 +2359,7 @@ "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" + "php": "^7.3 || ^8.0" }, "default-branch": true, "type": "library", @@ -2452,7 +2405,7 @@ "type": "github" } ], - "time": "2022-02-21T19:55:33+00:00" + "time": "2023-06-01T14:19:47+00:00" }, { "name": "phar-io/version", @@ -2583,22 +2536,23 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.21.x-dev", + "version": "1.24.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "7f78fd1ff463a7884a331fdb84a25f724dbfd9ea" + "reference": "bcad8d995980440892759db0c32acae7c8e79442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/7f78fd1ff463a7884a331fdb84a25f724dbfd9ea", - "reference": "7f78fd1ff463a7884a331fdb84a25f724dbfd9ea", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442", + "reference": "bcad8d995980440892759db0c32acae7c8e79442", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { + "doctrine/annotations": "^2.0", "nikic/php-parser": "^4.15", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", @@ -2608,7 +2562,6 @@ "phpunit/phpunit": "^9.5", "symfony/process": "^5.2" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -2624,9 +2577,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.x" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2" }, - "time": "2023-05-17T16:44:57+00:00" + "time": "2023-09-26T12:28:12+00:00" }, { "name": "phpstan/phpstan", @@ -2634,12 +2587,12 @@ "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "42afb02dce13d12623865f068f32ad340ee8ed6f" + "reference": "2fa2aa0de39a1ac2d44d3a0a03f7586720882635" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/42afb02dce13d12623865f068f32ad340ee8ed6f", - "reference": "42afb02dce13d12623865f068f32ad340ee8ed6f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2fa2aa0de39a1ac2d44d3a0a03f7586720882635", + "reference": "2fa2aa0de39a1ac2d44d3a0a03f7586720882635", "shasum": "" }, "require": { @@ -2688,7 +2641,7 @@ "type": "tidelift" } ], - "time": "2023-05-25T11:20:07+00:00" + "time": "2023-11-11T20:39:57+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2696,12 +2649,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "100663232669bdacd3ac18f4cc12c38beec9aff1" + "reference": "00bc23209e885ae1aab33c9a2303b0eb8ebd5c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/100663232669bdacd3ac18f4cc12c38beec9aff1", - "reference": "100663232669bdacd3ac18f4cc12c38beec9aff1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/00bc23209e885ae1aab33c9a2303b0eb8ebd5c28", + "reference": "00bc23209e885ae1aab33c9a2303b0eb8ebd5c28", "shasum": "" }, "require": { @@ -2766,7 +2719,7 @@ "type": "github" } ], - "time": "2023-05-25T06:20:28+00:00" + "time": "2023-11-09T06:48:38+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3015,12 +2968,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9d8ffd638716761de07b60262fceb553cb4afcd9" + "reference": "3e2444b311b9bcca7c8b5294dc0c27a3fec0832a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9d8ffd638716761de07b60262fceb553cb4afcd9", - "reference": "9d8ffd638716761de07b60262fceb553cb4afcd9", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e2444b311b9bcca7c8b5294dc0c27a3fec0832a", + "reference": "3e2444b311b9bcca7c8b5294dc0c27a3fec0832a", "shasum": "" }, "require": { @@ -3035,7 +2988,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-code-coverage": "^9.2.28", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -3110,7 +3063,7 @@ "type": "tidelift" } ], - "time": "2023-05-25T06:23:23+00:00" + "time": "2023-11-09T06:47:38+00:00" }, { "name": "psr/cache", @@ -3171,12 +3124,12 @@ "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "90db7b9ac2a2c5b849fcb69dde58f3ae182c68f5" + "reference": "707984727bd5b2b670e59559d3ed2500240cf875" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/90db7b9ac2a2c5b849fcb69dde58f3ae182c68f5", - "reference": "90db7b9ac2a2c5b849fcb69dde58f3ae182c68f5", + "url": "https://api.github.com/repos/php-fig/container/zipball/707984727bd5b2b670e59559d3ed2500240cf875", + "reference": "707984727bd5b2b670e59559d3ed2500240cf875", "shasum": "" }, "require": { @@ -3215,9 +3168,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/master" + "source": "https://github.com/php-fig/container" }, - "time": "2022-07-19T17:36:59+00:00" + "time": "2023-09-22T11:11:30+00:00" }, { "name": "psr/event-dispatcher", @@ -3225,12 +3178,12 @@ "source": { "type": "git", "url": "https://github.com/php-fig/event-dispatcher.git", - "reference": "e275e2d67d53964a3f13e056886ecd769edee021" + "reference": "977ffcf551e3bfb73d90aac3e8e1583fd8d2f89a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/e275e2d67d53964a3f13e056886ecd769edee021", - "reference": "e275e2d67d53964a3f13e056886ecd769edee021", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/977ffcf551e3bfb73d90aac3e8e1583fd8d2f89a", + "reference": "977ffcf551e3bfb73d90aac3e8e1583fd8d2f89a", "shasum": "" }, "require": { @@ -3268,9 +3221,9 @@ "psr-14" ], "support": { - "source": "https://github.com/php-fig/event-dispatcher/tree/master" + "source": "https://github.com/php-fig/event-dispatcher" }, - "time": "2022-06-29T17:22:39+00:00" + "time": "2023-09-22T11:10:57+00:00" }, { "name": "psr/http-client", @@ -3278,12 +3231,12 @@ "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { @@ -3321,9 +3274,9 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/1.0.2" + "source": "https://github.com/php-fig/http-client" }, - "time": "2023-04-10T20:12:12+00:00" + "time": "2023-09-23T14:17:50+00:00" }, { "name": "psr/http-factory", @@ -3331,12 +3284,12 @@ "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "6d70f402f0eddb2b154b22950b5381bbf5b28469" + "reference": "7037f4b0950474e9d1350e8df89b15f1842085f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/6d70f402f0eddb2b154b22950b5381bbf5b28469", - "reference": "6d70f402f0eddb2b154b22950b5381bbf5b28469", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/7037f4b0950474e9d1350e8df89b15f1842085f6", + "reference": "7037f4b0950474e9d1350e8df89b15f1842085f6", "shasum": "" }, "require": { @@ -3377,9 +3330,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2023-05-17T18:32:11+00:00" + "time": "2023-09-22T11:16:44+00:00" }, { "name": "psr/http-message", @@ -4086,12 +4039,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bde739e7565280bda77be70044ac1047bc007e34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", "shasum": "" }, "require": { @@ -4134,7 +4087,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0" }, "funding": [ { @@ -4142,7 +4095,7 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2023-08-02T09:26:13+00:00" }, { "name": "sebastian/lines-of-code", @@ -4546,12 +4499,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6d340bfbfc082c9ed7eec4844f12132a26b2d344" + "reference": "380ae25f02e34809fba16fa387191f1da9852778" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6d340bfbfc082c9ed7eec4844f12132a26b2d344", - "reference": "6d340bfbfc082c9ed7eec4844f12132a26b2d344", + "url": "https://api.github.com/repos/symfony/console/zipball/380ae25f02e34809fba16fa387191f1da9852778", + "reference": "380ae25f02e34809fba16fa387191f1da9852778", "shasum": "" }, "require": { @@ -4576,8 +4529,12 @@ "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", @@ -4628,11 +4585,11 @@ "type": "tidelift" } ], - "time": "2023-05-23T16:34:37+00:00" + "time": "2023-11-02T13:23:55+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "3.4.x-dev", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", @@ -4647,6 +4604,7 @@ "require": { "php": ">=8.1" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -4679,7 +4637,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/3.4" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -4703,12 +4661,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "9ebe352542105f5f7186610a83deb18b90fae3d3" + "reference": "d76d2632cfc2206eecb5ad2b26cd5934082941b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9ebe352542105f5f7186610a83deb18b90fae3d3", - "reference": "9ebe352542105f5f7186610a83deb18b90fae3d3", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d76d2632cfc2206eecb5ad2b26cd5934082941b6", + "reference": "d76d2632cfc2206eecb5ad2b26cd5934082941b6", "shasum": "" }, "require": { @@ -4775,11 +4733,11 @@ "type": "tidelift" } ], - "time": "2023-05-23T16:34:37+00:00" + "time": "2023-07-27T06:52:43+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "3.4.x-dev", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", @@ -4795,6 +4753,7 @@ "php": ">=8.1", "psr/event-dispatcher": "^1" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -4835,7 +4794,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/3.4" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" }, "funding": [ { @@ -4859,12 +4818,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c2196aa8b563ed0bc645ee316c40ead823adfead" + "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c2196aa8b563ed0bc645ee316c40ead823adfead", - "reference": "c2196aa8b563ed0bc645ee316c40ead823adfead", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/952a8cb588c3bc6ce76f6023000fb932f16a6e59", + "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59", "shasum": "" }, "require": { @@ -4898,7 +4857,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.3.0-RC1" + "source": "https://github.com/symfony/filesystem/tree/6.4" }, "funding": [ { @@ -4914,7 +4873,7 @@ "type": "tidelift" } ], - "time": "2023-04-28T16:05:33+00:00" + "time": "2023-07-26T17:27:13+00:00" }, { "name": "symfony/finder", @@ -4922,12 +4881,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "1bb60aa99f06979e6078007a812eb7c5ffc8efc2" + "reference": "11d736e97f116ac375a81f96e662911a34cd50ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/1bb60aa99f06979e6078007a812eb7c5ffc8efc2", - "reference": "1bb60aa99f06979e6078007a812eb7c5ffc8efc2", + "url": "https://api.github.com/repos/symfony/finder/zipball/11d736e97f116ac375a81f96e662911a34cd50ce", + "reference": "11d736e97f116ac375a81f96e662911a34cd50ce", "shasum": "" }, "require": { @@ -4978,7 +4937,7 @@ "type": "tidelift" } ], - "time": "2023-05-23T16:34:37+00:00" + "time": "2023-10-31T17:30:12+00:00" }, { "name": "symfony/options-resolver", @@ -4986,12 +4945,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "a10f19f5198d589d5c33333cffe98dc9820332dd" + "reference": "22301f0e7fdeaacc14318928612dee79be99860e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/a10f19f5198d589d5c33333cffe98dc9820332dd", - "reference": "a10f19f5198d589d5c33333cffe98dc9820332dd", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/22301f0e7fdeaacc14318928612dee79be99860e", + "reference": "22301f0e7fdeaacc14318928612dee79be99860e", "shasum": "" }, "require": { @@ -5029,7 +4988,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v6.3.0-RC1" + "source": "https://github.com/symfony/options-resolver/tree/6.4" }, "funding": [ { @@ -5045,11 +5004,11 @@ "type": "tidelift" } ], - "time": "2023-05-12T14:21:09+00:00" + "time": "2023-08-08T10:16:24+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "dev-main", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -5112,7 +5071,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/main" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -5132,7 +5091,7 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "dev-main", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", @@ -5194,7 +5153,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/main" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" }, "funding": [ { @@ -5214,7 +5173,7 @@ }, { "name": "symfony/polyfill-intl-normalizer", - "version": "dev-main", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -5279,7 +5238,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/main" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -5299,16 +5258,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "dev-main", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "f9c7affe77a00ae32ca127ca6833d034e6d33f25" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f9c7affe77a00ae32ca127ca6833d034e6d33f25", - "reference": "f9c7affe77a00ae32ca127ca6833d034e6d33f25", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -5363,7 +5322,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/main" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -5379,11 +5338,11 @@ "type": "tidelift" } ], - "time": "2023-01-30T17:25:47+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/polyfill-php80", - "version": "dev-main", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", @@ -5447,7 +5406,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/main" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -5467,7 +5426,7 @@ }, { "name": "symfony/polyfill-php81", - "version": "dev-main", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", @@ -5527,7 +5486,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/main" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.28.0" }, "funding": [ { @@ -5551,12 +5510,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "8741e3ed7fe2e91ec099e02446fb86667a0f1628" + "reference": "a91571ff5df8825fcc74569d99cddc7242f479b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8741e3ed7fe2e91ec099e02446fb86667a0f1628", - "reference": "8741e3ed7fe2e91ec099e02446fb86667a0f1628", + "url": "https://api.github.com/repos/symfony/process/zipball/a91571ff5df8825fcc74569d99cddc7242f479b7", + "reference": "a91571ff5df8825fcc74569d99cddc7242f479b7", "shasum": "" }, "require": { @@ -5588,7 +5547,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.3.0-RC1" + "source": "https://github.com/symfony/process/tree/6.4" }, "funding": [ { @@ -5604,20 +5563,20 @@ "type": "tidelift" } ], - "time": "2023-05-19T08:06:44+00:00" + "time": "2023-11-04T20:16:32+00:00" }, { "name": "symfony/service-contracts", - "version": "3.4.x-dev", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" + "reference": "a4025a1c812c231d88ed0780e866b0cc644f4a84" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", - "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a4025a1c812c231d88ed0780e866b0cc644f4a84", + "reference": "a4025a1c812c231d88ed0780e866b0cc644f4a84", "shasum": "" }, "require": { @@ -5627,6 +5586,7 @@ "conflict": { "ext-psr": "<1.1|>=2" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -5670,7 +5630,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/3.4" + "source": "https://github.com/symfony/service-contracts/tree/main" }, "funding": [ { @@ -5686,7 +5646,7 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2023-07-29T13:12:44+00:00" }, { "name": "symfony/stopwatch", @@ -5756,12 +5716,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "89bc6d5dcc94c89781e1f986e4d01b7ee91d684b" + "reference": "afab7ffd61240b6fee63ea207b2b98c84f12791e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/89bc6d5dcc94c89781e1f986e4d01b7ee91d684b", - "reference": "89bc6d5dcc94c89781e1f986e4d01b7ee91d684b", + "url": "https://api.github.com/repos/symfony/string/zipball/afab7ffd61240b6fee63ea207b2b98c84f12791e", + "reference": "afab7ffd61240b6fee63ea207b2b98c84f12791e", "shasum": "" }, "require": { @@ -5834,7 +5794,7 @@ "type": "tidelift" } ], - "time": "2023-05-23T16:34:37+00:00" + "time": "2023-11-09T08:51:37+00:00" }, { "name": "theseer/tokenizer", diff --git a/core/basepage.php b/core/basepage.php index c17289557..a691336a8 100644 --- a/core/basepage.php +++ b/core/basepage.php @@ -260,7 +260,7 @@ public function send_headers(): void */ public function display(): void { - if ($this->mode!=PageMode::MANUAL) { + if ($this->mode != PageMode::MANUAL) { $this->send_headers(); } @@ -474,14 +474,14 @@ protected function get_nav_links(): array $active_link = null; // To save on event calls, we check if one of the top-level links has already been marked as active foreach ($nav_links as $link) { - if ($link->active===true) { + if ($link->active === true) { $active_link = $link; break; } } $sub_links = null; // If one is, we just query for sub-menu options under that one tab - if ($active_link!==null) { + if ($active_link !== null) { $psnbe = send_event(new PageSubNavBuildingEvent($active_link->name)); $sub_links = $psnbe->links; } else { @@ -491,20 +491,20 @@ protected function get_nav_links(): array // Now we check for a current link so we can identify the sub-links to show foreach ($psnbe->links as $sub_link) { - if ($sub_link->active===true) { + if ($sub_link->active === true) { $sub_links = $psnbe->links; break; } } // If the active link has been detected, we break out - if ($sub_links!==null) { + if ($sub_links !== null) { $link->active = true; break; } } } - $sub_links = $sub_links??[]; + $sub_links = $sub_links ?? []; usort($nav_links, "Shimmie2\sort_nav_links"); usort($sub_links, "Shimmie2\sort_nav_links"); @@ -628,7 +628,7 @@ class PageSubNavBuildingEvent extends Event public function __construct(string $parent) { parent::__construct(); - $this->parent= $parent; + $this->parent = $parent; } public function add_nav_link(string $name, Link $link, string|HTMLElement $desc, ?bool $active = null, int $order = 50) @@ -653,7 +653,7 @@ public function __construct(string $name, Link $link, string|HTMLElement $descri $this->link = $link; $this->description = $description; $this->order = $order; - if ($active==null) { + if ($active == null) { $query = ltrim(_get_query(), "/"); if ($query === "") { // This indicates the front page, so we check what's set as the front page @@ -664,7 +664,7 @@ public function __construct(string $name, Link $link, string|HTMLElement $descri } else { $this->active = self::is_active([$link->page], $front_page); } - } elseif ($query===$link->page) { + } elseif ($query === $link->page) { $this->active = true; } else { $this->active = self::is_active([$link->page]); @@ -679,18 +679,18 @@ public static function is_active(array $pages_matched, string $url = null): bool /** * Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.) */ - $url = $url??ltrim(_get_query(), "/"); + $url = $url ?? ltrim(_get_query(), "/"); - $re1='.*?'; - $re2='((?:[a-z][a-z_]+))'; + $re1 = '.*?'; + $re2 = '((?:[a-z][a-z_]+))'; if (preg_match_all("/".$re1.$re2."/is", $url, $matches)) { - $url=$matches[1][0]; + $url = $matches[1][0]; } $count_pages_matched = count($pages_matched); - for ($i=0; $i < $count_pages_matched; $i++) { + for ($i = 0; $i < $count_pages_matched; $i++) { if ($url == $pages_matched[$i]) { return true; } diff --git a/core/basethemelet.php b/core/basethemelet.php index 11c9e2dcc..30fc6372c 100644 --- a/core/basethemelet.php +++ b/core/basethemelet.php @@ -81,22 +81,22 @@ public function build_thumb_html(Image $image): HTMLElement return A( [ - "href"=>$view_link, - "class"=>"thumb shm-thumb shm-thumb-link $custom_classes", - "data-tags"=>$tags, - "data-height"=>$image->height, - "data-width"=>$image->width, - "data-mime"=>$image->get_mime(), - "data-post-id"=>$id, + "href" => $view_link, + "class" => "thumb shm-thumb shm-thumb-link $custom_classes", + "data-tags" => $tags, + "data-height" => $image->height, + "data-width" => $image->width, + "data-mime" => $image->get_mime(), + "data-post-id" => $id, ], IMG( [ - "id"=>"thumb_$id", - "title"=>$tip, - "alt"=>$tip, - "height"=>$tsize[1], - "width"=>$tsize[0], - "src"=>$thumb_link, + "id" => "thumb_$id", + "title" => $tip, + "alt" => $tip, + "height" => $tsize[1], + "width" => $tsize[0], + "src" => $thumb_link, ] ) ); @@ -112,18 +112,18 @@ public function display_paginator(Page $page, string $base, ?string $query, int $page->add_html_header(""); if ($page_number < $total_pages) { - $page->add_html_header(""); - $page->add_html_header(""); + $page->add_html_header(""); + $page->add_html_header(""); } if ($page_number > 1) { - $page->add_html_header(""); + $page->add_html_header(""); } $page->add_html_header(""); } private function gen_page_link(string $base_url, ?string $query, int $page, string $name): HTMLElement { - return A(["href"=>make_link($base_url.'/'.$page, $query)], $name); + return A(["href" => make_link($base_url.'/'.$page, $query)], $name); } private function gen_page_link_block(string $base_url, ?string $query, int $page, int $current_page, string $name): HTMLElement diff --git a/core/block.php b/core/block.php index 0242656af..bd4332292 100644 --- a/core/block.php +++ b/core/block.php @@ -45,7 +45,7 @@ class Block */ public bool $is_content = true; - public function __construct(string $header=null, string|\MicroHTML\HTMLElement $body=null, string $section="main", int $position=50, string $id=null) + public function __construct(string $header = null, string|\MicroHTML\HTMLElement $body = null, string $section = "main", int $position = 50, string $id = null) { $this->header = $header; $this->body = (string)$body; @@ -63,7 +63,7 @@ public function __construct(string $header=null, string|\MicroHTML\HTMLElement $ /** * Get the HTML for this block. */ - public function get_html(bool $hidable=false): string + public function get_html(bool $hidable = false): string { $h = $this->header; $b = $this->body; diff --git a/core/cacheengine.php b/core/cacheengine.php index 01a66f90d..0d7b3cc36 100644 --- a/core/cacheengine.php +++ b/core/cacheengine.php @@ -10,8 +10,8 @@ class EventTracingCache implements CacheInterface { private CacheInterface $engine; private \EventTracer $tracer; - private int $hits=0; - private int $misses=0; + private int $hits = 0; + private int $misses = 0; public function __construct(CacheInterface $engine, \EventTracer $tracer) { @@ -19,7 +19,7 @@ public function __construct(CacheInterface $engine, \EventTracer $tracer) $this->tracer = $tracer; } - public function get($key, $default=null) + public function get($key, $default = null) { if ($key === "__etc_cache_hits") { return $this->hits; @@ -29,7 +29,7 @@ public function get($key, $default=null) } $sentinel = "__etc_sentinel"; - $this->tracer->begin("Cache Get", ["key"=>$key]); + $this->tracer->begin("Cache Get", ["key" => $key]); $val = $this->engine->get($key, $sentinel); if ($val != $sentinel) { $res = "hit"; @@ -39,13 +39,13 @@ public function get($key, $default=null) $val = $default; $this->misses++; } - $this->tracer->end(null, ["result"=>$res]); + $this->tracer->end(null, ["result" => $res]); return $val; } public function set($key, $value, $ttl = null) { - $this->tracer->begin("Cache Set", ["key"=>$key, "ttl"=>$ttl]); + $this->tracer->begin("Cache Set", ["key" => $key, "ttl" => $ttl]); $val = $this->engine->set($key, $value, $ttl); $this->tracer->end(); return $val; @@ -53,7 +53,7 @@ public function set($key, $value, $ttl = null) public function delete($key) { - $this->tracer->begin("Cache Delete", ["key"=>$key]); + $this->tracer->begin("Cache Delete", ["key" => $key]); $val = $this->engine->delete($key); $this->tracer->end(); return $val; @@ -93,9 +93,9 @@ public function deleteMultiple($keys) public function has($key) { - $this->tracer->begin("Cache Has", ["key"=>$key]); + $this->tracer->begin("Cache Has", ["key" => $key]); $val = $this->engine->has($key); - $this->tracer->end(null, ["exists"=>$val]); + $this->tracer->end(null, ["exists" => $val]); return $val; } } diff --git a/core/command_builder.php b/core/command_builder.php index cd912bb33..4908a492d 100644 --- a/core/command_builder.php +++ b/core/command_builder.php @@ -61,7 +61,7 @@ public function execute(bool $fail_on_non_zero_return = false): int log_debug('command_builder', "Command `$cmd` returned $ret and outputted $output"); - if ($fail_on_non_zero_return&&(int)$ret!==(int)0) { + if ($fail_on_non_zero_return && (int)$ret !== (int)0) { throw new SCoreException("Command `$cmd` failed, returning $ret and outputting $output"); } return $ret; diff --git a/core/config.php b/core/config.php index 3372bf177..85c3a2a1e 100644 --- a/core/config.php +++ b/core/config.php @@ -16,7 +16,7 @@ interface Config * so that the next time a page is loaded it will use the new * configuration. */ - public function save(string $name=null): void; + public function save(string $name = null): void; //@{ /*--------------------------------- SET ------------------------------------------------------*/ /** @@ -101,27 +101,27 @@ public function set_default_array(string $name, array $value): void; /** * Pick a value out of the table by name, cast to the appropriate data type. */ - public function get_int(string $name, ?int $default=null): ?int; + public function get_int(string $name, ?int $default = null): ?int; /** * Pick a value out of the table by name, cast to the appropriate data type. */ - public function get_float(string $name, ?float $default=null): ?float; + public function get_float(string $name, ?float $default = null): ?float; /** * Pick a value out of the table by name, cast to the appropriate data type. */ - public function get_string(string $name, ?string $default=null): ?string; + public function get_string(string $name, ?string $default = null): ?string; /** * Pick a value out of the table by name, cast to the appropriate data type. */ - public function get_bool(string $name, ?bool $default=null): ?bool; + public function get_bool(string $name, ?bool $default = null): ?bool; /** * Pick a value out of the table by name, cast to the appropriate data type. */ - public function get_array(string $name, ?array $default=[]): ?array; + public function get_array(string $name, ?array $default = []): ?array; //@} /*--------------------------------------------------------------------------------------------*/ } @@ -162,7 +162,7 @@ public function set_bool(string $name, ?bool $value): void public function set_array(string $name, ?array $value): void { - if ($value!=null) { + if ($value != null) { $this->values[$name] = implode(",", $value); } else { $this->values[$name] = null; @@ -205,17 +205,17 @@ public function set_default_array(string $name, array $value): void } } - public function get_int(string $name, ?int $default=null): ?int + public function get_int(string $name, ?int $default = null): ?int { return (int)($this->get($name, $default)); } - public function get_float(string $name, ?float $default=null): ?float + public function get_float(string $name, ?float $default = null): ?float { return (float)($this->get($name, $default)); } - public function get_string(string $name, ?string $default=null): ?string + public function get_string(string $name, ?string $default = null): ?string { $val = $this->get($name, $default); if (!is_string($val) && !is_null($val)) { @@ -224,17 +224,17 @@ public function get_string(string $name, ?string $default=null): ?string return $val; } - public function get_bool(string $name, ?bool $default=null): ?bool + public function get_bool(string $name, ?bool $default = null): ?bool { return bool_escape($this->get($name, $default)); } - public function get_array(string $name, ?array $default=[]): ?array + public function get_array(string $name, ?array $default = []): ?array { return explode(",", $this->get($name, "")); } - private function get(string $name, $default=null) + private function get(string $name, $default = null) { if (isset($this->values[$name])) { return $this->values[$name]; @@ -289,7 +289,7 @@ public function __construct( $query = "SELECT name, value FROM {$this->table_name}"; $args = []; - if (!empty($sub_column)&&!empty($sub_value)) { + if (!empty($sub_column) && !empty($sub_value)) { $query .= " WHERE $sub_column = :sub_value"; $args["sub_value"] = $sub_value; } @@ -301,7 +301,7 @@ public function __construct( } } - public function save(string $name=null): void + public function save(string $name = null): void { global $cache; @@ -312,10 +312,10 @@ public function save(string $name=null): void } } else { $query = "DELETE FROM {$this->table_name} WHERE name = :name"; - $args = ["name"=>$name]; + $args = ["name" => $name]; $cols = ["name","value"]; $params = [":name",":value"]; - if (!empty($this->sub_column)&&!empty($this->sub_value)) { + if (!empty($this->sub_column) && !empty($this->sub_value)) { $query .= " AND $this->sub_column = :sub_value"; $args["sub_value"] = $this->sub_value; $cols[] = $this->sub_column; @@ -324,7 +324,7 @@ public function save(string $name=null): void $this->database->execute($query, $args); - $args["value"] =$this->values[$name]; + $args["value"] = $this->values[$name]; $this->database->execute( "INSERT INTO {$this->table_name} (".join(",", $cols).") VALUES (".join(",", $params).")", $args diff --git a/core/database.php b/core/database.php index 72dd60a95..5d53ae698 100644 --- a/core/database.php +++ b/core/database.php @@ -57,7 +57,7 @@ private function get_db(): PDO private function connect_engine(): void { if (preg_match("/^([^:]*)/", $this->dsn, $matches)) { - $db_proto=$matches[1]; + $db_proto = $matches[1]; } else { throw new SCoreException("Can't figure out database engine"); } @@ -138,7 +138,7 @@ private function count_time(string $method, float $start, string $query, ?array $query = preg_replace('/ +/m', ' ', $query); $query = trim($query); if ($tracer_enabled) { - $_tracer->complete($start * 1000000, $dur * 1000000, "DB Query", ["query"=>$query, "args"=>$args, "method"=>$method]); + $_tracer->complete($start * 1000000, $dur * 1000000, "DB Query", ["query" => $query, "args" => $args, "method" => $method]); } $this->queries[] = $query; $this->query_count++; @@ -150,7 +150,7 @@ public function set_timeout(?int $time): void $this->get_engine()->set_timeout($this->get_db(), $time); } - public function notify(string $channel, ?string $data=null): void + public function notify(string $channel, ?string $data = null): void { $this->get_engine()->notify($this->get_db(), $channel, $data); } @@ -285,7 +285,7 @@ public function exists(string $query, array $args = []): bool $_start = ftime(); $row = $this->_execute($query, $args)->fetch(); $this->count_time("exists", $_start, $query, $args); - if ($row==null) { + if ($row == null) { return false; } return true; @@ -346,7 +346,7 @@ public function raw_db(): PDO return $this->get_db(); } - public function standardise_boolean(string $table, string $column, bool $include_postgres=false): void + public function standardise_boolean(string $table, string $column, bool $include_postgres = false): void { $d = $this->get_driver_id(); if ($d == DatabaseDriverID::MYSQL) { diff --git a/core/dbengine.php b/core/dbengine.php index bf32cd470..9c05c1a4c 100644 --- a/core/dbengine.php +++ b/core/dbengine.php @@ -34,7 +34,7 @@ abstract public function set_timeout(PDO $db, ?int $time); abstract public function get_version(PDO $db): string; - abstract public function notify(PDO $db, string $channel, ?string $data=null): void; + abstract public function notify(PDO $db, string $channel, ?string $data = null): void; } class MySQL extends DBEngine @@ -66,7 +66,7 @@ public function set_timeout(PDO $db, ?int $time): void // $db->exec("SET SESSION MAX_EXECUTION_TIME=".$time.";"); } - public function notify(PDO $db, string $channel, ?string $data=null): void + public function notify(PDO $db, string $channel, ?string $data = null): void { } @@ -113,7 +113,7 @@ public function set_timeout(PDO $db, ?int $time): void $db->exec("SET statement_timeout TO ".$time.";"); } - public function notify(PDO $db, string $channel, ?string $data=null): void + public function notify(PDO $db, string $channel, ?string $data = null): void { if ($data) { $db->exec("NOTIFY $channel, '$data';"); @@ -141,7 +141,7 @@ function _floor($a): float { return floor($a); } -function _log($a, $b=null): float +function _log($a, $b = null): float { if (is_null($b)) { return log($a); @@ -225,7 +225,7 @@ public function set_timeout(PDO $db, ?int $time): void // There doesn't seem to be such a thing for SQLite, so it does nothing } - public function notify(PDO $db, string $channel, ?string $data=null): void + public function notify(PDO $db, string $channel, ?string $data = null): void { } diff --git a/core/event.php b/core/event.php index db6798ab2..c1eec6d6f 100644 --- a/core/event.php +++ b/core/event.php @@ -87,7 +87,7 @@ public function page_matches(string $name): bool return false; } - for ($i=0; $i<$this->part_count; $i++) { + for ($i = 0; $i < $this->part_count; $i++) { if ($parts[$i] != $this->args[$i]) { return false; } @@ -114,7 +114,7 @@ public function get_arg(int $n): string * If page arg $n is set, then treat that as a 1-indexed page number * and return a 0-indexed page number less than $max; else return 0 */ - public function try_page_num(int $n, ?int $max=null): int + public function try_page_num(int $n, ?int $max = null): int { if ($this->count_args() > $n) { $i = $this->get_arg($n); @@ -195,7 +195,7 @@ public function __construct(array $args) $log_level = SCORE_LOG_WARNING; $arg_count = count($args); - for ($i=1; $i<$arg_count; $i++) { + for ($i = 1; $i < $arg_count; $i++) { switch ($args[$i]) { case '-u': $user = User::by_name($args[++$i]); diff --git a/core/exceptions.php b/core/exceptions.php index 3d1dff4fc..139b86700 100644 --- a/core/exceptions.php +++ b/core/exceptions.php @@ -13,7 +13,7 @@ class SCoreException extends \RuntimeException public string $error; public int $http_code = 500; - public function __construct(string $msg, ?string $query=null) + public function __construct(string $msg, ?string $query = null) { parent::__construct($msg); $this->error = $msg; diff --git a/core/extension.php b/core/extension.php index c5b7edecf..cf246e8cb 100644 --- a/core/extension.php +++ b/core/extension.php @@ -69,7 +69,7 @@ public static function determine_enabled_extensions(): void $extras ) as $key) { $ext = ExtensionInfo::get_by_key($key); - if ($ext===null || !$ext->is_supported()) { + if ($ext === null || !$ext->is_supported()) { continue; } // FIXME: error if one of our dependencies isn't supported @@ -123,7 +123,7 @@ abstract class ExtensionInfo public const SHISH_NAME = "Shish"; public const SHISH_EMAIL = "webmaster@shishnet.org"; public const SHIMMIE_URL = "https://code.shishnet.org/shimmie2/"; - public const SHISH_AUTHOR = [self::SHISH_NAME=>self::SHISH_EMAIL]; + public const SHISH_AUTHOR = [self::SHISH_NAME => self::SHISH_EMAIL]; public const LICENSE_GPLV2 = "GPLv2"; public const LICENSE_MIT = "MIT"; @@ -152,7 +152,7 @@ abstract class ExtensionInfo public function is_supported(): bool { - if ($this->supported===null) { + if ($this->supported === null) { $this->check_support(); } return $this->supported; @@ -160,7 +160,7 @@ public function is_supported(): bool public function get_support_info(): string { - if ($this->supported===null) { + if ($this->supported === null) { $this->check_support(); } return $this->support_info; @@ -249,7 +249,7 @@ public static function load_all_extension_info() self::$all_info_by_key[$extension_info->key] = $extension_info; self::$all_info_by_class[$class] = $extension_info; - if ($extension_info->core===true) { + if ($extension_info->core === true) { self::$core_extensions[] = $extension_info->key; } } diff --git a/core/imageboard/event.php b/core/imageboard/event.php index 1580f8480..49ed408af 100644 --- a/core/imageboard/event.php +++ b/core/imageboard/event.php @@ -84,7 +84,7 @@ class ThumbnailGenerationEvent extends Event public function __construct( public string $hash, public string $mime, - public bool $force=false + public bool $force = false ) { parent::__construct(); $this->generated = false; diff --git a/core/imageboard/image.php b/core/imageboard/image.php index b29d61ffc..ec30eb64b 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -63,7 +63,7 @@ class Image * One will very rarely construct an image directly, more common * would be to use Image::by_id, Image::by_hash, etc. */ - public function __construct(?array $row=null) + public function __construct(?array $row = null) { if (!is_null($row)) { foreach ($row as $name => $value) { @@ -103,11 +103,11 @@ public function graphql_guid(): string public static function by_id(int $post_id): ?Image { global $database; - if ($post_id > 2**32) { + if ($post_id > 2 ** 32) { // for some reason bots query huge numbers and pollute the DB error logs... return null; } - $row = $database->get_row("SELECT * FROM images WHERE images.id=:id", ["id"=>$post_id]); + $row = $database->get_row("SELECT * FROM images WHERE images.id=:id", ["id" => $post_id]); return ($row ? new Image($row) : null); } @@ -115,7 +115,7 @@ public static function by_hash(string $hash): ?Image { global $database; $hash = strtolower($hash); - $row = $database->get_row("SELECT images.* FROM images WHERE hash=:hash", ["hash"=>$hash]); + $row = $database->get_row("SELECT images.* FROM images WHERE hash=:hash", ["hash" => $hash]); return ($row ? new Image($row) : null); } @@ -124,7 +124,7 @@ public static function by_id_or_hash(string $id): ?Image return (is_numeric($id) && strlen($id) != 32) ? Image::by_id((int)$id) : Image::by_hash($id); } - public static function by_random(array $tags=[], int $limit_range=0): ?Image + public static function by_random(array $tags = [], int $limit_range = 0): ?Image { $max = Image::count_images($tags); if ($max < 1) { @@ -133,7 +133,7 @@ public static function by_random(array $tags=[], int $limit_range=0): ?Image if ($limit_range > 0 && $max > $limit_range) { $max = $limit_range; } - $rand = mt_rand(0, $max-1); + $rand = mt_rand(0, $max - 1); $set = Image::find_images($rand, 1, $tags); if (count($set) > 0) { return $set[0]; @@ -142,7 +142,7 @@ public static function by_random(array $tags=[], int $limit_range=0): ?Image } } - private static function find_images_internal(int $start = 0, ?int $limit = null, array $tags=[]): iterable + private static function find_images_internal(int $start = 0, ?int $limit = null, array $tags = []): iterable { global $database, $user; @@ -170,7 +170,7 @@ private static function find_images_internal(int $start = 0, ?int $limit = null, * @return Image[] */ #[Query(name: "posts", type: "[Post!]!", args: ["tags" => "[string!]"])] - public static function find_images(int $offset = 0, ?int $limit = null, array $tags=[]): array + public static function find_images(int $offset = 0, ?int $limit = null, array $tags = []): array { $result = self::find_images_internal($offset, $limit, $tags); @@ -184,7 +184,7 @@ public static function find_images(int $offset = 0, ?int $limit = null, array $t /** * Search for an array of images, returning a iterable object of Image */ - public static function find_images_iterable(int $start = 0, ?int $limit = null, array $tags=[]): \Generator + public static function find_images_iterable(int $start = 0, ?int $limit = null, array $tags = []): \Generator { $result = self::find_images_internal($start, $limit, $tags); foreach ($result as $row) { @@ -212,7 +212,7 @@ public static function count_tag(string $tag): int global $database; return (int)$database->get_one( "SELECT count FROM tags WHERE LOWER(tag) = LOWER(:tag)", - ["tag"=>$tag] + ["tag" => $tag] ); } @@ -221,7 +221,7 @@ public static function count_tag(string $tag): int * * @param string[] $tags */ - public static function count_images(array $tags=[]): int + public static function count_images(array $tags = []): int { global $cache, $database; $tag_count = count($tags); @@ -266,7 +266,7 @@ public static function count_images(array $tags=[]): int * * @param string[] $tags */ - public static function count_pages(array $tags=[]): int + public static function count_pages(array $tags = []): int { global $config; return (int)ceil(Image::count_images($tags) / $config->get_int(IndexConfig::IMAGES)); @@ -284,7 +284,7 @@ public static function count_pages(array $tags=[]): int * * @param string[] $tags */ - public function get_next(array $tags=[], bool $next=true): ?Image + public function get_next(array $tags = [], bool $next = true): ?Image { global $database; @@ -320,7 +320,7 @@ public function get_next(array $tags=[], bool $next=true): ?Image * * @param string[] $tags */ - public function get_prev(array $tags=[]): ?Image + public function get_prev(array $tags = []): ?Image { return $this->get_next($tags, false); } @@ -345,7 +345,7 @@ public function set_owner(User $owner): void UPDATE images SET owner_id=:owner_id WHERE id=:id - ", ["owner_id"=>$owner->id, "id"=>$this->id]); + ", ["owner_id" => $owner->id, "id" => $this->id]); log_info("core_image", "Owner for Post #{$this->id} set to {$owner->name}"); } } @@ -440,7 +440,7 @@ public function get_tag_array(): array JOIN tags ON image_tags.tag_id = tags.id WHERE image_id=:id ORDER BY tag - ", ["id"=>$this->id]); + ", ["id" => $this->id]); sort($this->tag_array); } return $this->tag_array; @@ -569,7 +569,7 @@ public function get_ext(): string #[Field(name: "mime")] public function get_mime(): ?string { - if ($this->mime===MimeType::WEBP&&$this->lossless) { + if ($this->mime === MimeType::WEBP && $this->lossless) { return MimeType::WEBP_LOSSLESS; } $m = $this->mime; @@ -610,7 +610,7 @@ public function set_source(string $new_source): void $new_source = null; } if ($new_source != $old_source) { - $database->execute("UPDATE images SET source=:source WHERE id=:id", ["source"=>$new_source, "id"=>$this->id]); + $database->execute("UPDATE images SET source=:source WHERE id=:id", ["source" => $new_source, "id" => $this->id]); log_info("core_image", "Source for Post #{$this->id} set to: $new_source (was $old_source)"); } } @@ -627,7 +627,7 @@ public function set_locked(bool $locked): void { global $database; if ($locked !== $this->locked) { - $database->execute("UPDATE images SET locked=:yn WHERE id=:id", ["yn"=>$locked, "id"=>$this->id]); + $database->execute("UPDATE images SET locked=:yn WHERE id=:id", ["yn" => $locked, "id" => $this->id]); log_info("core_image", "Setting Post #{$this->id} lock to: $locked"); } } @@ -648,12 +648,12 @@ public function delete_tags_from_image(): void FROM image_tags WHERE image_id = :id ) - ", ["id"=>$this->id]); + ", ["id" => $this->id]); $database->execute(" DELETE FROM image_tags WHERE image_id=:id - ", ["id"=>$this->id]); + ", ["id" => $this->id]); } /** @@ -699,7 +699,7 @@ public function set_tags(array $unfiltered_tags): void FROM image_tags WHERE image_id = :id ) - ", ["id"=>$this->id]); + ", ["id" => $this->id]); log_info("core_image", "Tags for Post #{$this->id} set to: ".Tag::implode($tags)); $cache->delete("image-{$this->id}-tags"); @@ -713,7 +713,7 @@ public function delete(): void { global $database; $this->delete_tags_from_image(); - $database->execute("DELETE FROM images WHERE id=:id", ["id"=>$this->id]); + $database->execute("DELETE FROM images WHERE id=:id", ["id" => $this->id]); log_info("core_image", 'Deleted Post #'.$this->id.' ('.$this->hash.')'); unlink($this->get_image_filename()); @@ -731,7 +731,7 @@ public function remove_image_only(): void @unlink($this->get_thumb_filename()); } - public function parse_link_template(string $tmpl, int $n=0): string + public function parse_link_template(string $tmpl, int $n = 0): string { $plte = send_event(new ParseLinkTemplateEvent($tmpl, $this)); $tmpl = $plte->link; @@ -753,8 +753,8 @@ private static function tag_or_wildcard_to_ids(string $tag): array */ private static function build_search_querylet( array $terms, - ?int $limit=null, - ?int $offset=null + ?int $limit = null, + ?int $offset = null ): Querylet { global $config; @@ -827,7 +827,7 @@ private static function build_search_querylet( LIMIT :limit OFFSET :offset ) a on a.image_id = images.id ORDER BY images.id DESC - ", ["limit"=>$limit, "offset"=>$offset]); + ", ["limit" => $limit, "offset" => $offset]); // don't offset at the image level because // we already offset at the image_tags level $order = null; @@ -849,11 +849,11 @@ private static function build_search_querylet( if ($tq->positive) { $all_nonexistent_negatives = false; - if ($tag_count== 0) { + if ($tag_count == 0) { # one of the positive tags had zero results, therefor there # can be no results; "where 1=0" should shortcut things return new Querylet("SELECT images.* FROM images WHERE 1=0"); - } elseif ($tag_count==1) { + } elseif ($tag_count == 1) { // All wildcard terms that qualify for a single tag can be treated the same as non-wildcards $positive_tag_id_array[] = $tag_ids[0]; } else { diff --git a/core/imageboard/misc.php b/core/imageboard/misc.php index f7bc1c62a..2fdc82a82 100644 --- a/core/imageboard/misc.php +++ b/core/imageboard/misc.php @@ -39,7 +39,7 @@ function add_dir(string $base): array /** * Sends a DataUploadEvent for a file. */ -function add_image(string $tmpname, string $filename, string $tags, ?string $source=null): DataUploadEvent +function add_image(string $tmpname, string $filename, string $tags, ?string $source = null): DataUploadEvent { return send_event(new DataUploadEvent($tmpname, [ 'filename' => pathinfo($filename, PATHINFO_BASENAME), @@ -111,12 +111,12 @@ function get_thumbnail_size(int $orig_width, int $orig_height, bool $use_dpi_sca function get_scaled_by_aspect_ratio(int $original_width, int $original_height, int $max_width, int $max_height): array { - $xscale = ($max_width/ $original_width); - $yscale = ($max_height/ $original_height); + $xscale = ($max_width / $original_width); + $yscale = ($max_height / $original_height); $scale = ($yscale < $xscale) ? $yscale : $xscale ; - return [(int)($original_width*$scale), (int)($original_height*$scale), $scale]; + return [(int)($original_width * $scale), (int)($original_height * $scale), $scale]; } /** @@ -129,8 +129,8 @@ function get_thumbnail_max_size_scaled(): array global $config; $scaling = $config->get_int(ImageConfig::THUMB_SCALING); - $max_width = $config->get_int(ImageConfig::THUMB_WIDTH) * ($scaling/100); - $max_height = $config->get_int(ImageConfig::THUMB_HEIGHT) * ($scaling/100); + $max_width = $config->get_int(ImageConfig::THUMB_WIDTH) * ($scaling / 100); + $max_height = $config->get_int(ImageConfig::THUMB_HEIGHT) * ($scaling / 100); return [$max_width, $max_height]; } diff --git a/core/imageboard/search.php b/core/imageboard/search.php index 11ac9b036..624f52237 100644 --- a/core/imageboard/search.php +++ b/core/imageboard/search.php @@ -8,7 +8,7 @@ class Querylet { public function __construct( public string $sql, - public array $variables=[], + public array $variables = [], ) { } diff --git a/core/imageboard/tag.php b/core/imageboard/tag.php index e1c437db9..547ed0f04 100644 --- a/core/imageboard/tag.php +++ b/core/imageboard/tag.php @@ -26,7 +26,7 @@ public function __construct(string $tag, int $uses) * @return TagUsage[] */ #[Query(name: "tags", type: '[TagUsage!]!')] - public static function tags(string $search, int $limit=10): array + public static function tags(string $search, int $limit = 10): array { global $cache, $database; @@ -48,7 +48,7 @@ public static function tags(string $search, int $limit=10): array $limitSQL = ""; $search = str_replace('_', '\_', $search); $search = str_replace('%', '\%', $search); - $SQLarr = ["search"=>"$search%"]; #, "cat_search"=>"%:$search%"]; + $SQLarr = ["search" => "$search%"]; #, "cat_search"=>"%:$search%"]; if ($limit !== 0) { $limitSQL = "LIMIT :limit"; $SQLarr['limit'] = $limit; @@ -104,17 +104,17 @@ public static function get_or_create_id(string $tag): int $id = $database->get_one( "SELECT id FROM tags WHERE LOWER(tag) = LOWER(:tag)", - ["tag"=>$tag] + ["tag" => $tag] ); if (empty($id)) { // a new tag $database->execute( "INSERT INTO tags(tag) VALUES (:tag)", - ["tag"=>$tag] + ["tag" => $tag] ); $id = $database->get_one( "SELECT id FROM tags WHERE LOWER(tag) = LOWER(:tag)", - ["tag"=>$tag] + ["tag" => $tag] ); } @@ -125,7 +125,7 @@ public static function get_or_create_id(string $tag): int /** @param string[] $tags */ public static function implode(array $tags): string { - sort($tags, SORT_FLAG_CASE|SORT_STRING); + sort($tags, SORT_FLAG_CASE | SORT_STRING); return implode(' ', $tags); } @@ -134,7 +134,7 @@ public static function implode(array $tags): string * * #return string[] */ - public static function explode(string $tags, bool $tagme=true): array + public static function explode(string $tags, bool $tagme = true): array { global $database; @@ -152,7 +152,7 @@ public static function explode(string $tags, bool $tagme=true): array $new = []; $i = 0; $tag_count = count($tag_array); - while ($i<$tag_count) { + while ($i < $tag_count) { $tag = $tag_array[$i]; $negative = ''; if (!empty($tag) && ($tag[0] == '-')) { @@ -166,7 +166,7 @@ public static function explode(string $tags, bool $tagme=true): array FROM aliases WHERE LOWER(oldtag)=LOWER(:tag) ", - ["tag"=>$tag] + ["tag" => $tag] ); if (empty($newtags)) { //tag has no alias, use old tag @@ -217,7 +217,7 @@ public static function sanitize(string $tag): string public static function compare(array $tags1, array $tags2): bool { - if (count($tags1)!==count($tags2)) { + if (count($tags1) !== count($tags2)) { return false; } @@ -312,7 +312,7 @@ public static function decaret(string $str): string $out = ""; $length = strlen($str); - for ($i=0; $i<$length; $i++) { + for ($i = 0; $i < $length; $i++) { if ($str[$i] == "^") { $i++; $out .= $from_caret[$str[$i]] ?? ''; diff --git a/core/logging.php b/core/logging.php index 7b5c3694e..a558e3c5b 100644 --- a/core/logging.php +++ b/core/logging.php @@ -16,12 +16,12 @@ define("SCORE_LOG_NOTSET", 0); const LOGGING_LEVEL_NAMES = [ - SCORE_LOG_NOTSET=>"Not Set", - SCORE_LOG_DEBUG=>"Debug", - SCORE_LOG_INFO=>"Info", - SCORE_LOG_WARNING=>"Warning", - SCORE_LOG_ERROR=>"Error", - SCORE_LOG_CRITICAL=>"Critical", + SCORE_LOG_NOTSET => "Not Set", + SCORE_LOG_DEBUG => "Debug", + SCORE_LOG_INFO => "Info", + SCORE_LOG_WARNING => "Warning", + SCORE_LOG_ERROR => "Error", + SCORE_LOG_CRITICAL => "Critical", ]; /** @@ -31,7 +31,7 @@ * When taking action, a log event should be stored by the server * Quite often, both of these happen at once, hence log_*() having $flash */ -function log_msg(string $section, int $priority, string $message, ?string $flash=null) +function log_msg(string $section, int $priority, string $message, ?string $flash = null) { global $page; send_event(new LogEvent($section, $priority, $message)); @@ -47,23 +47,23 @@ function log_msg(string $section, int $priority, string $message, ?string $flash } // More shorthand ways of logging -function log_debug(string $section, string $message, ?string $flash=null) +function log_debug(string $section, string $message, ?string $flash = null) { log_msg($section, SCORE_LOG_DEBUG, $message, $flash); } -function log_info(string $section, string $message, ?string $flash=null) +function log_info(string $section, string $message, ?string $flash = null) { log_msg($section, SCORE_LOG_INFO, $message, $flash); } -function log_warning(string $section, string $message, ?string $flash=null) +function log_warning(string $section, string $message, ?string $flash = null) { log_msg($section, SCORE_LOG_WARNING, $message, $flash); } -function log_error(string $section, string $message, ?string $flash=null) +function log_error(string $section, string $message, ?string $flash = null) { log_msg($section, SCORE_LOG_ERROR, $message, $flash); } -function log_critical(string $section, string $message, ?string $flash=null) +function log_critical(string $section, string $message, ?string $flash = null) { log_msg($section, SCORE_LOG_CRITICAL, $message, $flash); } diff --git a/core/microhtml.php b/core/microhtml.php index 23c895aa1..aadd633df 100644 --- a/core/microhtml.php +++ b/core/microhtml.php @@ -22,13 +22,13 @@ use function MicroHTML\TH; use function MicroHTML\TD; -function SHM_FORM(string $target, string $method="POST", bool $multipart=false, string $form_id="", string $onsubmit="", string $name=""): HTMLElement +function SHM_FORM(string $target, string $method = "POST", bool $multipart = false, string $form_id = "", string $onsubmit = "", string $name = ""): HTMLElement { global $user; $attrs = [ - "action"=>make_link($target), - "method"=>$method + "action" => make_link($target), + "method" => $method ]; if ($form_id) { @@ -45,7 +45,7 @@ function SHM_FORM(string $target, string $method="POST", bool $multipart=false, } return FORM( $attrs, - INPUT(["type"=>"hidden", "name"=>"q", "value"=>$target]), + INPUT(["type" => "hidden", "name" => "q", "value" => $target]), $method == "GET" ? "" : $user->get_auth_microhtml() ); } @@ -57,14 +57,14 @@ function SHM_SIMPLE_FORM($target, ...$children): HTMLElement return $form; } -function SHM_SUBMIT(string $text, array $args=[]): HTMLElement +function SHM_SUBMIT(string $text, array $args = []): HTMLElement { $args["type"] = "submit"; $args["value"] = $text; return INPUT($args); } -function SHM_A(string $href, string|HTMLElement $text, string $id="", string $class="", array $args=[]): HTMLElement +function SHM_A(string $href, string|HTMLElement $text, string $id = "", string $class = "", array $args = []): HTMLElement { $args["href"] = make_link($href); @@ -81,7 +81,7 @@ function SHM_A(string $href, string|HTMLElement $text, string $id="", string $cl function SHM_COMMAND_EXAMPLE(string $ex, string $desc): HTMLElement { return DIV( - ["class"=>"command_example"], + ["class" => "command_example"], PRE($ex), P($desc) ); @@ -90,15 +90,15 @@ function SHM_COMMAND_EXAMPLE(string $ex, string $desc): HTMLElement function SHM_USER_FORM(User $duser, string $target, string $title, $body, $foot): HTMLElement { if (is_string($foot)) { - $foot = TFOOT(TR(TD(["colspan"=>"2"], INPUT(["type"=>"submit", "value"=>$foot])))); + $foot = TFOOT(TR(TD(["colspan" => "2"], INPUT(["type" => "submit", "value" => $foot])))); } return SHM_SIMPLE_FORM( $target, P( - INPUT(["type"=>'hidden', "name"=>'id', "value"=>$duser->id]), + INPUT(["type" => 'hidden', "name" => 'id', "value" => $duser->id]), TABLE( - ["class"=>"form"], - THEAD(TR(TH(["colspan"=>"2"], $title))), + ["class" => "form"], + THEAD(TR(TH(["colspan" => "2"], $title))), $body, $foot ) @@ -117,7 +117,7 @@ function SHM_USER_FORM(User $duser, string $target, string $title, $body, $foot) * @param bool $empty_option Whether the first option should be an empty one. * @param array $attrs Additional attributes dict for @@ -131,7 +131,7 @@ private function display_top(?Pool $pool, string $heading, bool $check_all = fal $page->add_block(new NavBlock()); $page->add_block(new Block("Pool Navigation", $poolnav, "left", 10)); - $page->add_block(new Block("Search", $search, "left", 10)); + $page->add_block(new Block("Search", $search, "left", 10)); if (!is_null($pool)) { if ($pool->public || $user->can(Permissions::POOLS_ADMIN)) {// IF THE POOL IS PUBLIC OR IS ADMIN SHOW EDIT PANEL @@ -171,8 +171,8 @@ public function sidebar_options(Page $page, Pool $pool, bool $check_all) global $user; // This could become a SHM_INPUT function that also accepts 'type' and other attributes. - $_hidden=function (string $name, $value) { - return INPUT(["type"=>"hidden", "name"=>$name, "value"=>$value]); + $_hidden = function (string $name, $value) { + return INPUT(["type" => "hidden", "name" => $name, "value" => $value]); }; $_input_id = $_hidden("pool_id", $pool->id); @@ -180,38 +180,38 @@ public function sidebar_options(Page $page, Pool $pool, bool $check_all) $editor = emptyHTML( SHM_SIMPLE_FORM( "pool/import", - INPUT(["type"=>"text", "name"=>"pool_tag", "id"=>"edit_pool_tag", "placeholder"=>"Please enter a tag"]), + INPUT(["type" => "text", "name" => "pool_tag", "id" => "edit_pool_tag", "placeholder" => "Please enter a tag"]), $_input_id, - SHM_SUBMIT("Import", ["name"=>"edit", "id"=>"edit_pool_import_btn"]) + SHM_SUBMIT("Import", ["name" => "edit", "id" => "edit_pool_import_btn"]) ), SHM_SIMPLE_FORM( "pool/edit", $_hidden("edit_pool", "yes"), $_input_id, - SHM_SUBMIT("Edit Pool", ["name"=>"edit", "id"=>"edit_pool_btn"]), + SHM_SUBMIT("Edit Pool", ["name" => "edit", "id" => "edit_pool_btn"]), ), SHM_SIMPLE_FORM( "pool/order", $_hidden("order_view", "yes"), $_input_id, - SHM_SUBMIT("Order Pool", ["name"=>"edit", "id"=>"edit_pool_order_btn"]) + SHM_SUBMIT("Order Pool", ["name" => "edit", "id" => "edit_pool_order_btn"]) ), SHM_SIMPLE_FORM( "pool/reverse", $_hidden("reverse_view", "yes"), $_input_id, - SHM_SUBMIT("Reverse Order", ["name"=>"edit", "id"=>"reverse_pool_order_btn"]) + SHM_SUBMIT("Reverse Order", ["name" => "edit", "id" => "reverse_pool_order_btn"]) ), SHM_SIMPLE_FORM( "post/list/pool_id=" . $pool->id . "/1", - SHM_SUBMIT("Post/List View", ["name"=>"edit", "id"=>$pool->id]) + SHM_SUBMIT("Post/List View", ["name" => "edit", "id" => $pool->id]) ) ); if ($user->id == $pool->user_id || $user->can(Permissions::POOLS_ADMIN)) { $editor->appendChild( SCRIPT( - ["type"=>"text/javascript"], + ["type" => "text/javascript"], rawHTML("") ), - INPUT(["type"=>"button", "name"=>"CheckAll", "value"=>"Check All", "onclick"=>"setAll(true)"]), - INPUT(["type"=>"button", "name"=>"UnCheckAll", "value"=>"Uncheck All", "onclick"=>"setAll(false)"]) + INPUT(["type" => "button", "name" => "CheckAll", "value" => "Check All", "onclick" => "setAll(true)"]), + INPUT(["type" => "button", "name" => "UnCheckAll", "value" => "Uncheck All", "onclick" => "setAll(false)"]) ); } @@ -253,7 +253,7 @@ public function pool_result(Page $page, array $images, Pool $pool) $import = emptyHTML( SCRIPT( - ["type"=>"text/javascript"], + ["type" => "text/javascript"], rawHTML(" function confirm_action() { return confirm('Are you sure you want to add selected posts to this pool?'); @@ -264,14 +264,14 @@ function confirm_action() { $form = SHM_FORM("pool/add_posts", name: "checks"); foreach ($images as $image) { $form->appendChild( - SPAN(["class"=>"thumb"], $this->build_thumb_html($image), BR(), INPUT(["type"=>"checkbox", "name"=>"check[]", "value"=>$image->id])), + SPAN(["class" => "thumb"], $this->build_thumb_html($image), BR(), INPUT(["type" => "checkbox", "name" => "check[]", "value" => $image->id])), ); } $form->appendChild( BR(), - SHM_SUBMIT("Add Selected", ["name"=>"edit", "id"=>"edit_pool_add_btn", "onclick"=>"return confirm_action()"]), - INPUT(["type"=>"hidden", "name"=>"pool_id", "value"=>$pool->id]) + SHM_SUBMIT("Add Selected", ["name" => "edit", "id" => "edit_pool_add_btn", "onclick" => "return confirm_action()"]), + INPUT(["type" => "hidden", "name" => "pool_id", "value" => $pool->id]) ); $import->appendChild($form); @@ -289,18 +289,18 @@ public function edit_order(Page $page, Pool $pool, array $images) $this->display_top($pool, "Sorting Pool"); $form = SHM_FORM("pool/order", name: "checks"); - foreach ($images as $i=>$image) { + foreach ($images as $i => $image) { $form->appendChild(SPAN( - ["class"=>"thumb"], + ["class" => "thumb"], $this->build_thumb_html($image), - INPUT(["type"=>"number", "name"=>"imgs[$i][]", "value"=>$image->image_order, "style"=>"max-width: 50px;"]), - INPUT(["type"=>"hidden", "name"=>"imgs[$i][]", "value"=>$image->id]) + INPUT(["type" => "number", "name" => "imgs[$i][]", "value" => $image->image_order, "style" => "max-width: 50px;"]), + INPUT(["type" => "hidden", "name" => "imgs[$i][]", "value" => $image->id]) )); } $form->appendChild( - INPUT(["type"=>"hidden", "name"=>"pool_id", "value"=>$pool->id]), - SHM_SUBMIT("Order", ["name"=>"edit", "id"=>"edit_pool_order"]) + INPUT(["type" => "hidden", "name" => "pool_id", "value" => $pool->id]), + SHM_SUBMIT("Order", ["name" => "edit", "id" => "edit_pool_order"]) ); $page->add_block(new Block("Sorting Posts", $form, position: 30)); @@ -314,11 +314,11 @@ public function edit_order(Page $page, Pool $pool, array $images) */ public function edit_pool(Page $page, Pool $pool, array $images) { - $_input_id = INPUT(["type"=>"hidden", "name"=>"pool_id", "value"=>$pool->id]); + $_input_id = INPUT(["type" => "hidden", "name" => "pool_id", "value" => $pool->id]); $desc_form = SHM_SIMPLE_FORM( "pool/edit/description", - TEXTAREA(["name"=>"description"], $pool->description), + TEXTAREA(["name" => "description"], $pool->description), BR(), $_input_id, SHM_SUBMIT("Change Description") @@ -327,16 +327,16 @@ public function edit_pool(Page $page, Pool $pool, array $images) $images_form = SHM_FORM("pool/remove_posts", name: "checks"); foreach ($images as $image) { $images_form->appendChild(SPAN( - ["class"=>"thumb"], + ["class" => "thumb"], $this->build_thumb_html($image), - INPUT(["type"=>"checkbox", "name"=>"check[]", "value"=>$image->id]) + INPUT(["type" => "checkbox", "name" => "check[]", "value" => $image->id]) )); } $images_form->appendChild( BR(), $_input_id, - SHM_SUBMIT("Remove Selected", ["name"=>"edit", "id"=>"edit_pool_remove_sel"]) + SHM_SUBMIT("Remove Selected", ["name" => "edit", "id" => "edit_pool_remove_sel"]) ); $pool->description = ""; //This is a rough fix to avoid showing the description twice. @@ -353,7 +353,7 @@ public function show_history(array $histories, int $pageNumber, int $totalPages) global $page; $table = TABLE( - ["id"=>"poolsList", "class"=>"zebra"], + ["id" => "poolsList", "class" => "zebra"], THEAD(TR(TH("Pool"), TH("Post Count"), TH("Changes"), TH("Updater"), TH("Date"), TH("Action"))) ); @@ -380,7 +380,7 @@ public function show_history(array $histories, int $pageNumber, int $totalPages) } $body[] = TR( - TD(["class"=>"left"], $pool_link), + TD(["class" => "left"], $pool_link), TD($history["count"]), TD($image_links), TD($user_link), @@ -406,11 +406,11 @@ public function get_bulk_pool_input(array $search_terms): HTMLElement { return INPUT( [ - "type"=>"text", - "name"=>"bulk_pool_new", - "placeholder"=>"New Pool", - "required"=>"", - "value"=>implode(" ", $search_terms) + "type" => "text", + "name" => "bulk_pool_new", + "placeholder" => "New Pool", + "required" => "", + "value" => implode(" ", $search_terms) ] ); } diff --git a/ext/post_titles/info.php b/ext/post_titles/info.php index 1c1c87b06..a217ff87d 100644 --- a/ext/post_titles/info.php +++ b/ext/post_titles/info.php @@ -10,7 +10,7 @@ class PostTitlesInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Post Titles"; - public array $authors = ["Matthew Barbour"=>"matthew@darkholme.net"]; + public array $authors = ["Matthew Barbour" => "matthew@darkholme.net"]; public string $license = self::LICENSE_WTFPL; public string $description = "Add titles to media posts"; } diff --git a/ext/post_titles/main.php b/ext/post_titles/main.php index ff3ef241a..d4ff1698d 100644 --- a/ext/post_titles/main.php +++ b/ext/post_titles/main.php @@ -81,7 +81,7 @@ public function onBulkExport(BulkExportEvent $event) } public function onBulkImport(BulkImportEvent $event) { - if (array_key_exists("title", $event->fields) && $event->fields['title']!=null) { + if (array_key_exists("title", $event->fields) && $event->fields['title'] != null) { $this->set_title($event->image->id, $event->fields['title']); } } @@ -89,7 +89,7 @@ public function onBulkImport(BulkImportEvent $event) private function set_title(int $image_id, string $title) { global $database; - $database->execute("UPDATE images SET title=:title WHERE id=:id", ['title'=>$title, 'id'=>$image_id]); + $database->execute("UPDATE images SET title=:title WHERE id=:id", ['title' => $title, 'id' => $image_id]); log_info("post_titles", "Title for >>{$image_id} set to: ".$title); } @@ -97,7 +97,7 @@ public static function get_title(Image $image): string { global $config; - $title = $image->title??""; + $title = $image->title ?? ""; if (empty($title) && $config->get_bool(PostTitlesConfig::DEFAULT_TO_FILENAME)) { $info = pathinfo($image->filename); if (array_key_exists("extension", $info)) { diff --git a/ext/private_image/info.php b/ext/private_image/info.php index 2196f19e5..3c34e4463 100644 --- a/ext/private_image/info.php +++ b/ext/private_image/info.php @@ -10,7 +10,7 @@ class PrivateImageInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Private Post"; - public array $authors = ["Matthew Barbour"=>"matthew@darkholme.net"]; + public array $authors = ["Matthew Barbour" => "matthew@darkholme.net"]; public string $license = self::LICENSE_WTFPL; public string $description = "Allows users to mark images as private, which prevents other users from seeing them."; } diff --git a/ext/private_image/main.php b/ext/private_image/main.php index 7c9ada832..ae154dddd 100644 --- a/ext/private_image/main.php +++ b/ext/private_image/main.php @@ -53,10 +53,10 @@ public function onPageRequest(PageRequestEvent $event) throw new SCoreException("Can not make image private: No valid Post ID given."); } $image = Image::by_id($image_id); - if ($image==null) { + if ($image == null) { throw new SCoreException("Post not found."); } - if ($image->owner_id!=$user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) { + if ($image->owner_id != $user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) { throw new SCoreException("Cannot set another user's image to private."); } @@ -75,10 +75,10 @@ public function onPageRequest(PageRequestEvent $event) throw new SCoreException("Can not make image public: No valid Post ID given."); } $image = Image::by_id($image_id); - if ($image==null) { + if ($image == null) { throw new SCoreException("Post not found."); } - if ($image->owner_id!=$user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) { + if ($image->owner_id != $user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) { throw new SCoreException("Cannot set another user's image to public."); } @@ -117,7 +117,7 @@ public function onDisplayingImage(DisplayingImageEvent $event) { global $user, $page; - if ($event->image->private===true && $event->image->owner_id!=$user->id && !$user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) { + if ($event->image->private === true && $event->image->owner_id != $user->id && !$user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) { $page->set_mode(PageMode::REDIRECT); $page->set_redirect(make_link()); } @@ -137,12 +137,12 @@ public function onSearchTermParse(SearchTermParseEvent $event) $event->add_querylet( new Querylet( "private != :true OR owner_id = :private_owner_id", - ["private_owner_id"=>$user->id, "true"=>true] + ["private_owner_id" => $user->id, "true" => true] ) ); } else { $event->add_querylet( - new Querylet("private != :true", ["true"=>true]) + new Querylet("private != :true", ["true" => true]) ); } } @@ -182,7 +182,7 @@ public function onSearchTermParse(SearchTermParseEvent $event) public function onHelpPageBuilding(HelpPageBuildingEvent $event) { - if ($event->key===HelpPages::SEARCH) { + if ($event->key === HelpPages::SEARCH) { $block = new Block(); $block->header = "Private Posts"; $block->body = $this->theme->get_help_html(); @@ -207,7 +207,7 @@ public static function privatize_image($image_id) $database->execute( "UPDATE images SET private = :true WHERE id = :id AND private = :false", - ["id"=>$image_id, "true"=>true, "false"=>false] + ["id" => $image_id, "true" => true, "false" => false] ); } @@ -217,14 +217,14 @@ public static function publicize_image($image_id) $database->execute( "UPDATE images SET private = :false WHERE id = :id AND private = :true", - ["id"=>$image_id, "true"=>true, "false"=>false] + ["id" => $image_id, "true" => true, "false" => false] ); } public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) { global $user; - if (($user->can(Permissions::SET_PRIVATE_IMAGE) && $user->id==$event->image->owner_id) || $user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) { + if (($user->can(Permissions::SET_PRIVATE_IMAGE) && $user->id == $event->image->owner_id) || $user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) { $event->add_part($this->theme->get_image_admin_html($event->image)); } } @@ -256,7 +256,7 @@ public function onBulkAction(BulkActionEvent $event) if ($user->can(Permissions::SET_PRIVATE_IMAGE)) { $total = 0; foreach ($event->items as $image) { - if ($image->owner_id==$user->id || + if ($image->owner_id == $user->id || $user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) { self::privatize_image($image->id); $total++; @@ -268,7 +268,7 @@ public function onBulkAction(BulkActionEvent $event) case "bulk_publicize_image": $total = 0; foreach ($event->items as $image) { - if ($image->owner_id==$user->id || + if ($image->owner_id == $user->id || $user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) { self::publicize_image($image->id); $total++; diff --git a/ext/private_image/theme.php b/ext/private_image/theme.php index a06a22397..65c12248f 100644 --- a/ext/private_image/theme.php +++ b/ext/private_image/theme.php @@ -10,16 +10,16 @@ class PrivateImageTheme extends Themelet { public function get_image_admin_html(Image $image): string { - if ($image->private===false) { + if ($image->private === false) { $html = SHM_SIMPLE_FORM( 'privatize_image/'.$image->id, - INPUT(["type"=>'hidden', "name"=>'image_id', "value"=>$image->id]), + INPUT(["type" => 'hidden', "name" => 'image_id', "value" => $image->id]), SHM_SUBMIT("Make Private") ); } else { $html = SHM_SIMPLE_FORM( 'publicize_image/'.$image->id, - INPUT(["type"=>'hidden', "name"=>'image_id', "value"=>$image->id]), + INPUT(["type" => 'hidden', "name" => 'image_id', "value" => $image->id]), SHM_SUBMIT("Make Public") ); } diff --git a/ext/qr_code/info.php b/ext/qr_code/info.php index c43b3fdee..dac6bf0d3 100644 --- a/ext/qr_code/info.php +++ b/ext/qr_code/info.php @@ -11,7 +11,7 @@ class QRImageInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "QR Codes"; public string $url = "http://seemslegit.com"; - public array $authors = ["Zach Hall"=>"zach@sosguy.net"]; + public array $authors = ["Zach Hall" => "zach@sosguy.net"]; public string $license = self::LICENSE_GPLV2; public string $description = "Shows a QR Code for downloading a post to cell phones"; public ?string $documentation = diff --git a/ext/random_image/main.php b/ext/random_image/main.php index 2733708c1..05c89294d 100644 --- a/ext/random_image/main.php +++ b/ext/random_image/main.php @@ -62,7 +62,7 @@ public function onPostListBuilding(PostListBuildingEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { - if ($event->parent=="posts") { + if ($event->parent == "posts") { $event->add_nav_link("posts_random", new Link('random_image/view'), "Random Post"); } } diff --git a/ext/random_image/theme.php b/ext/random_image/theme.php index 144e0717a..6150609ba 100644 --- a/ext/random_image/theme.php +++ b/ext/random_image/theme.php @@ -20,16 +20,16 @@ public function build_random_html(Image $image, ?string $query = null): string $tsize = get_thumbnail_size($image->width, $image->height); return (string)DIV( - ["style"=>"text-align: center;"], + ["style" => "text-align: center;"], A( - ["href"=>make_link("post/view/{$image->id}", $query)], + ["href" => make_link("post/view/{$image->id}", $query)], IMG([ - "id"=>"thumb_rand_{$image->id}", - "title"=>$image->get_tooltip(), - "alt"=>$image->get_tooltip(), - "class"=>'highlighted', - "style"=>"max-height: {$tsize[1]}px; max-width: 100%;", - "src"=>$image->get_thumb_link() + "id" => "thumb_rand_{$image->id}", + "title" => $image->get_tooltip(), + "alt" => $image->get_tooltip(), + "class" => 'highlighted', + "style" => "max-height: {$tsize[1]}px; max-width: 100%;", + "src" => $image->get_thumb_link() ]) ) ); diff --git a/ext/random_list/info.php b/ext/random_list/info.php index 38ec94df3..8a52e22bc 100644 --- a/ext/random_list/info.php +++ b/ext/random_list/info.php @@ -11,7 +11,7 @@ class RandomListInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Random List"; public string $url = "http://www.drudexsoftware.com"; - public array $authors = ["Drudex Software"=>"support@drudexsoftware.com"]; + public array $authors = ["Drudex Software" => "support@drudexsoftware.com"]; public string $license = self::LICENSE_GPLV2; public string $description = "Allows displaying a page with random posts"; public ?string $documentation = diff --git a/ext/random_list/main.php b/ext/random_list/main.php index 18b077d1c..a8c07ba31 100644 --- a/ext/random_list/main.php +++ b/ext/random_list/main.php @@ -72,7 +72,7 @@ public function onSetupBuilding(SetupBuildingEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { - if ($event->parent=="posts") { + if ($event->parent == "posts") { $event->add_nav_link("posts_random", new Link('random'), "Shuffle"); } } diff --git a/ext/rating/main.php b/ext/rating/main.php index ac70adb5d..b2db0f5f4 100644 --- a/ext/rating/main.php +++ b/ext/rating/main.php @@ -19,7 +19,7 @@ class ImageRating public function __construct(string $code, string $name, string $search_term, int $order) { - assert(strlen($code)==1, "Rating code must be exactly one character"); + assert(strlen($code) == 1, "Rating code must be exactly one character"); $this->name = $name; $this->code = $code; @@ -230,7 +230,7 @@ public function onParseLinkTemplate(ParseLinkTemplateEvent $event) public function onHelpPageBuilding(HelpPageBuildingEvent $event) { - if ($event->key===HelpPages::SEARCH) { + if ($event->key === HelpPages::SEARCH) { $ratings = self::get_sorted_ratings(); $event->add_block(new Block("Ratings", $this->theme->get_help_html($ratings))); } @@ -253,7 +253,7 @@ public function onSearchTermParse(SearchTermParseEvent $event) if (preg_match($this->search_regexp, strtolower($event->term), $matches)) { $ratings = $matches[1] ? $matches[1] : $matches[2][0]; - if (count($matches)>2&&in_array($matches[2], self::UNRATED_KEYWORDS)) { + if (count($matches) > 2 && in_array($matches[2], self::UNRATED_KEYWORDS)) { $ratings = "?"; } @@ -283,7 +283,7 @@ public function onTagTermParse(TagTermParseEvent $event) if (preg_match($this->search_regexp, strtolower($event->term), $matches)) { $ratings = $matches[1] ? $matches[1] : $matches[2][0]; - if (count($matches)>2&&in_array($matches[2], self::UNRATED_KEYWORDS)) { + if (count($matches) > 2 && in_array($matches[2], self::UNRATED_KEYWORDS)) { $ratings = "?"; } @@ -328,7 +328,7 @@ public function onAdminAction(AdminActionEvent $event) $new = $_POST["rating_new"]; if ($user->can(Permissions::BULK_EDIT_IMAGE_RATING)) { - $database->execute("UPDATE images SET rating = :new WHERE rating = :old", ["new"=>$new, "old"=>$old ]); + $database->execute("UPDATE images SET rating = :new WHERE rating = :old", ["new" => $new, "old" => $old ]); } break; @@ -410,7 +410,7 @@ public static function get_sorted_ratings(): array return $ratings; } - public static function get_ratings_dict(array $ratings=null): array + public static function get_ratings_dict(array $ratings = null): array { if (!isset($ratings)) { $ratings = self::get_sorted_ratings(); @@ -448,7 +448,7 @@ public static function privs_to_sql(array $privs): string foreach ($privs as $i) { $arr[] = "'" . $i . "'"; } - if (sizeof($arr)==0) { + if (sizeof($arr) == 0) { return "' '"; } return join(', ', $arr); @@ -538,7 +538,7 @@ public function onDatabaseUpgrade(DatabaseUpgradeEvent $event) $database->set_timeout(null); // These updates can take a little bit - $database->execute("UPDATE images SET rating = :new WHERE rating = :old", ["new"=>'?', "old"=>'u' ]); + $database->execute("UPDATE images SET rating = :new WHERE rating = :old", ["new" => '?', "old" => 'u' ]); $this->set_version(RatingsConfig::VERSION, 4); } @@ -548,7 +548,7 @@ private function set_rating(int $image_id, string $rating, string $old_rating) { global $database; if ($old_rating != $rating) { - $database->execute("UPDATE images SET rating=:rating WHERE id=:id", ['rating'=>$rating, 'id'=>$image_id]); + $database->execute("UPDATE images SET rating=:rating WHERE id=:id", ['rating' => $rating, 'id' => $image_id]); log_info("rating", "Rating for >>{$image_id} set to: ".$this->rating_to_human($rating)); } } diff --git a/ext/rating/theme.php b/ext/rating/theme.php index 13408bcb1..654e9482b 100644 --- a/ext/rating/theme.php +++ b/ext/rating/theme.php @@ -21,7 +21,7 @@ public function get_rater_html(int $image_id, string $rating, bool $can_rate): H return SHM_POST_INFO( "Rating", $can_rate, - A(["href"=>search_link(["rating=$rating"])], Ratings::rating_to_human($rating)), + A(["href" => search_link(["rating=$rating"])], Ratings::rating_to_human($rating)), $this->get_selection_rater_html("rating", selected_options: [$rating]) ); } @@ -31,10 +31,10 @@ public function display_form(array $current_ratings) global $page; $table = TABLE( - ["class"=>"form"], + ["class" => "form"], TR(TH("Change"), TD($this->get_selection_rater_html("rating_old", $current_ratings))), TR(TH("To"), TD($this->get_selection_rater_html("rating_new"))), - TR(TD(["colspan"=>"2"], SHM_SUBMIT("Update"))) + TR(TD(["colspan" => "2"], SHM_SUBMIT("Update"))) ); $page->add_block(new Block("Update Ratings", SHM_SIMPLE_FORM("admin/update_ratings", $table))); diff --git a/ext/regen_thumb/main.php b/ext/regen_thumb/main.php index 1e40d6f0f..227d23cdb 100644 --- a/ext/regen_thumb/main.php +++ b/ext/regen_thumb/main.php @@ -75,8 +75,8 @@ public function onBulkAction(BulkActionEvent $event) if ($user->can(Permissions::DELETE_IMAGE)) { $force = true; if (isset($_POST["bulk_regen_thumb_missing_only"]) - &&$_POST["bulk_regen_thumb_missing_only"]=="true") { - $force=false; + && $_POST["bulk_regen_thumb_missing_only"] == "true") { + $force = false; } $total = 0; @@ -103,12 +103,12 @@ public function onAdminAction(AdminActionEvent $event) case "regen_thumbs": $event->redirect = true; $force = false; - if (isset($_POST["regen_thumb_force"])&&$_POST["regen_thumb_force"]=="true") { - $force=true; + if (isset($_POST["regen_thumb_force"]) && $_POST["regen_thumb_force"] == "true") { + $force = true; } $limit = 1000; - if (isset($_POST["regen_thumb_limit"])&&is_numeric($_POST["regen_thumb_limit"])) { - $limit=intval($_POST["regen_thumb_limit"]); + if (isset($_POST["regen_thumb_limit"]) && is_numeric($_POST["regen_thumb_limit"])) { + $limit = intval($_POST["regen_thumb_limit"]); } $mime = ""; @@ -129,7 +129,7 @@ public function onAdminAction(AdminActionEvent $event) if ($event->generated) { $i++; } - if ($i>=$limit) { + if ($i >= $limit) { break; } } @@ -138,7 +138,7 @@ public function onAdminAction(AdminActionEvent $event) case "delete_thumbs": $event->redirect = true; - if (isset($_POST["delete_thumb_mime"])&&$_POST["delete_thumb_mime"]!="") { + if (isset($_POST["delete_thumb_mime"]) && $_POST["delete_thumb_mime"] != "") { $images = $this->get_images($_POST["delete_thumb_mime"]); $i = 0; diff --git a/ext/regen_thumb/test.php b/ext/regen_thumb/test.php index 44f93fd19..0e84b8186 100644 --- a/ext/regen_thumb/test.php +++ b/ext/regen_thumb/test.php @@ -12,7 +12,7 @@ public function testRegenThumb() $image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot"); $this->get_page("post/view/$image_id"); - $this->post_page("regen_thumb/one", ['image_id'=>$image_id]); + $this->post_page("regen_thumb/one", ['image_id' => $image_id]); $this->assert_title("Thumbnail Regenerated"); # FIXME: test that the thumb's modified time has been updated diff --git a/ext/regen_thumb/theme.php b/ext/regen_thumb/theme.php index cf05e5c36..3b7205620 100644 --- a/ext/regen_thumb/theme.php +++ b/ext/regen_thumb/theme.php @@ -15,7 +15,7 @@ public function get_buttons_html(int $image_id): string { return (string)SHM_SIMPLE_FORM( "regen_thumb/one", - INPUT(["type"=>'hidden', "name"=>'image_id', "value"=>$image_id]), + INPUT(["type" => 'hidden', "name" => 'image_id', "value" => $image_id]), SHM_SUBMIT('Regenerate Thumbnail') ); } diff --git a/ext/relationships/info.php b/ext/relationships/info.php index f7a8e3444..387760246 100644 --- a/ext/relationships/info.php +++ b/ext/relationships/info.php @@ -10,7 +10,7 @@ class RelationshipsInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Post Relationships"; - public array $authors = ["Angus Johnston"=>"admin@codeanimu.net"]; + public array $authors = ["Angus Johnston" => "admin@codeanimu.net"]; public string $license = self::LICENSE_GPLV2; public string $description = "Allow posts to have relationships (parent/child)."; } diff --git a/ext/relationships/main.php b/ext/relationships/main.php index e6684cb8c..80f5183b5 100644 --- a/ext/relationships/main.php +++ b/ext/relationships/main.php @@ -85,17 +85,17 @@ public function onSearchTermParse(SearchTermParseEvent $event) $not = ($parentID == "any" ? "NOT" : ""); $event->add_querylet(new Querylet("images.parent_id IS $not NULL")); } else { - $event->add_querylet(new Querylet("images.parent_id = :pid", ["pid"=>$parentID])); + $event->add_querylet(new Querylet("images.parent_id = :pid", ["pid" => $parentID])); } } elseif (preg_match("/^child[=|:](any|none)$/", $event->term, $matches)) { $not = ($matches[1] == "any" ? "=" : "!="); - $event->add_querylet(new Querylet("images.has_children $not :true", ["true"=>true])); + $event->add_querylet(new Querylet("images.has_children $not :true", ["true" => true])); } } public function onHelpPageBuilding(HelpPageBuildingEvent $event) { - if ($event->key===HelpPages::SEARCH) { + if ($event->key === HelpPages::SEARCH) { $block = new Block(); $block->header = "Relationships"; $block->body = $this->theme->get_help_html(); @@ -137,7 +137,7 @@ public function onImageDeletion(ImageDeletionEvent $event) global $database; if (bool_escape($event->image->has_children)) { - $database->execute("UPDATE images SET parent_id = NULL WHERE parent_id = :iid", ["iid"=>$event->image->id]); + $database->execute("UPDATE images SET parent_id = NULL WHERE parent_id = :iid", ["iid" => $event->image->id]); } if ($event->image->parent_id !== null) { @@ -149,7 +149,7 @@ public function onImageRelationshipSet(ImageRelationshipSetEvent $event) { global $database; - $old_parent = $database->get_one("SELECT parent_id FROM images WHERE id = :cid", ["cid"=>$event->child_id]); + $old_parent = $database->get_one("SELECT parent_id FROM images WHERE id = :cid", ["cid" => $event->child_id]); if (!is_null($old_parent)) { $old_parent = (int)$old_parent; } @@ -162,9 +162,9 @@ public function onImageRelationshipSet(ImageRelationshipSetEvent $event) } $database->execute("UPDATE images SET parent_id = :pid WHERE id = :cid", ["pid" => $event->parent_id, "cid" => $event->child_id]); - $database->execute("UPDATE images SET has_children = :true WHERE id = :pid", ["pid" => $event->parent_id, "true"=>true]); + $database->execute("UPDATE images SET has_children = :true WHERE id = :pid", ["pid" => $event->parent_id, "true" => true]); - if ($old_parent!=null) { + if ($old_parent != null) { $this->set_has_children($old_parent); } } @@ -172,10 +172,10 @@ public function onImageRelationshipSet(ImageRelationshipSetEvent $event) public static function get_children(Image $image, int $omit = null): array { global $database; - $results = $database->get_all_iterable("SELECT * FROM images WHERE parent_id = :pid ", ["pid"=>$image->id]); + $results = $database->get_all_iterable("SELECT * FROM images WHERE parent_id = :pid ", ["pid" => $image->id]); $output = []; foreach ($results as $result) { - if ($result["id"]==$omit) { + if ($result["id"] == $omit) { continue; } $output[] = new Image($result); @@ -186,10 +186,10 @@ public static function get_children(Image $image, int $omit = null): array private function remove_parent(int $imageID) { global $database; - $parentID = $database->get_one("SELECT parent_id FROM images WHERE id = :iid", ["iid"=>$imageID]); + $parentID = $database->get_one("SELECT parent_id FROM images WHERE id = :iid", ["iid" => $imageID]); if ($parentID) { - $database->execute("UPDATE images SET parent_id = NULL WHERE id = :iid", ["iid"=>$imageID]); + $database->execute("UPDATE images SET parent_id = NULL WHERE id = :iid", ["iid" => $imageID]); $this->set_has_children((int)$parentID); } } @@ -207,11 +207,11 @@ private function set_has_children(int $parent_id) $children = $database->get_one( "SELECT COUNT(*) FROM images WHERE parent_id=:pid", - ["pid"=>$parent_id] + ["pid" => $parent_id] ); $database->execute( "UPDATE images SET has_children = :has_children WHERE id = :pid", - ["has_children"=>$children>0, "pid"=>$parent_id] + ["has_children" => $children > 0, "pid" => $parent_id] ); } } diff --git a/ext/relationships/test.php b/ext/relationships/test.php index 88c54315e..6e24e0621 100644 --- a/ext/relationships/test.php +++ b/ext/relationships/test.php @@ -104,7 +104,7 @@ public function testRemoveParent($imgs) global $database; $database->execute( "UPDATE images SET parent_id=NULL, has_children=:false", - ["false"=>false] + ["false" => false] ); // FIXME: send_event(new ImageRelationshipSetEvent($image_2->id, null)); diff --git a/ext/relationships/theme.php b/ext/relationships/theme.php index c3cacf455..0a8af4a56 100644 --- a/ext/relationships/theme.php +++ b/ext/relationships/theme.php @@ -20,7 +20,7 @@ public function relationship_info(Image $image) } if (bool_escape($image->has_children)) { - $ids = $database->get_col("SELECT id FROM images WHERE parent_id = :iid", ["iid"=>$image->id]); + $ids = $database->get_col("SELECT id FROM images WHERE parent_id = :iid", ["iid" => $image->id]); $html = "This post has ".(count($ids) > 1 ? "child posts" : "a child post").""; $html .= " (post "; @@ -41,7 +41,7 @@ public function get_parent_editor_html(Image $image): HTMLElement "Parent", !$user->is_anonymous(), strval($image->parent_id) ?: "None", - INPUT(["type"=>"number", "name"=>"tag_edit__parent", "value"=>$image->parent_id]) + INPUT(["type" => "number", "name" => "tag_edit__parent", "value" => $image->parent_id]) ); } diff --git a/ext/report_image/info.php b/ext/report_image/info.php index 3a60a0f66..1cf3439d7 100644 --- a/ext/report_image/info.php +++ b/ext/report_image/info.php @@ -11,7 +11,7 @@ class ReportImageInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Report Posts"; public string $url = "http://atravelinggeek.com/"; - public array $authors = ["ATravelingGeek"=>"atg@atravelinggeek.com"]; + public array $authors = ["ATravelingGeek" => "atg@atravelinggeek.com"]; public string $license = self::LICENSE_GPLV2; public string $description = "Report posts as dupes/illegal/etc"; public ?string $version = "0.3a"; diff --git a/ext/report_image/main.php b/ext/report_image/main.php index 01f83c3e4..2cc5b4be4 100644 --- a/ext/report_image/main.php +++ b/ext/report_image/main.php @@ -89,7 +89,7 @@ public function onAddReportedImage(AddReportedImageEvent $event) $database->execute( "INSERT INTO image_reports(image_id, reporter_id, reason) VALUES (:image_id, :reporter_id, :reason)", - ['image_id'=>$event->report->image_id, 'reporter_id'=>$event->report->user_id, 'reason'=>$event->report->reason] + ['image_id' => $event->report->image_id, 'reporter_id' => $event->report->user_id, 'reason' => $event->report->reason] ); $cache->delete("image-report-count"); } @@ -97,7 +97,7 @@ public function onAddReportedImage(AddReportedImageEvent $event) public function onRemoveReportedImage(RemoveReportedImageEvent $event) { global $cache, $database; - $database->execute("DELETE FROM image_reports WHERE id = :id", ["id"=>$event->id]); + $database->execute("DELETE FROM image_reports WHERE id = :id", ["id" => $event->id]); $cache->delete("image-report-count"); } @@ -122,7 +122,7 @@ public function onDisplayingImage(DisplayingImageEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { global $user; - if ($event->parent==="system") { + if ($event->parent === "system") { if ($user->can(Permissions::VIEW_IMAGE_REPORT)) { $count = $this->count_reported_images(); $h_count = $count > 0 ? " ($count)" : ""; @@ -145,7 +145,7 @@ public function onUserBlockBuilding(UserBlockBuildingEvent $event) public function onImageDeletion(ImageDeletionEvent $event) { global $cache, $database; - $database->execute("DELETE FROM image_reports WHERE image_id = :image_id", ["image_id"=>$event->image->id]); + $database->execute("DELETE FROM image_reports WHERE image_id = :image_id", ["image_id" => $event->image->id]); $cache->delete("image-report-count"); } @@ -170,7 +170,7 @@ public function onSetupBuilding(SetupBuildingEvent $event) public function delete_reports_by(int $user_id) { global $cache, $database; - $database->execute("DELETE FROM image_reports WHERE reporter_id=:reporter_id", ['reporter_id'=>$user_id]); + $database->execute("DELETE FROM image_reports WHERE reporter_id=:reporter_id", ['reporter_id' => $user_id]); $cache->delete("image-report-count"); } diff --git a/ext/report_image/theme.php b/ext/report_image/theme.php index 82dd33c24..55a16b999 100644 --- a/ext/report_image/theme.php +++ b/ext/report_image/theme.php @@ -96,7 +96,7 @@ public function get_nuller(User $duser) global $page; $html = (string)SHM_SIMPLE_FORM( "image_report/remove_reports_by", - INPUT(["type"=>'hidden', "name"=>'user_id', "value"=>$duser->id]), + INPUT(["type" => 'hidden', "name" => 'user_id', "value" => $duser->id]), SHM_SUBMIT('Delete all reports by this user') ); $page->add_block(new Block("Reports", $html, "main", 80)); diff --git a/ext/resize/info.php b/ext/resize/info.php index b7703588b..5b2bdfd97 100644 --- a/ext/resize/info.php +++ b/ext/resize/info.php @@ -16,7 +16,7 @@ class ResizeImageInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Resize Post"; - public array $authors = ["jgen"=>"jgen.tech@gmail.com"]; + public array $authors = ["jgen" => "jgen.tech@gmail.com"]; public string $license = self::LICENSE_GPLV2; public string $description = "This extension allows admins to resize images."; public ?string $version = "0.1"; diff --git a/ext/resize/main.php b/ext/resize/main.php index 543c24372..373edba4f 100644 --- a/ext/resize/main.php +++ b/ext/resize/main.php @@ -186,7 +186,7 @@ public function onImageDownloading(ImageDownloadingEvent $event) [$new_width, $new_height] = get_scaled_by_aspect_ratio($event->image->width, $event->image->height, $max_width, $max_height); - if ($new_width!==$event->image->width || $new_height !==$event->image->height) { + if ($new_width !== $event->image->width || $new_height !== $event->image->height) { $tmp_filename = tempnam(sys_get_temp_dir(), 'shimmie_resize'); if (empty($tmp_filename)) { throw new ImageResizeException("Unable to save temporary image file."); @@ -201,7 +201,7 @@ public function onImageDownloading(ImageDownloadingEvent $event) $new_height )); - if ($event->file_modified===true&&$event->path!=$event->image->get_image_filename()) { + if ($event->file_modified === true && $event->path != $event->image->get_image_filename()) { // This means that we're dealing with a temp file that will need cleaned up unlink($event->path); } diff --git a/ext/rotate/info.php b/ext/rotate/info.php index 51c530d49..66ae62815 100644 --- a/ext/rotate/info.php +++ b/ext/rotate/info.php @@ -16,7 +16,7 @@ class RotateImageInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Rotate Image"; - public array $authors = ["jgen"=>"jgen.tech@gmail.com","Agasa"=>"hiroshiagasa@gmail.com"]; + public array $authors = ["jgen" => "jgen.tech@gmail.com","Agasa" => "hiroshiagasa@gmail.com"]; public string $license = self::LICENSE_GPLV2; public string $description = "Allows admins to rotate images."; } diff --git a/ext/rotate/main.php b/ext/rotate/main.php index f8dcfa459..ff9dbe5d6 100644 --- a/ext/rotate/main.php +++ b/ext/rotate/main.php @@ -109,7 +109,7 @@ private function rotate_image(int $image_id, int $deg) } $image_filename = warehouse_path(Image::IMAGE_DIR, $hash); - if (file_exists($image_filename)===false) { + if (file_exists($image_filename) === false) { throw new ImageRotateException("$image_filename does not exist."); } @@ -136,12 +136,12 @@ private function rotate_image(int $image_id, int $deg) $background_color = imagecolorallocatealpha($image, 0, 0, 0, 127); break; } - if ($background_color===false) { + if ($background_color === false) { throw new ImageRotateException("Unable to allocate transparent color"); } $image_rotated = imagerotate($image, $deg, $background_color); - if ($image_rotated===false) { + if ($image_rotated === false) { throw new ImageRotateException("Image rotate failed"); } @@ -172,7 +172,7 @@ private function rotate_image(int $image_id, int $deg) throw new ImageRotateException("Unsupported image type."); } - if ($result===false) { + if ($result === false) { throw new ImageRotateException("Could not save image: ".$tmp_filename); } diff --git a/ext/rotate/theme.php b/ext/rotate/theme.php index a8a08a26b..a0d6f7e9f 100644 --- a/ext/rotate/theme.php +++ b/ext/rotate/theme.php @@ -15,9 +15,9 @@ public function get_rotate_html(int $image_id): string { return (string)SHM_SIMPLE_FORM( 'rotate/'.$image_id, - INPUT(["type"=>'hidden', "name"=>'image_id', "value"=>$image_id]), - INPUT(["type"=>'number', "name"=>'rotate_deg', "id"=>"rotate_deg", "placeholder"=>"Rotation degrees"]), - INPUT(["type"=>'submit', "value"=>'Rotate', "id"=>"rotatebutton"]), + INPUT(["type" => 'hidden', "name" => 'image_id', "value" => $image_id]), + INPUT(["type" => 'number', "name" => 'rotate_deg', "id" => "rotate_deg", "placeholder" => "Rotation degrees"]), + INPUT(["type" => 'submit', "value" => 'Rotate', "id" => "rotatebutton"]), ); } diff --git a/ext/rss_comments/main.php b/ext/rss_comments/main.php index 5afadf6b1..64e7b9605 100644 --- a/ext/rss_comments/main.php +++ b/ext/rss_comments/main.php @@ -77,7 +77,7 @@ public function onPageRequest(PageRequestEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { - if ($event->parent=="comment") { + if ($event->parent == "comment") { $event->add_nav_link("comment_rss", new Link('rss/comments'), "Feed"); } } diff --git a/ext/rss_images/main.php b/ext/rss_images/main.php index 5cccc51ce..f1e015835 100644 --- a/ext/rss_images/main.php +++ b/ext/rss_images/main.php @@ -31,7 +31,7 @@ public function onPageRequest(PageRequestEvent $event) return; } try { - $images = Image::find_images(($page_number-1)*$page_size, $page_size, $search_terms); + $images = Image::find_images(($page_number - 1) * $page_size, $page_size, $search_terms); $this->do_rss($images, $search_terms, $page_number); } catch (SearchTermParseException $stpe) { $this->theme->display_error(400, "Search parse error", $stpe->error); @@ -67,12 +67,12 @@ private function do_rss(array $images, array $search_terms, int $page_number) } if ($page_number > 1) { - $prev_url = make_link("rss/images/$search".($page_number-1)); + $prev_url = make_link("rss/images/$search".($page_number - 1)); $prev_link = ""; } else { $prev_link = ""; } - $next_url = make_link("rss/images/$search".($page_number+1)); + $next_url = make_link("rss/images/$search".($page_number + 1)); $next_link = ""; // no end... $version = VERSION; @@ -131,7 +131,7 @@ private function thumb(Image $image): string public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { - if ($event->parent=="posts") { + if ($event->parent == "posts") { $event->add_nav_link("posts_rss", new Link('rss/images'), "Feed"); } } diff --git a/ext/rule34/theme.php b/ext/rule34/theme.php index 0f607fe3a..9505b9d55 100644 --- a/ext/rule34/theme.php +++ b/ext/rule34/theme.php @@ -15,8 +15,8 @@ public function show_comic_changer(User $duser, bool $current_state): void global $page; $html = (string)SHM_SIMPLE_FORM( "rule34/comic_admin", - INPUT(["type"=>'hidden', "name"=>'user_id', "value"=>$duser->id]), - LABEL(INPUT(["type"=>'checkbox', "name"=>'is_admin', "checked"=>$current_state]), "Comic Admin"), + INPUT(["type" => 'hidden', "name" => 'user_id', "value" => $duser->id]), + LABEL(INPUT(["type" => 'checkbox', "name" => 'is_admin', "checked" => $current_state]), "Comic Admin"), BR(), SHM_SUBMIT("Set") ); diff --git a/ext/setup/main.php b/ext/setup/main.php index 8684c7a0e..1587060e3 100644 --- a/ext/setup/main.php +++ b/ext/setup/main.php @@ -172,7 +172,7 @@ private function format_option( } } - public function add_text_option(string $name, string $label=null, bool $table_row = false) + public function add_text_option(string $name, string $label = null, bool $table_row = false) { $val = html_escape($this->config->get_string($name)); @@ -182,7 +182,7 @@ public function add_text_option(string $name, string $label=null, bool $table_ro $this->format_option($name, $html, $label, $table_row); } - public function add_longtext_option(string $name, string $label=null, bool $table_row = false) + public function add_longtext_option(string $name, string $label = null, bool $table_row = false) { $val = html_escape($this->config->get_string($name)); @@ -193,12 +193,12 @@ public function add_longtext_option(string $name, string $label=null, bool $tabl $this->format_option($name, $html, $label, $table_row, true); } - public function add_bool_option(string $name, string $label=null, bool $table_row = false) + public function add_bool_option(string $name, string $label = null, bool $table_row = false) { $checked = $this->config->get_bool($name) ? " checked" : ""; $html = ""; - if (!$table_row&&!is_null($label)) { + if (!$table_row && !is_null($label)) { $html .= ""; } @@ -218,7 +218,7 @@ public function add_bool_option(string $name, string $label=null, bool $table_ro // $this->body .= ""; // } - public function add_int_option(string $name, string $label=null, bool $table_row = false) + public function add_int_option(string $name, string $label = null, bool $table_row = false) { $val = $this->config->get_int($name); @@ -228,7 +228,7 @@ public function add_int_option(string $name, string $label=null, bool $table_row $this->format_option($name, $html, $label, $table_row); } - public function add_shorthand_int_option(string $name, string $label=null, bool $table_row = false) + public function add_shorthand_int_option(string $name, string $label = null, bool $table_row = false) { $val = to_shorthand_int($this->config->get_int($name)); $html = "\n"; @@ -237,7 +237,7 @@ public function add_shorthand_int_option(string $name, string $label=null, bool $this->format_option($name, $html, $label, $table_row); } - public function add_choice_option(string $name, array $options, string $label=null, bool $table_row = false) + public function add_choice_option(string $name, array $options, string $label = null, bool $table_row = false) { if (is_int(array_values($options)[0])) { $current = $this->config->get_int($name); @@ -248,9 +248,9 @@ public function add_choice_option(string $name, array $options, string $label=nu $html = ""; foreach ($options as $optname => $optval) { if (in_array($optval, $current)) { - $selected=" selected"; + $selected = " selected"; } else { - $selected=""; + $selected = ""; } $html .= "\n"; } @@ -280,7 +280,7 @@ public function add_multichoice_option(string $name, array $options, string $lab $this->format_option($name, $html, $label, $table_row); } - public function add_color_option(string $name, string $label=null, bool $table_row = false) + public function add_color_option(string $name, string $label = null, bool $table_row = false) { $val = html_escape($this->config->get_string($name)); @@ -445,7 +445,7 @@ public function onCommand(CommandEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { global $user; - if ($event->parent==="system") { + if ($event->parent === "system") { if ($user->can(Permissions::CHANGE_SETTING)) { $event->add_nav_link("setup", new Link('setup'), "Board Config", null, 0); } diff --git a/ext/shimmie_api/main.php b/ext/shimmie_api/main.php index 7d5e12627..cf590df2e 100644 --- a/ext/shimmie_api/main.php +++ b/ext/shimmie_api/main.php @@ -70,7 +70,7 @@ public function onPageRequest(PageRequestEvent $event) $search_terms = $event->get_search_terms(); $page_number = $event->get_page_number(); $page_size = $event->get_page_size(); - $images = Image::find_images(($page_number-1)*$page_size, $page_size, $search_terms); + $images = Image::find_images(($page_number - 1) * $page_size, $page_size, $search_terms); $safe_images = []; foreach ($images as $image) { $image->get_tag_array(); @@ -106,7 +106,7 @@ private function api_get_tags(?string $arg): array { global $database; if (!empty($arg)) { - $all = $database->get_all("SELECT tag FROM tags WHERE tag LIKE :tag", ['tag'=>$arg . "%"]); + $all = $database->get_all("SELECT tag FROM tags WHERE tag LIKE :tag", ['tag' => $arg . "%"]); } else { $all = $database->get_all("SELECT tag FROM tags"); } @@ -122,7 +122,7 @@ private function api_get_user(string $type, string $query): array global $database; $all = $database->get_row( "SELECT id, name, joindate, class FROM users WHERE $type=:query", - ['query'=>$query] + ['query' => $query] ); if (!empty($all)) { @@ -140,7 +140,7 @@ private function api_get_user(string $type, string $query): array if (isset($_GET['recent'])) { $recents = $database->get_all( "SELECT * FROM images WHERE owner_id=:owner_id ORDER BY id DESC LIMIT 0, 5", - ['owner_id'=>$all['id']] + ['owner_id' => $all['id']] ); $i = 0; diff --git a/ext/sitemap/info.php b/ext/sitemap/info.php index 58ec3e84f..cd18e749c 100644 --- a/ext/sitemap/info.php +++ b/ext/sitemap/info.php @@ -11,7 +11,7 @@ class XMLSitemapInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "XML Sitemap"; public string $url = "http://drudexsoftware.com"; - public array $authors = ["Sein Kraft"=>"mail@seinkraft.info","Drudex Software"=>"support@drudexsoftware.com"]; + public array $authors = ["Sein Kraft" => "mail@seinkraft.info","Drudex Software" => "support@drudexsoftware.com"]; public string $license = self::LICENSE_GPLV2; public string $description = "Sitemap with caching & advanced priorities"; } diff --git a/ext/source_history/main.php b/ext/source_history/main.php index b83c29c31..aec6f1933 100644 --- a/ext/source_history/main.php +++ b/ext/source_history/main.php @@ -86,7 +86,7 @@ public function onSourceSet(SourceSetEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { global $user; - if ($event->parent==="system") { + if ($event->parent === "system") { if ($user->can(Permissions::BULK_EDIT_IMAGE_TAG)) { $event->add_nav_link("source_history", new Link('source_history/all/1'), "Source Changes", NavLink::is_active(["source_history"])); } @@ -224,7 +224,7 @@ public function get_source_history_from_revert(int $revert_id): ?array SELECT source_histories.*, users.name FROM source_histories JOIN users ON source_histories.user_id = users.id - WHERE source_histories.id = :id", ["id"=>$revert_id]); + WHERE source_histories.id = :id", ["id" => $revert_id]); return ($row ? $row : null); } @@ -238,7 +238,7 @@ public function get_source_history_from_id(int $image_id): array JOIN users ON source_histories.user_id = users.id WHERE image_id = :image_id ORDER BY source_histories.id DESC", - ["image_id"=>$image_id] + ["image_id" => $image_id] ); } @@ -251,7 +251,7 @@ public function get_global_source_history(int $page_id): array JOIN users ON source_histories.user_id = users.id ORDER BY source_histories.id DESC LIMIT 100 OFFSET :offset - ", ["offset" => ($page_id-1)*100]); + ", ["offset" => ($page_id - 1) * 100]); } /** @@ -373,13 +373,13 @@ private function add_source_history(Image $image, string $source) } // if the image has no history, make one with the old source - $entries = $database->get_one("SELECT COUNT(*) FROM source_histories WHERE image_id = :image_id", ['image_id'=>$image->id]); + $entries = $database->get_one("SELECT COUNT(*) FROM source_histories WHERE image_id = :image_id", ['image_id' => $image->id]); if ($entries == 0 && !empty($old_source)) { $database->execute( " INSERT INTO source_histories(image_id, source, user_id, user_ip, date_set) VALUES (:image_id, :source, :user_id, :user_ip, now())", - ["image_id"=>$image->id, "source"=>$old_source, "user_id"=>$config->get_int('anon_id'), "user_ip"=>'127.0.0.1'] + ["image_id" => $image->id, "source" => $old_source, "user_id" => $config->get_int('anon_id'), "user_ip" => '127.0.0.1'] ); $entries++; } @@ -389,7 +389,7 @@ private function add_source_history(Image $image, string $source) " INSERT INTO source_histories(image_id, source, user_id, user_ip, date_set) VALUES (:image_id, :source, :user_id, :user_ip, now())", - ["image_id"=>$image->id, "source"=>$new_source, "user_id"=>$user->id, "user_ip"=>get_real_ip()] + ["image_id" => $image->id, "source" => $new_source, "user_id" => $user->id, "user_ip" => get_real_ip()] ); $entries++; @@ -406,8 +406,8 @@ private function add_source_history(Image $image, string $source) https://dev.mysql.com/doc/refman/5.1/en/subquery-restrictions.html https://stackoverflow.com/questions/45494/mysql-error-1093-cant-specify-target-table-for-update-in-from-clause */ - $min_id = $database->get_one("SELECT MIN(id) FROM source_histories WHERE image_id = :image_id", ["image_id"=>$image->id]); - $database->execute("DELETE FROM source_histories WHERE id = :id", ["id"=>$min_id]); + $min_id = $database->get_one("SELECT MIN(id) FROM source_histories WHERE image_id = :image_id", ["image_id" => $image->id]); + $database->execute("DELETE FROM source_histories WHERE id = :id", ["id" => $min_id]); } } } diff --git a/ext/source_history/theme.php b/ext/source_history/theme.php index d583abfb6..7c6a106ba 100644 --- a/ext/source_history/theme.php +++ b/ext/source_history/theme.php @@ -33,9 +33,9 @@ public function display_global_page(Page $page, array $history, int $page_number $page->add_block(new Block("Source History", $history_html, "main", 10)); $h_prev = ($page_number <= 1) ? "Prev" : - 'Prev'; + 'Prev'; $h_index = "Index"; - $h_next = 'Next'; + $h_next = 'Next'; $nav = $h_prev.' | '.$h_index.' | '.$h_next; $page->add_block(new Block("Navigation", $nav, "left")); @@ -44,7 +44,7 @@ public function display_global_page(Page $page, array $history, int $page_number /** * Add a section to the admin page. */ - public function display_admin_block(string $validation_msg='') + public function display_admin_block(string $validation_msg = '') { global $page; @@ -113,14 +113,14 @@ protected function history_entry(array $fields, bool $selected): string $ip = $user->can(Permissions::VIEW_IP) ? rawHTML(" " . show_ip($fields['user_ip'], "Sourcing >>$image_id as '$current_source'")) : null; - $setter = A(["href"=>make_link("user/" . url_escape($name))], $name); + $setter = A(["href" => make_link("user/" . url_escape($name))], $name); return (string)LI( - INPUT(["type"=>"radio", "name"=>"revert", "id"=>"$current_id", "value"=>"$current_id", "checked"=>$selected]), - A(["href"=>make_link("post/view/$image_id")], $image_id), + INPUT(["type" => "radio", "name" => "revert", "id" => "$current_id", "value" => "$current_id", "checked" => $selected]), + A(["href" => make_link("post/view/$image_id")], $image_id), ": ", LABEL( - ["for"=>"$current_id"], + ["for" => "$current_id"], $current_source, " - ", $setter, diff --git a/ext/statsd/main.php b/ext/statsd/main.php index b853f7b50..4066d8637 100644 --- a/ext/statsd/main.php +++ b/ext/statsd/main.php @@ -74,7 +74,7 @@ public function get_priority(): int return 99; } - private function send(array $data, float $sampleRate=1) + private function send(array $data, float $sampleRate = 1) { if (!STATSD_HOST) { return; @@ -103,7 +103,7 @@ private function send(array $data, float $sampleRate=1) $host = $parts[0]; $port = (int)$parts[1]; $fp = fsockopen("udp://$host", $port, $errno, $errstr); - if (! $fp) { + if (!$fp) { return; } foreach ($sampledData as $stat => $value) { diff --git a/ext/system/info.php b/ext/system/info.php index 47eded77d..55383480c 100644 --- a/ext/system/info.php +++ b/ext/system/info.php @@ -10,7 +10,7 @@ class SystemInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "System"; - public array $authors = ["Matthew Barbour"=>"matthew@darkholme.net"]; + public array $authors = ["Matthew Barbour" => "matthew@darkholme.net"]; public string $license = self::LICENSE_WTFPL; public string $description = "Provides system screen"; public bool $core = true; diff --git a/ext/tag_categories/info.php b/ext/tag_categories/info.php index 221148b0d..e76398533 100644 --- a/ext/tag_categories/info.php +++ b/ext/tag_categories/info.php @@ -11,6 +11,6 @@ class TagCategoriesInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Tag Categories"; public string $url = "https://code.shishnet.org/shimmie2/"; - public array $authors = ["Daniel Oaks"=>"danneh@danneh.net"]; + public array $authors = ["Daniel Oaks" => "danneh@danneh.net"]; public string $description = "Let tags be split into 'categories', like Danbooru's tagging"; } diff --git a/ext/tag_categories/main.php b/ext/tag_categories/main.php index 0a31a7a82..118105ec0 100644 --- a/ext/tag_categories/main.php +++ b/ext/tag_categories/main.php @@ -45,22 +45,22 @@ public function onDatabaseUpgrade(DatabaseUpgradeEvent $event) if ($number_of_db_rows == 0) { $database->execute( 'INSERT INTO image_tag_categories VALUES (:category, :single, :multiple, :color)', - ["category"=>"artist", "single"=>"Artist", "multiple"=>"Artists", "color"=>"#BB6666"] + ["category" => "artist", "single" => "Artist", "multiple" => "Artists", "color" => "#BB6666"] ); $database->execute( 'INSERT INTO image_tag_categories VALUES (:category, :single, :multiple, :color)', - ["category"=>"series", "single"=>"Series", "multiple"=>"Series", "color"=>"#AA00AA"] + ["category" => "series", "single" => "Series", "multiple" => "Series", "color" => "#AA00AA"] ); $database->execute( 'INSERT INTO image_tag_categories VALUES (:category, :single, :multiple, :color)', - ["category"=>"character", "single"=>"Character", "multiple"=>"Characters", "color"=>"#66BB66"] + ["category" => "character", "single" => "Character", "multiple" => "Characters", "color" => "#66BB66"] ); } } public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { - if ($event->parent=="tags") { + if ($event->parent == "tags") { $event->add_nav_link("tag_categories", new Link('tags/categories'), "Tag Categories", NavLink::is_active(["tag_categories"])); } } @@ -108,7 +108,7 @@ public function onSearchTermParse(SearchTermParseEvent $event) public function onHelpPageBuilding(HelpPageBuildingEvent $event) { - if ($event->key===HelpPages::SEARCH) { + if ($event->key === HelpPages::SEARCH) { $block = new Block(); $block->header = "Tag Categories"; $block->body = $this->theme->get_help_html(); diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php index 0fe2905ea..47b0f13cc 100644 --- a/ext/tag_edit/main.php +++ b/ext/tag_edit/main.php @@ -29,7 +29,7 @@ class SourceSetEvent extends Event public Image $image; public ?string $source; - public function __construct(Image $image, string $source=null) + public function __construct(Image $image, string $source = null) { parent::__construct(); $this->image = $image; @@ -194,7 +194,7 @@ public function onImageInfoSet(ImageInfoSetEvent $event) } } if ($user->can(Permissions::EDIT_IMAGE_LOCK)) { - $locked = isset($_POST['tag_edit__locked']) && $_POST['tag_edit__locked']=="on"; + $locked = isset($_POST['tag_edit__locked']) && $_POST['tag_edit__locked'] == "on"; send_event(new LockSetEvent($event->image, $locked)); } } @@ -246,7 +246,7 @@ public function onAdminBuilding(AdminBuildingEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { - if ($event->parent=="tags") { + if ($event->parent == "tags") { $event->add_nav_link("tags_help", new Link('ext_doc/tag_edit'), "Help"); } } diff --git a/ext/tag_edit/theme.php b/ext/tag_edit/theme.php index a27885001..66f4c8a24 100644 --- a/ext/tag_edit/theme.php +++ b/ext/tag_edit/theme.php @@ -63,7 +63,7 @@ public function get_tag_editor_html(Image $image): HTMLElement "type" => "text", "name" => "tag_edit__tags", "value" => $image->get_tag_list(), - "id"=>"tag_editor", + "id" => "tag_editor", "autocomplete" => "off" ]) ); @@ -117,7 +117,7 @@ protected function format_source(string $source = null): HTMLElement if (str_ends_with($h_source, "/")) { $h_source = substr($h_source, 0, -1); } - return A(["href"=>$source], $h_source); + return A(["href" => $source], $h_source); } return rawHTML("Unknown"); } diff --git a/ext/tag_editcloud/info.php b/ext/tag_editcloud/info.php index 315c1bc49..eeb866abc 100644 --- a/ext/tag_editcloud/info.php +++ b/ext/tag_editcloud/info.php @@ -10,6 +10,6 @@ class TagEditCloudInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Tag EditCloud"; - public array $authors = ["AtomicDryad", "Luana Latte"=>"luana.latte.cat@gmail.com"]; + public array $authors = ["AtomicDryad", "Luana Latte" => "luana.latte.cat@gmail.com"]; public string $description = "Add or remove tags to the editor via clicking."; } diff --git a/ext/tag_editcloud/main.php b/ext/tag_editcloud/main.php index 7d45a4a18..1158d8a4b 100644 --- a/ext/tag_editcloud/main.php +++ b/ext/tag_editcloud/main.php @@ -40,7 +40,7 @@ public function onInitExt(InitExtEvent $event) public function onSetupBuilding(SetupBuildingEvent $event) { - $sort_by = ['Alphabetical'=>'a','Popularity'=>'p','Relevance'=>'r','Categories'=>'c']; + $sort_by = ['Alphabetical' => 'a','Popularity' => 'p','Relevance' => 'r','Categories' => 'c']; $sb = $event->panel->create_new_block("Tag Edit Cloud"); $sb->add_bool_option("tageditcloud_disable", "Disable Tag Selection Cloud: "); @@ -99,7 +99,7 @@ private function build_tag_map(Image $image): ?HTMLElement GROUP BY t2.tag ORDER BY count DESC LIMIT :limit", - ["tag_min1" => $tags_min, "tag_min2" => $tags_min, "limit" => $max_count, "relevant_tags"=>$relevant_tags] + ["tag_min1" => $tags_min, "tag_min2" => $tags_min, "limit" => $max_count, "relevant_tags" => $relevant_tags] ); break; /** @noinspection PhpMissingBreakStatementInspection */ diff --git a/ext/tag_history/info.php b/ext/tag_history/info.php index 6cd8a6c12..ec87ddaf8 100644 --- a/ext/tag_history/info.php +++ b/ext/tag_history/info.php @@ -10,6 +10,6 @@ class TagHistoryInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Tag History"; - public array $authors = ["Bzchan"=>"bzchan@animemahou.com","jgen"=>"jgen.tech@gmail.com"]; + public array $authors = ["Bzchan" => "bzchan@animemahou.com","jgen" => "jgen.tech@gmail.com"]; public string $description = "Keep a record of tag changes, and allows you to revert changes."; } diff --git a/ext/tag_history/main.php b/ext/tag_history/main.php index 1384f3dbb..a748a5520 100644 --- a/ext/tag_history/main.php +++ b/ext/tag_history/main.php @@ -86,7 +86,7 @@ public function onTagSet(TagSetEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { global $user; - if ($event->parent==="system") { + if ($event->parent === "system") { if ($user->can(Permissions::BULK_EDIT_IMAGE_TAG)) { $event->add_nav_link("tag_history", new Link('tag_history/all/1'), "Tag Changes", NavLink::is_active(["tag_history"])); } @@ -163,7 +163,7 @@ private function process_revert_request(int $revert_id) $stored_tags = $result['tags']; $image = Image::by_id($stored_image_id); - if (! $image instanceof Image) { + if (!$image instanceof Image) { throw new ImageDoesNotExist("Error: cannot find any image with the ID = ". $stored_image_id); } @@ -222,7 +222,7 @@ public function get_tag_history_from_revert(int $revert_id): ?array SELECT tag_histories.*, users.name FROM tag_histories JOIN users ON tag_histories.user_id = users.id - WHERE tag_histories.id = :id", ["id"=>$revert_id]); + WHERE tag_histories.id = :id", ["id" => $revert_id]); return ($row ? $row : null); } @@ -236,7 +236,7 @@ public function get_tag_history_from_id(int $image_id): array JOIN users ON tag_histories.user_id = users.id WHERE image_id = :id ORDER BY tag_histories.id DESC", - ["id"=>$image_id] + ["id" => $image_id] ); } @@ -249,7 +249,7 @@ public function get_global_tag_history(int $page_id): array JOIN users ON tag_histories.user_id = users.id ORDER BY tag_histories.id DESC LIMIT 100 OFFSET :offset - ", ["offset" => ($page_id-1)*100]); + ", ["offset" => ($page_id - 1) * 100]); } /** @@ -328,7 +328,7 @@ public function process_revert_all_changes(?string $name, ?string $ip, ?string $ $stored_tags = $result['tags']; $image = Image::by_id($stored_image_id); - if (! $image instanceof Image) { + if (!$image instanceof Image) { continue; //throw new ImageDoesNotExist("Error: cannot find any image with the ID = ". $stored_image_id); } @@ -372,13 +372,13 @@ private function add_tag_history(Image $image, array $tags) } // if the image has no history, make one with the old tags - $entries = $database->get_one("SELECT COUNT(*) FROM tag_histories WHERE image_id = :id", ["id"=>$image->id]); + $entries = $database->get_one("SELECT COUNT(*) FROM tag_histories WHERE image_id = :id", ["id" => $image->id]); if ($entries == 0 && !empty($old_tags)) { $database->execute( " INSERT INTO tag_histories(image_id, tags, user_id, user_ip, date_set) VALUES (:image_id, :tags, :user_id, :user_ip, now())", - ["image_id"=>$image->id, "tags"=>$old_tags, "user_id"=>$config->get_int('anon_id'), "user_ip"=>'127.0.0.1'] + ["image_id" => $image->id, "tags" => $old_tags, "user_id" => $config->get_int('anon_id'), "user_ip" => '127.0.0.1'] ); $entries++; } @@ -388,7 +388,7 @@ private function add_tag_history(Image $image, array $tags) " INSERT INTO tag_histories(image_id, tags, user_id, user_ip, date_set) VALUES (:image_id, :tags, :user_id, :user_ip, now())", - ["image_id"=>$image->id, "tags"=>$new_tags, "user_id"=>$user->id, "user_ip"=>get_real_ip()] + ["image_id" => $image->id, "tags" => $new_tags, "user_id" => $user->id, "user_ip" => get_real_ip()] ); $entries++; @@ -405,8 +405,8 @@ private function add_tag_history(Image $image, array $tags) https://dev.mysql.com/doc/refman/5.1/en/subquery-restrictions.html https://stackoverflow.com/questions/45494/mysql-error-1093-cant-specify-target-table-for-update-in-from-clause */ - $min_id = $database->get_one("SELECT MIN(id) FROM tag_histories WHERE image_id = :image_id", ["image_id"=>$image->id]); - $database->execute("DELETE FROM tag_histories WHERE id = :id", ["id"=>$min_id]); + $min_id = $database->get_one("SELECT MIN(id) FROM tag_histories WHERE image_id = :image_id", ["image_id" => $image->id]); + $database->execute("DELETE FROM tag_histories WHERE id = :id", ["id" => $min_id]); } } } diff --git a/ext/tag_history/theme.php b/ext/tag_history/theme.php index 5beb37808..95ead7dae 100644 --- a/ext/tag_history/theme.php +++ b/ext/tag_history/theme.php @@ -34,9 +34,9 @@ public function display_global_page(Page $page, array $history, int $page_number $page->add_block(new Block("Tag History", $history_html, "main", 10)); $h_prev = ($page_number <= 1) ? "Prev" : - 'Prev'; + 'Prev'; $h_index = "Index"; - $h_next = 'Next'; + $h_next = 'Next'; $nav = $h_prev.' | '.$h_index.' | '.$h_next; $page->add_block(new Block("Navigation", $nav, "left", 0)); @@ -45,7 +45,7 @@ public function display_global_page(Page $page, array $history, int $page_number /** * Add a section to the admin page. */ - public function display_admin_block(string $validation_msg='') + public function display_admin_block(string $validation_msg = '') { global $page; @@ -114,21 +114,21 @@ protected function history_entry(array $fields, bool $selected): string $ip = $user->can(Permissions::VIEW_IP) ? rawHTML(" " . show_ip($fields['user_ip'], "Tagging >>$image_id as '$current_tags'")) : null; - $setter = A(["href"=>make_link("user/" . url_escape($name))], $name); + $setter = A(["href" => make_link("user/" . url_escape($name))], $name); $current_tags = Tag::explode($current_tags); $taglinks = SPAN(); foreach ($current_tags as $tag) { - $taglinks->appendChild(A(["href"=>search_link([$tag])], $tag)); + $taglinks->appendChild(A(["href" => search_link([$tag])], $tag)); $taglinks->appendChild(" "); } return (string)LI( - INPUT(["type"=>"radio", "name"=>"revert", "id"=>"$current_id", "value"=>"$current_id", "checked"=>$selected]), - A(["href"=>make_link("post/view/$image_id")], $image_id), + INPUT(["type" => "radio", "name" => "revert", "id" => "$current_id", "value" => "$current_id", "checked" => $selected]), + A(["href" => make_link("post/view/$image_id")], $image_id), ": ", LABEL( - ["for"=>"$current_id"], + ["for" => "$current_id"], $taglinks, " - ", $setter, diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 14dc67d4f..3d13c7ae9 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -76,7 +76,7 @@ public function onPageNavBuilding(PageNavBuildingEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { - if ($event->parent=="tags") { + if ($event->parent == "tags") { $event->add_nav_link("tags_map", new Link('tags/map'), "Map"); $event->add_nav_link("tags_alphabetic", new Link('tags/alphabetic'), "Alphabetic"); $event->add_nav_link("tags_popularity", new Link('tags/popularity'), "Popularity"); @@ -214,11 +214,11 @@ private function build_az(): string FROM tags WHERE count >= :tags_min ORDER BY LOWER(substr(tag, 1, 1)) - ", ["tags_min"=>$tags_min]); + ", ["tags_min" => $tags_min]); $html = ""; foreach ($tag_data as $a) { - $html .= " $a"; + $html .= " $a"; } $html .= "\n


"; @@ -231,7 +231,7 @@ private function build_navigation(): string $h_map = "Map"; $h_alphabetic = "Alphabetic"; $h_popularity = "Popularity"; - $h_all = "Show All"; + $h_all = "Show All"; return "$h_index
 
$h_map
$h_alphabetic
$h_popularity
 
$h_all"; } @@ -260,7 +260,7 @@ private function build_tag_map(): string WHERE count >= :tags_min AND LOWER(tag) LIKE LOWER(:starts_with) ORDER BY LOWER(tag) - ", ["tags_min"=>$tags_min, "tags_min2"=>$tags_min, "starts_with"=>$starts_with]); + ", ["tags_min" => $tags_min, "tags_min2" => $tags_min, "starts_with" => $starts_with]); $html = ""; if ($config->get_bool(TagListConfig::PAGES)) { @@ -275,7 +275,7 @@ private function build_tag_map(): string $h_tag = html_escape($row['tag']); $size = sprintf("%.2f", (float)$row['scaled']); $link = $this->theme->tag_link($row['tag']); - if ($size<0.5) { + if ($size < 0.5) { $size = 0.5; } $h_tag_no_underscores = str_replace("_", " ", $h_tag); @@ -314,7 +314,7 @@ private function build_tag_alphabetic(): string WHERE count >= :tags_min AND LOWER(tag) LIKE LOWER(:starts_with) ORDER BY LOWER(tag) - ", ["tags_min"=>$tags_min, "starts_with"=>$starts_with]); + ", ["tags_min" => $tags_min, "starts_with" => $starts_with]); $html = ""; if ($config->get_bool(TagListConfig::PAGES)) { @@ -349,8 +349,8 @@ private function build_tag_alphabetic(): string foreach ($tag_data as $tag => $count) { // In PHP, $array["10"] sets the array key as int(10), not string("10")... $tag = (string)$tag; - if ($lastLetter != mb_strtolower(substr($tag, 0, strlen($starts_with)+1))) { - $lastLetter = mb_strtolower(substr($tag, 0, strlen($starts_with)+1)); + if ($lastLetter != mb_strtolower(substr($tag, 0, strlen($starts_with) + 1))) { + $lastLetter = mb_strtolower(substr($tag, 0, strlen($starts_with) + 1)); $h_lastLetter = html_escape($lastLetter); $html .= "

$h_lastLetter
"; } @@ -395,7 +395,7 @@ private function build_tag_popularity(): string FROM tags WHERE count >= :tags_min ORDER BY count DESC, tag ASC - ", ["tags_min"=>$tags_min]); + ", ["tags_min" => $tags_min]); $html = "Results grouped by log10(n)"; $lastLog = ""; @@ -464,7 +464,7 @@ private function add_split_tags_block(Page $page, Image $image) AND image_tags.image_id = :image_id ORDER BY tags.count DESC "; - $args = ["image_id"=>$image->id]; + $args = ["image_id" => $image->id]; $tags = $database->get_all($query, $args); if (count($tags) > 0) { @@ -483,7 +483,7 @@ private function add_tags_block(Page $page, Image $image) AND image_tags.image_id = :image_id ORDER BY tags.count DESC "; - $args = ["image_id"=>$image->id]; + $args = ["image_id" => $image->id]; $tags = $database->get_all($query, $args); if (count($tags) > 0) { @@ -518,7 +518,7 @@ private function add_popular_block(Page $page) "; } - $args = ["popular_tag_list_length"=>$config->get_int(TagListConfig::POPULAR_TAG_LIST_LENGTH)]; + $args = ["popular_tag_list_length" => $config->get_int(TagListConfig::POPULAR_TAG_LIST_LENGTH)]; $tags = $database->get_all($query, $args); diff --git a/ext/tag_list/test.php b/ext/tag_list/test.php index f054a72eb..1f04f98a9 100644 --- a/ext/tag_list/test.php +++ b/ext/tag_list/test.php @@ -28,16 +28,16 @@ public function testTagList() public function testMinCount() { foreach ($this->pages as $page) { - $this->get_page("tags/$page", ["mincount"=>999999]); + $this->get_page("tags/$page", ["mincount" => 999999]); $this->assert_title("Tag List"); - $this->get_page("tags/$page", ["mincount"=>1]); + $this->get_page("tags/$page", ["mincount" => 1]); $this->assert_title("Tag List"); - $this->get_page("tags/$page", ["mincount"=>0]); + $this->get_page("tags/$page", ["mincount" => 0]); $this->assert_title("Tag List"); - $this->get_page("tags/$page", ["mincount"=>-1]); + $this->get_page("tags/$page", ["mincount" => -1]); $this->assert_title("Tag List"); } } diff --git a/ext/tag_tools/test.php b/ext/tag_tools/test.php index e99acbf41..8d7cc5057 100644 --- a/ext/tag_tools/test.php +++ b/ext/tag_tools/test.php @@ -43,7 +43,7 @@ public function testRecount() send_event(new UserLoginEvent(User::by_name(self::$admin_name))); $database->execute( "INSERT INTO tags(tag, count) VALUES(:tag, :count)", - ["tag"=>"tes$ts", "count"=>42] + ["tag" => "tes$ts", "count" => 42] ); // Fix @@ -54,7 +54,7 @@ public function testRecount() 0, $database->get_one( "SELECT count FROM tags WHERE tag = :tag", - ["tag"=>"tes$ts"] + ["tag" => "tes$ts"] ) ); } diff --git a/ext/tag_tools/theme.php b/ext/tag_tools/theme.php index 2f52c6b45..7cf2ea727 100644 --- a/ext/tag_tools/theme.php +++ b/ext/tag_tools/theme.php @@ -8,7 +8,7 @@ class TagToolsTheme extends Themelet { - protected function button(string $name, string $action, bool $protected=false): string + protected function button(string $name, string $action, bool $protected = false): string { $c_protected = $protected ? " protected" : ""; $html = make_form(make_link("admin/$action"), "POST", false, "admin$c_protected"); @@ -39,7 +39,7 @@ public function display_form() $html = (string)SHM_SIMPLE_FORM( "admin/set_tag_case", - INPUT(["type"=>'text', "name"=>'tag', "placeholder"=>'Enter tag with correct case', "autocomplete"=>'off']), + INPUT(["type" => 'text', "name" => 'tag', "placeholder" => 'Enter tag with correct case', "autocomplete" => 'off']), SHM_SUBMIT('Set Tag Case'), ); $page->add_block(new Block("Set Tag Case", $html)); diff --git a/ext/tagger_xml/info.php b/ext/tagger_xml/info.php index c7754babb..3de7720d0 100644 --- a/ext/tagger_xml/info.php +++ b/ext/tagger_xml/info.php @@ -10,7 +10,7 @@ class TaggerXMLInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Tagger AJAX backend"; - public array $authors = ["Artanis (Erik Youngren)"=>"artanis.00@gmail.com"]; + public array $authors = ["Artanis (Erik Youngren)" => "artanis.00@gmail.com"]; public ExtensionVisibility $visibility = ExtensionVisibility::HIDDEN; public string $description = "Advanced Tagging v2 AJAX backend"; } diff --git a/ext/tagger_xml/main.php b/ext/tagger_xml/main.php index e945e2eb2..6e577d553 100644 --- a/ext/tagger_xml/main.php +++ b/ext/tagger_xml/main.php @@ -19,7 +19,7 @@ public function onPageRequest(PageRequestEvent $event) //$match_tags = null; //$image_tags = null; - $tags=null; + $tags = null; if (isset($_GET['s'])) { // tagger/tags[/...]?s=$string // return matching tags in XML form $tags = $this->match_tag_list($_GET['s']); @@ -58,7 +58,7 @@ private function match_tag_list(string $s): string // $exclude = $event->get_arg(1)? "AND NOT IN ".$this->image_tags($event->get_arg(1)) : null; // Hidden Tags - $hidden = $config->get_string('ext-tagger_show-hidden', 'N')=='N' ? + $hidden = $config->get_string('ext-tagger_show-hidden', 'N') == 'N' ? "AND substring(tag,1,1) != '.'" : null; $q_where = "WHERE {$match} {$hidden} AND count > 0"; @@ -69,7 +69,7 @@ private function match_tag_list(string $s): string $q_from = "FROM (SELECT * FROM `tags` {$q_where} ". "ORDER BY count DESC LIMIT {$limit_rows} OFFSET 0) AS `c_tags`"; $q_where = null; - $count = ["max"=>$count]; + $count = ["max" => $count]; } else { $q_from = "FROM `tags`"; $count = []; @@ -93,17 +93,17 @@ private function image_tag_list(int $image_id): string $tags = $database->execute(" SELECT tags.* FROM image_tags JOIN tags ON image_tags.tag_id = tags.id - WHERE image_id=:image_id ORDER BY tag", ['image_id'=>$image_id]); + WHERE image_id=:image_id ORDER BY tag", ['image_id' => $image_id]); return $this->list_to_xml($tags, "image", (string)$image_id); } - private function list_to_xml(\FFSPHP\PDOStatement $tags, string $type, string $query, ?array $misc=[]): string + private function list_to_xml(\FFSPHP\PDOStatement $tags, string $type, string $query, ?array $misc = []): string { $props = [ - "id"=>$type, - "query"=>$query, + "id" => $type, + "query" => $query, // @phpstan-ignore-next-line - "rows"=>$tags->_numOfRows + "rows" => $tags->_numOfRows ]; if (!is_null($misc)) { foreach ($misc as $attr => $val) { @@ -113,7 +113,7 @@ private function list_to_xml(\FFSPHP\PDOStatement $tags, string $type, string $q $list = new \MicroHTML\HTMLElement("list", [$props]); foreach ($tags as $tag) { - $list->appendChild(new \MicroHTML\HTMLElement("tag", [["id"=>$tag["id"], "count"=>$tag["count"]], $tag["tag"]])); + $list->appendChild(new \MicroHTML\HTMLElement("tag", [["id" => $tag["id"], "count" => $tag["count"]], $tag["tag"]])); } return (string)($list); diff --git a/ext/tips/info.php b/ext/tips/info.php index d8dd65cd3..01fd91aa0 100644 --- a/ext/tips/info.php +++ b/ext/tips/info.php @@ -10,7 +10,7 @@ class TipsInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Random Tip"; - public array $authors = ["Sein Kraft"=>"mail@seinkraft.info"]; + public array $authors = ["Sein Kraft" => "mail@seinkraft.info"]; public string $license = "GPLv2"; public string $description = "Show a random line of text in the subheader space"; public ?string $documentation = "Formatting is done with HTML"; diff --git a/ext/tips/main.php b/ext/tips/main.php index 172184a64..14281ec05 100644 --- a/ext/tips/main.php +++ b/ext/tips/main.php @@ -50,7 +50,7 @@ public function onDatabaseUpgrade(DatabaseUpgradeEvent $event) " INSERT INTO tips (enable, image, text) VALUES (:enable, :image, :text)", - ["enable"=>true, "image"=>"coins.png", "text"=>"Do you like this extension? Please support us for developing new ones. Donate through paypal."] + ["enable" => true, "image" => "coins.png", "text" => "Do you like this extension? Please support us for developing new ones. Donate through paypal."] ); $this->set_version("ext_tips_version", 2); @@ -101,7 +101,7 @@ public function onPageRequest(PageRequestEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { global $user; - if ($event->parent==="system") { + if ($event->parent === "system") { if ($user->can(Permissions::TIPS_ADMIN)) { $event->add_nav_link("tips", new Link('tips/list'), "Tips Editor"); } @@ -141,7 +141,7 @@ public function onCreateTip(CreateTipEvent $event) " INSERT INTO tips (enable, image, text) VALUES (:enable, :image, :text)", - ["enable"=>$event->enable, "image"=>$event->image, "text"=>$event->text] + ["enable" => $event->enable, "image" => $event->image, "text" => $event->text] ); } @@ -158,7 +158,7 @@ private function getTip() WHERE enable = :true ORDER BY RAND() LIMIT 1 - ", ["true"=>true]); + ", ["true" => true]); if ($tip) { $this->theme->showTip($url, $tip); @@ -181,16 +181,16 @@ private function setStatus(int $tipID) { global $database; - $tip = $database->get_row("SELECT * FROM tips WHERE id = :id ", ["id"=>$tipID]); + $tip = $database->get_row("SELECT * FROM tips WHERE id = :id ", ["id" => $tipID]); $enable = bool_escape($tip['enable']); - $database->execute("UPDATE tips SET enable = :enable WHERE id = :id", ["enable"=>$enable, "id"=>$tipID]); + $database->execute("UPDATE tips SET enable = :enable WHERE id = :id", ["enable" => $enable, "id" => $tipID]); } public function onDeleteTip(DeleteTipEvent $event) { global $database; - $database->execute("DELETE FROM tips WHERE id = :id", ["id"=>$event->tip_id]); + $database->execute("DELETE FROM tips WHERE id = :id", ["id" => $event->tip_id]); } } diff --git a/ext/transcode/info.php b/ext/transcode/info.php index f79529e27..7ec5c88f9 100644 --- a/ext/transcode/info.php +++ b/ext/transcode/info.php @@ -10,7 +10,7 @@ class TranscodeImageInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Transcode Image"; - public array $authors = ["Matthew Barbour"=>"matthew@darkholme.net"]; + public array $authors = ["Matthew Barbour" => "matthew@darkholme.net"]; public string $license = self::LICENSE_WTFPL; public string $description = "Allows admins to automatically and manually transcode images."; public ?string $documentation = diff --git a/ext/transcode/main.php b/ext/transcode/main.php index 29ee67850..304ede255 100644 --- a/ext/transcode/main.php +++ b/ext/transcode/main.php @@ -98,7 +98,7 @@ public static function get_enabled_mimes(): array public function onDatabaseUpgrade(DatabaseUpgradeEvent $event) { if ($this->get_version(TranscodeConfig::VERSION) < 1) { - $old_extensions =[]; + $old_extensions = []; foreach (array_values(self::INPUT_MIMES) as $mime) { $old_extensions = array_merge($old_extensions, FileExtension::get_all_for_mime($mime)); } @@ -152,7 +152,7 @@ public function onSetupBuilding(SetupBuildingEvent $event) $sb->add_bool_option(TranscodeConfig::GET_ENABLED, "Enable GET args", true); $sb->add_bool_option(TranscodeConfig::UPLOAD, "Transcode on upload", true); $sb->add_choice_option(TranscodeConfig::ENGINE, MediaEngine::IMAGE_ENGINES, "Engine", true); - foreach (self::INPUT_MIMES as $display=> $mime) { + foreach (self::INPUT_MIMES as $display => $mime) { if (MediaEngine::is_input_supported($engine, $mime)) { $outputs = $this->get_supported_output_mimes($engine, $mime); $sb->add_choice_option(self::get_mapping_name($mime), $outputs, "$display", true); @@ -180,7 +180,7 @@ public function onDataUpload(DataUploadEvent $event) } if ($config->get_bool(TranscodeConfig::UPLOAD) == true) { - if ($event->mime === MimeType::GIF&&MimeType::is_animated_gif($event->tmpname)) { + if ($event->mime === MimeType::GIF && MimeType::is_animated_gif($event->tmpname)) { return; } @@ -253,10 +253,10 @@ public function onImageDownloading(ImageDownloadingEvent $event) $source_mime = $event->image->get_mime(); - if ($source_mime!=$target_mime) { + if ($source_mime != $target_mime) { $tmp_filename = $this->transcode_image($event->path, $source_mime, $target_mime); - if ($event->file_modified===true&&$event->path!=$event->image->get_image_filename()) { + if ($event->file_modified === true && $event->path != $event->image->get_image_filename()) { // This means that we're dealing with a temp file that will need cleaned up unlink($event->path); } @@ -314,10 +314,10 @@ public function onBulkAction(BulkActionEvent $event) } } } - if ($size_difference>0) { + if ($size_difference > 0) { $page->flash("Transcoded $total items, reduced size by ".human_filesize($size_difference)); - } elseif ($size_difference<0) { - $page->flash("Transcoded $total items, increased size by ".human_filesize(-1*$size_difference)); + } elseif ($size_difference < 0) { + $page->flash("Transcoded $total items, increased size by ".human_filesize(-1 * $size_difference)); } else { $page->flash("Transcoded $total items, no size difference"); } @@ -338,13 +338,13 @@ private function get_supported_output_mimes($engine, ?string $omit_mime = null): $output = []; - foreach (self::OUTPUT_MIMES as $key=> $value) { - if ($value=="") { + foreach (self::OUTPUT_MIMES as $key => $value) { + if ($value == "") { $output[$key] = $value; continue; } if (MediaEngine::is_output_supported($engine, $value) - &&(empty($omit_mime)||$omit_mime!=$value)) { + && (empty($omit_mime) || $omit_mime != $value)) { $output[$key] = $value; } } @@ -385,7 +385,7 @@ private function transcode_image(string $source_name, string $source_mime, strin { global $config; - if ($source_mime==$target_mime) { + if ($source_mime == $target_mime) { throw new ImageTranscodeException("Source and target MIMEs are the same: ".$source_mime); } @@ -433,18 +433,18 @@ private function transcode_image_gd(string $source_name, string $source_mime, st $width = imagesx($image); $height = imagesy($image); $new_image = imagecreatetruecolor($width, $height); - if ($new_image===false) { + if ($new_image === false) { throw new ImageTranscodeException("Could not create image with dimensions $width x $height"); } try { $background_color = Media::hex_color_allocate($new_image, $config->get_string(TranscodeConfig::ALPHA_COLOR)); - if ($background_color===false) { + if ($background_color === false) { throw new ImageTranscodeException("Could not allocate background color"); } - if (imagefilledrectangle($new_image, 0, 0, $width, $height, $background_color)===false) { + if (imagefilledrectangle($new_image, 0, 0, $width, $height, $background_color) === false) { throw new ImageTranscodeException("Could not fill background color"); } - if (imagecopy($new_image, $image, 0, 0, 0, 0, $width, $height)===false) { + if (imagecopy($new_image, $image, 0, 0, 0, 0, $width, $height) === false) { throw new ImageTranscodeException("Could not copy source image to new image"); } $result = imagejpeg($new_image, $tmp_name, $q); @@ -456,7 +456,7 @@ private function transcode_image_gd(string $source_name, string $source_mime, st } finally { imagedestroy($image); } - if ($result===false) { + if ($result === false) { throw new ImageTranscodeException("Error while transcoding ".$source_name." to ".$target_mime); } return $tmp_name; @@ -507,7 +507,7 @@ private function transcode_image_convert(string $source_name, string $source_mim log_debug('transcode', "Transcoding with command `$cmd`, returns $ret"); - if ($ret!==0) { + if ($ret !== 0) { throw new ImageTranscodeException("Transcoding failed with command ".$cmd.", returning ".implode("\r\n", $output)); } diff --git a/ext/transcode/theme.php b/ext/transcode/theme.php index 55c1f61a0..171df779d 100644 --- a/ext/transcode/theme.php +++ b/ext/transcode/theme.php @@ -32,7 +32,7 @@ public function get_transcode_html(Image $image, array $options): string public function get_transcode_picker_html(array $options): string { $html = ""; - foreach ($options as $display=>$value) { + foreach ($options as $display => $value) { $html .= ""; } diff --git a/ext/trash/info.php b/ext/trash/info.php index 13b643d63..d0d9a2bbe 100644 --- a/ext/trash/info.php +++ b/ext/trash/info.php @@ -10,7 +10,7 @@ class TrashInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Trash"; - public array $authors = ["Matthew Barbour"=>"matthew@darkholme.net"]; + public array $authors = ["Matthew Barbour" => "matthew@darkholme.net"]; public string $license = self::LICENSE_WTFPL; public string $description = "Provides \"Trash\" or \"Recycle Bin\"-type functionality, storing deleted images for later recovery"; } diff --git a/ext/trash/main.php b/ext/trash/main.php index 5fc70a50f..f71fff19b 100644 --- a/ext/trash/main.php +++ b/ext/trash/main.php @@ -49,7 +49,7 @@ private function check_permissions(Image $image): bool { global $user; - if ($image->trash===true && !$user->can(Permissions::VIEW_TRASH)) { + if ($image->trash === true && !$user->can(Permissions::VIEW_TRASH)) { return false; } return true; @@ -77,7 +77,7 @@ public function onDisplayingImage(DisplayingImageEvent $event) public function onImageDeletion(ImageDeletionEvent $event) { - if ($event->force!==true && $event->image->trash!==true) { + if ($event->force !== true && $event->image->trash !== true) { self::set_trash($event->image->id, true); $event->stop_processing = true; } @@ -86,7 +86,7 @@ public function onImageDeletion(ImageDeletionEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { global $user; - if ($event->parent=="posts") { + if ($event->parent == "posts") { if ($user->can(Permissions::VIEW_TRASH)) { $event->add_nav_link("posts_trash", new Link('/post/list/in%3Atrash/1'), "Trash", null, 60); } @@ -109,7 +109,7 @@ public function onSearchTermParse(SearchTermParseEvent $event) $matches = []; if (is_null($event->term) && $this->no_trash_query($event->context)) { - $event->add_querylet(new Querylet("trash != :true", ["true"=>true])); + $event->add_querylet(new Querylet("trash != :true", ["true" => true])); } if (is_null($event->term)) { @@ -117,7 +117,7 @@ public function onSearchTermParse(SearchTermParseEvent $event) } if (preg_match(self::SEARCH_REGEXP, strtolower($event->term), $matches)) { if ($user->can(Permissions::VIEW_TRASH)) { - $event->add_querylet(new Querylet("trash = :true", ["true"=>true])); + $event->add_querylet(new Querylet("trash = :true", ["true" => true])); } } } @@ -125,7 +125,7 @@ public function onSearchTermParse(SearchTermParseEvent $event) public function onHelpPageBuilding(HelpPageBuildingEvent $event) { global $user; - if ($event->key===HelpPages::SEARCH) { + if ($event->key === HelpPages::SEARCH) { if ($user->can(Permissions::VIEW_TRASH)) { $block = new Block(); $block->header = "Trash"; @@ -151,13 +151,13 @@ public static function set_trash(int $image_id, bool $trash) $database->execute( "UPDATE images SET trash = :trash WHERE id = :id", - ["trash"=>$trash,"id"=>$image_id] + ["trash" => $trash,"id" => $image_id] ); } public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) { global $user; - if ($event->image->trash===true && $user->can(Permissions::VIEW_TRASH)) { + if ($event->image->trash === true && $user->can(Permissions::VIEW_TRASH)) { $event->add_part($this->theme->get_image_admin_html($event->image->id)); } } @@ -166,7 +166,7 @@ public function onBulkActionBlockBuilding(BulkActionBlockBuildingEvent $event) { global $user; - if ($user->can(Permissions::VIEW_TRASH)&&in_array("in:trash", $event->search_terms)) { + if ($user->can(Permissions::VIEW_TRASH) && in_array("in:trash", $event->search_terms)) { $event->add_action("bulk_trash_restore", "(U)ndelete", "u"); } } diff --git a/ext/trash/theme.php b/ext/trash/theme.php index 9a5553a87..9c65c1385 100644 --- a/ext/trash/theme.php +++ b/ext/trash/theme.php @@ -12,8 +12,8 @@ public function get_image_admin_html(int $image_id): string { return (string)SHM_SIMPLE_FORM( 'trash_restore/'.$image_id, - INPUT(["type"=>'hidden', "name"=>'image_id', "value"=>$image_id]), - INPUT(["type"=>'submit', "value"=>'Restore From Trash']), + INPUT(["type" => 'hidden', "name" => 'image_id', "value" => $image_id]), + INPUT(["type" => 'submit', "value" => 'Restore From Trash']), ); } diff --git a/ext/update/info.php b/ext/update/info.php index 7941141ca..a7e8ae8fa 100644 --- a/ext/update/info.php +++ b/ext/update/info.php @@ -11,7 +11,7 @@ class UpdateInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Update"; public string $url = "http://www.codeanimu.net"; - public array $authors = ["DakuTree"=>"dakutree@codeanimu.net"]; + public array $authors = ["DakuTree" => "dakutree@codeanimu.net"]; public string $license = self::LICENSE_GPLV2; public string $description = "Shimmie updater! (Requires admin panel extension & transload engine (cURL/fopen/Wget))"; } diff --git a/ext/upgrade/main.php b/ext/upgrade/main.php index 648e95772..8fb3b6556 100644 --- a/ext/upgrade/main.php +++ b/ext/upgrade/main.php @@ -65,8 +65,8 @@ public function onDatabaseUpgrade(DatabaseUpgradeEvent $event) if ($this->get_version("db_version") < 11) { log_info("upgrade", "Converting user flags to classes"); $database->execute("ALTER TABLE users ADD COLUMN class VARCHAR(32) NOT NULL default :user", ["user" => "user"]); - $database->execute("UPDATE users SET class = :name WHERE id=:id", ["name"=>"anonymous", "id"=>$config->get_int('anon_id')]); - $database->execute("UPDATE users SET class = :name WHERE admin=:admin", ["name"=>"admin", "admin"=>'Y']); + $database->execute("UPDATE users SET class = :name WHERE id=:id", ["name" => "anonymous", "id" => $config->get_int('anon_id')]); + $database->execute("UPDATE users SET class = :name WHERE admin=:admin", ["name" => "admin", "admin" => 'Y']); $this->set_version("db_version", 11); } @@ -195,13 +195,13 @@ public function onDatabaseUpgrade(DatabaseUpgradeEvent $event) // them into one big transaction would not be a good idea. $database->commit(); } - $database->execute("UPDATE images SET lossless = :t, video = :t WHERE ext IN ('swf')", ["t"=>true]); - $database->execute("UPDATE images SET lossless = :f, video = :f, audio = :t WHERE ext IN ('mp3')", ["t"=>true, "f"=>false]); - $database->execute("UPDATE images SET lossless = :f, video = :f, audio = :f WHERE ext IN ('jpg','jpeg')", ["f"=>false]); - $database->execute("UPDATE images SET lossless = :t, video = :f, audio = :f WHERE ext IN ('ico','ani','cur','png','svg')", ["t"=>true, "f"=>false]); - $database->execute("UPDATE images SET lossless = :t, audio = :f WHERE ext IN ('gif')", ["t"=>true, "f"=>false]); - $database->execute("UPDATE images SET audio = :f WHERE ext IN ('webp')", ["f"=>false]); - $database->execute("UPDATE images SET lossless = :f, video = :t WHERE ext IN ('flv','mp4','m4v','ogv','webm')", ["t"=>true, "f"=>false]); + $database->execute("UPDATE images SET lossless = :t, video = :t WHERE ext IN ('swf')", ["t" => true]); + $database->execute("UPDATE images SET lossless = :f, video = :f, audio = :t WHERE ext IN ('mp3')", ["t" => true, "f" => false]); + $database->execute("UPDATE images SET lossless = :f, video = :f, audio = :f WHERE ext IN ('jpg','jpeg')", ["f" => false]); + $database->execute("UPDATE images SET lossless = :t, video = :f, audio = :f WHERE ext IN ('ico','ani','cur','png','svg')", ["t" => true, "f" => false]); + $database->execute("UPDATE images SET lossless = :t, audio = :f WHERE ext IN ('gif')", ["t" => true, "f" => false]); + $database->execute("UPDATE images SET audio = :f WHERE ext IN ('webp')", ["f" => false]); + $database->execute("UPDATE images SET lossless = :f, video = :t WHERE ext IN ('flv','mp4','m4v','ogv','webm')", ["t" => true, "f" => false]); $this->set_version("db_version", 21); } } diff --git a/ext/upload/main.php b/ext/upload/main.php index ffb9192c9..f22d55c41 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -39,7 +39,7 @@ public function __construct( $metadata['filename'] = substr($metadata['filename'], 0, 255); } - public function set_tmpname(string $tmpname, ?string $mime=null) + public function set_tmpname(string $tmpname, ?string $mime = null) { assert(is_readable($tmpname)); $this->tmpname = $tmpname; @@ -151,7 +151,7 @@ public function onPageNavBuilding(PageNavBuildingEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { - if ($event->parent=="upload") { + if ($event->parent == "upload") { if (class_exists("Shimmie2\Wiki")) { $event->add_nav_link("upload_guidelines", new Link('wiki/upload_guidelines'), "Guidelines"); } diff --git a/ext/upload/test.php b/ext/upload/test.php index a45bb445d..9e12f99e0 100644 --- a/ext/upload/test.php +++ b/ext/upload/test.php @@ -43,7 +43,7 @@ public function testRawUpload() 'size' => [0], ] ]; - $page = $this->post_page("upload", ["tags0"=>"foo bar"]); + $page = $this->post_page("upload", ["tags0" => "foo bar"]); $this->assert_response(302); $this->assertStringStartsWith("/test/post/list/poster%3Dtest/1", $page->redirect); @@ -67,7 +67,7 @@ public function testRawReplace() ] ]; - $page = $this->post_page("upload/replace", ["image_id"=>$image_id]); + $page = $this->post_page("upload/replace", ["image_id" => $image_id]); $this->assert_response(302); $this->assertEquals("/test/post/view/$image_id", $page->redirect); @@ -104,7 +104,7 @@ public function testRejectUnknownFiletype() public function testRejectHuge() { // FIXME: huge.dat is rejected for other reasons; manual testing shows that this works - file_put_contents("data/huge.jpg", file_get_contents("tests/pbx_screenshot.jpg") . str_repeat("U", 1024*1024*3)); + file_put_contents("data/huge.jpg", file_get_contents("tests/pbx_screenshot.jpg") . str_repeat("U", 1024 * 1024 * 3)); try { $this->post_image("data/huge.jpg", "test"); $this->fail("Uploading huge.jpg didn't fail..."); diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 2d3c770f2..77ba47c0b 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -50,22 +50,22 @@ public function display_page(Page $page): void $form = SHM_FORM("upload", "POST", true, "file_upload"); $form->appendChild( TABLE( - ["id"=>"large_upload_form", "class"=>"vert"], + ["id" => "large_upload_form", "class" => "vert"], TR( - TD(["width"=>"20"], rawHTML("Common Tags")), - TD(["colspan"=>"5"], INPUT(["name"=>"tags", "type"=>"text", "placeholder"=>"tagme", "class"=>"autocomplete_tags", "autocomplete"=>"off"])) + TD(["width" => "20"], rawHTML("Common Tags")), + TD(["colspan" => "5"], INPUT(["name" => "tags", "type" => "text", "placeholder" => "tagme", "class" => "autocomplete_tags", "autocomplete" => "off"])) ), TR( - TD(["width"=>"20"], rawHTML("Common Source")), - TD(["colspan"=>"5"], INPUT(["name"=>"source", "type"=>"text"])) + TD(["width" => "20"], rawHTML("Common Source")), + TD(["colspan" => "5"], INPUT(["name" => "source", "type" => "text"])) ), $upload_list, TR( - TD(["colspan"=>$tl_enabled ? 2 : 4,"id"=>"upload_size_tracker"], ""), - TD(["colspan"=>2], ""), + TD(["colspan" => $tl_enabled ? 2 : 4,"id" => "upload_size_tracker"], ""), + TD(["colspan" => 2], ""), ), TR( - TD(["colspan"=>"6"], INPUT(["id"=>"uploadbutton", "type"=>"submit", "value"=>"Post"])) + TD(["colspan" => "6"], INPUT(["id" => "uploadbutton", "type" => "submit", "value" => "Post"])) ), ) ); @@ -148,18 +148,18 @@ protected function h_upload_list_1(): HTMLElement $upload_list->appendChild( TR( - TD(["colspan"=>$tl_enabled ? 2 : 4], "Files"), - $tl_enabled ? TD(["colspan"=>"2"], "URLs") : emptyHTML(), - TD(["colspan"=>"2"], "Post-Specific Tags"), + TD(["colspan" => $tl_enabled ? 2 : 4], "Files"), + $tl_enabled ? TD(["colspan" => "2"], "URLs") : emptyHTML(), + TD(["colspan" => "2"], "Post-Specific Tags"), ) ); - for ($i=0; $i<$upload_count; $i++) { + for ($i = 0; $i < $upload_count; $i++) { $upload_list->appendChild( TR( - TD(["colspan"=>$tl_enabled ? 2 : 4], DIV(["name"=>"canceldata{$i}[]","style"=>"display:inline;margin-right:5px;font-size:15px;visibility:hidden;","onclick"=>"$(\"input[name='data{$i}[]']\")[0].value='';updateTracker();"], "✖"), INPUT(["type"=>"file", "name"=>"data{$i}[]", "accept"=>$accept, "multiple"=>true])), - $tl_enabled ? TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"url{$i}"])) : emptyHTML(), - TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"tags{$i}", "class"=>"autocomplete_tags", "autocomplete"=>"off"])), + TD(["colspan" => $tl_enabled ? 2 : 4], DIV(["name" => "canceldata{$i}[]","style" => "display:inline;margin-right:5px;font-size:15px;visibility:hidden;","onclick" => "$(\"input[name='data{$i}[]']\")[0].value='';updateTracker();"], "✖"), INPUT(["type" => "file", "name" => "data{$i}[]", "accept" => $accept, "multiple" => true])), + $tl_enabled ? TD(["colspan" => "2"], INPUT(["type" => "text", "name" => "url{$i}"])) : emptyHTML(), + TD(["colspan" => "2"], INPUT(["type" => "text", "name" => "tags{$i}", "class" => "autocomplete_tags", "autocomplete" => "off"])), ) ); } @@ -177,7 +177,7 @@ protected function h_bookmarklets(): HTMLElement $max_kb = to_shorthand_int($max_size); $delimiter = $config->get_bool('nice_urls') ? '?' : '&'; - $js='javascript:( + $js = 'javascript:( function() { if(typeof window=="undefined" || !window.location || window.location.href=="about:blank") { window.location = "'. $main_page .'"; @@ -198,7 +198,7 @@ function() { } )();'; $html1 = P( - A(["href"=>$js], "Upload to $title"), + A(["href" => $js], "Upload to $title"), rawHTML(' (Drag & drop onto your bookmarks toolbar, then click when looking at a post)') ); @@ -216,7 +216,7 @@ function() { void(document.body.appendChild(document.createElement("script")).src="'.make_http(get_base_href())."/ext/upload/bookmarklet.js".'") '; $html2 = P( - A(["href"=>$js], $title), + A(["href" => $js], $title), rawHTML("(Click when looking at a post page. Works on sites running Shimmie / Danbooru / Gelbooru. (This also grabs the tags / rating / source!))"), ); @@ -235,14 +235,14 @@ public function display_replace_page(Page $page, int $image_id) $upload_list = emptyHTML( TR( TD("File"), - TD(INPUT(["name"=>"data[]", "type"=>"file", "accept"=>$accept])) + TD(INPUT(["name" => "data[]", "type" => "file", "accept" => $accept])) ) ); if ($tl_enabled) { $upload_list->appendChild( TR( TD("or URL"), - TD(INPUT(["name"=>"url", "type"=>"text"])) + TD(INPUT(["name" => "url", "type" => "text"])) ) ); } @@ -255,12 +255,12 @@ public function display_replace_page(Page $page, int $image_id) $form = SHM_FORM("upload/replace/".$image_id, "POST", true); $form->appendChild(emptyHTML( - INPUT(["type"=>"hidden", "name"=>"image_id", "value"=>$image_id]), + INPUT(["type" => "hidden", "name" => "image_id", "value" => $image_id]), TABLE( - ["id"=>"large_upload_form", "class"=>"vert"], + ["id" => "large_upload_form", "class" => "vert"], $upload_list, - TR(TD("Source"), TD(["colspan"=>3], INPUT(["name"=>"source", "type"=>"text"]))), - TR(TD(["colspan"=>4], INPUT(["id"=>"uploadbutton", "type"=>"submit", "value"=>"Post"]))), + TR(TD("Source"), TD(["colspan" => 3], INPUT(["name" => "source", "type" => "text"]))), + TR(TD(["colspan" => 4], INPUT(["id" => "uploadbutton", "type" => "submit", "value" => "Post"]))), ) )); @@ -328,18 +328,18 @@ protected function build_upload_block(): HTMLElement $form = SHM_FORM("upload", "POST", true); $form->appendChild( emptyHTML( - INPUT(["id"=>"data[]", "name"=>"data[]", "size"=>"16", "type"=>"file", "accept"=>$accept, "multiple"=>true]), - INPUT(["name"=>"tags", "type"=>"text", "placeholder"=>"tagme", "class"=>"autocomplete_tags", "required"=>true, "autocomplete"=>"off"]), - INPUT(["type"=>"submit", "value"=>"Post"]), + INPUT(["id" => "data[]", "name" => "data[]", "size" => "16", "type" => "file", "accept" => $accept, "multiple" => true]), + INPUT(["name" => "tags", "type" => "text", "placeholder" => "tagme", "class" => "autocomplete_tags", "required" => true, "autocomplete" => "off"]), + INPUT(["type" => "submit", "value" => "Post"]), ) ); return DIV( - ["class"=>'mini_upload'], + ["class" => 'mini_upload'], $form, SMALL("(Max file size is $max_kb)"), SMALL(BR(), "(Max total size is $max_total_kb)"), - NOSCRIPT(BR(), A(["href"=>make_link("upload")], "Larger Form")) + NOSCRIPT(BR(), A(["href" => make_link("upload")], "Larger Form")) ); } diff --git a/ext/user/events.php b/ext/user/events.php index aacf7fa1c..d4a75de83 100644 --- a/ext/user/events.php +++ b/ext/user/events.php @@ -10,7 +10,7 @@ class UserBlockBuildingEvent extends Event { public array $parts = []; - public function add_link(string|HTMLElement $name, string $link, int $position=50): void + public function add_link(string|HTMLElement $name, string $link, int $position = 50): void { while (isset($this->parts[$position])) { $position++; @@ -43,7 +43,7 @@ public function __construct(public User $display_user) parent::__construct(); } - public function add_stats(string $html, int $position=50) + public function add_stats(string $html, int $position = 50) { while (isset($this->stats[$position])) { $position++; diff --git a/ext/user/main.php b/ext/user/main.php index a3a923242..ce2c97334 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -24,7 +24,7 @@ class UserNameColumn extends TextColumn { public function display(array $row): HTMLElement { - return A(["href"=>make_link("user/{$row[$this->name]}")], $row[$this->name]); + return A(["href" => make_link("user/{$row[$this->name]}")], $row[$this->name]); } } @@ -38,7 +38,7 @@ public function __construct() public function display(array $row): HTMLElement { - return A(["href"=>search_link(["user={$row['name']}"])], "Posts"); + return A(["href" => search_link(["user={$row['name']}"])], "Posts"); } } @@ -368,17 +368,17 @@ public function onSetupBuilding(SetupBuildingEvent $event) $sb->add_choice_option( "avatar_gravatar_type", [ - 'Default'=>'default', - 'Wavatar'=>'wavatar', - 'Monster ID'=>'monsterid', - 'Identicon'=>'identicon' + 'Default' => 'default', + 'Wavatar' => 'wavatar', + 'Monster ID' => 'monsterid', + 'Identicon' => 'identicon' ], "Type", true ); $sb->add_choice_option( "avatar_gravatar_rating", - ['G'=>'g', 'PG'=>'pg', 'R'=>'r', 'X'=>'x'], + ['G' => 'g', 'PG' => 'pg', 'R' => 'r', 'X' => 'x'], "Rating", true ); @@ -389,13 +389,13 @@ public function onSetupBuilding(SetupBuildingEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { global $user; - if ($event->parent==="system") { + if ($event->parent === "system") { if ($user->can(Permissions::EDIT_USER_PASSWORD)) { $event->add_nav_link("user_admin", new Link('user_admin/list'), "User List", NavLink::is_active(["user_admin"])); } } - if ($event->parent==="user" && !$user->is_anonymous()) { + if ($event->parent === "user" && !$user->is_anonymous()) { $event->add_nav_link("logout", new Link('user_admin/logout'), "Log Out", false, 90); } } @@ -465,7 +465,7 @@ public function onUserCreation(UserCreationEvent $event) public static function has_user_query(array $context): bool { foreach ($context as $term) { - if (preg_match(self::USER_SEARCH_REGEX, $term)|| + if (preg_match(self::USER_SEARCH_REGEX, $term) || preg_match(self::USER_ID_SEARCH_REGEX, $term)) { return true; } @@ -501,7 +501,7 @@ public function onSearchTermParse(SearchTermParseEvent $event) public function onHelpPageBuilding(HelpPageBuildingEvent $event) { - if ($event->key===HelpPages::SEARCH) { + if ($event->key === HelpPages::SEARCH) { $block = new Block(); $block->header = "Users"; $block->body = (string)$this->theme->get_help_html(); @@ -616,7 +616,7 @@ private function create_user(UserCreationEvent $event): User $database->execute( "INSERT INTO users (name, pass, joindate, email, class) VALUES (:username, :hash, now(), :email, :class)", - ["username"=>$event->username, "hash"=>'', "email"=>$email, "class"=>$class] + ["username" => $event->username, "hash" => '', "email" => $email, "class" => $class] ); $uid = $database->get_last_insert_id('users_id_seq'); $new_user = User::by_name($event->username); @@ -643,13 +643,13 @@ private function set_login_cookie(string $name): void $page->add_cookie( "user", $name, - time()+60*60*24*365, + time() + 60 * 60 * 24 * 365, '/' ); $page->add_cookie( "session", $this->get_session_id($name), - time()+60*60*24*$config->get_int('login_memory'), + time() + 60 * 60 * 24 * $config->get_int('login_memory'), '/' ); } @@ -754,7 +754,7 @@ private function count_upload_ips(User $duser): array FROM images WHERE owner_id=:id GROUP BY owner_ip - ORDER BY max(posted) DESC", ["id"=>$duser->id]); + ORDER BY max(posted) DESC", ["id" => $duser->id]); } private function count_comment_ips(User $duser): array @@ -767,7 +767,7 @@ private function count_comment_ips(User $duser): array FROM comments WHERE owner_id=:id GROUP BY owner_ip - ORDER BY max(posted) DESC", ["id"=>$duser->id]); + ORDER BY max(posted) DESC", ["id" => $duser->id]); } private function count_log_ips(User $duser): array @@ -783,10 +783,10 @@ private function count_log_ips(User $duser): array FROM score_log WHERE username=:username GROUP BY address - ORDER BY MAX(date_sent) DESC", ["username"=>$duser->name]); + ORDER BY MAX(date_sent) DESC", ["username" => $duser->name]); } - private function delete_user(Page $page, bool $with_images=false, bool $with_comments=false): void + private function delete_user(Page $page, bool $with_images = false, bool $with_comments = false): void { global $user, $config, $database; diff --git a/ext/user/theme.php b/ext/user/theme.php index 33d8a5fb5..786dafbd2 100644 --- a/ext/user/theme.php +++ b/ext/user/theme.php @@ -54,7 +54,7 @@ public function display_user_block(Page $page, User $user, $parts) $html = emptyHTML('Logged in as ', $user->name); foreach ($parts as $part) { $html->appendChild(BR()); - $html->appendChild(A(["href"=>$part["link"]], $part["name"])); + $html->appendChild(A(["href" => $part["link"]], $part["name"])); } $b = new Block("User Links", $html, "left", 90); $b->is_content = false; @@ -74,30 +74,30 @@ public function display_signup_page(Page $page) $form = SHM_SIMPLE_FORM( "user_admin/create", TABLE( - ["class"=>"form"], + ["class" => "form"], TBODY( TR( TH("Name"), - TD(INPUT(["type"=>'text', "name"=>'name', "required"=>true])) + TD(INPUT(["type" => 'text', "name" => 'name', "required" => true])) ), TR( TH("Password"), - TD(INPUT(["type"=>'password', "name"=>'pass1', "required"=>true])) + TD(INPUT(["type" => 'password', "name" => 'pass1', "required" => true])) ), TR( TH(rawHTML("Repeat Password")), - TD(INPUT(["type"=>'password', "name"=>'pass2', "required"=>true])) + TD(INPUT(["type" => 'password', "name" => 'pass2', "required" => true])) ), TR( TH(rawHTML("Email (Optional)")), - TD(INPUT(["type"=>'email', "name"=>'email'])) + TD(INPUT(["type" => 'email', "name" => 'email'])) ), TR( - TD(["colspan"=>"2"], rawHTML(captcha_get_html())) + TD(["colspan" => "2"], rawHTML(captcha_get_html())) ), ), TFOOT( - TR(TD(["colspan"=>"2"], INPUT(["type"=>"submit", "value"=>"Create Account"]))) + TR(TD(["colspan" => "2"], INPUT(["type" => "submit", "value" => "Create Account"]))) ) ) ); @@ -120,27 +120,27 @@ public function display_user_creator() $form = SHM_SIMPLE_FORM( "user_admin/create_other", TABLE( - ["class"=>"form"], + ["class" => "form"], TBODY( TR( TH("Name"), - TD(INPUT(["type"=>'text', "name"=>'name', "required"=>true])) + TD(INPUT(["type" => 'text', "name" => 'name', "required" => true])) ), TR( TH("Password"), - TD(INPUT(["type"=>'password', "name"=>'pass1', "required"=>true])) + TD(INPUT(["type" => 'password', "name" => 'pass1', "required" => true])) ), TR( TH(rawHTML("Repeat Password")), - TD(INPUT(["type"=>'password', "name"=>'pass2', "required"=>true])) + TD(INPUT(["type" => 'password', "name" => 'pass2', "required" => true])) ), TR( TH(rawHTML("Email (Optional)")), - TD(INPUT(["type"=>'email', "name"=>'email'])) + TD(INPUT(["type" => 'email', "name" => 'email'])) ), ), TFOOT( - TR(TD(["colspan"=>"2"], INPUT(["type"=>"submit", "value"=>"Create Account"]))) + TR(TD(["colspan" => "2"], INPUT(["type" => "submit", "value" => "Create Account"]))) ) ) ); @@ -164,19 +164,19 @@ public function display_login_block(Page $page) $form = SHM_SIMPLE_FORM( "user_admin/login", TABLE( - ["style"=>"width: 100%", "class"=>"form"], + ["style" => "width: 100%", "class" => "form"], TBODY( TR( - TH(LABEL(["for"=>"user"], "Name")), - TD(INPUT(["id"=>"user", "type"=>"text", "name"=>"user", "autocomplete"=>"username"])) + TH(LABEL(["for" => "user"], "Name")), + TD(INPUT(["id" => "user", "type" => "text", "name" => "user", "autocomplete" => "username"])) ), TR( - TH(LABEL(["for"=>"pass"], "Password")), - TD(INPUT(["id"=>"pass", "type"=>"password", "name"=>"pass", "autocomplete"=>"current-password"])) + TH(LABEL(["for" => "pass"], "Password")), + TD(INPUT(["id" => "pass", "type" => "password", "name" => "pass", "autocomplete" => "current-password"])) ) ), TFOOT( - TR(TD(["colspan"=>"2"], INPUT(["type"=>"submit", "value"=>"Log In"]))) + TR(TD(["colspan" => "2"], INPUT(["type" => "submit", "value" => "Log In"]))) ) ) ); @@ -184,7 +184,7 @@ public function display_login_block(Page $page) $html = emptyHTML(); $html->appendChild($form); if ($config->get_bool("login_signup_enabled") && $user->can(Permissions::CREATE_USER)) { - $html->appendChild(SMALL(A(["href"=>make_link("user_admin/create")], "Create Account"))); + $html->appendChild(SMALL(A(["href" => make_link("user_admin/create")], "Create Account"))); } $page->add_block(new Block("Login", $html, "left", 90)); @@ -209,14 +209,14 @@ private function _ip_list(string $name, array $ips): HTMLElement public function display_ip_list(Page $page, array $uploads, array $comments, array $events) { $html = TABLE( - ["id"=>"ip-history"], + ["id" => "ip-history"], TR( $this->_ip_list("Uploaded from", $uploads), $this->_ip_list("Commented from", $comments), $this->_ip_list("Logged Events", $events) ), TR( - TD(["colspan"=>"3"], "(Most recent at top)") + TD(["colspan" => "3"], "(Most recent at top)") ) ); @@ -250,7 +250,7 @@ public function build_operations(User $duser, UserOperationsBuildingEvent $event "Change Name", TBODY(TR( TH("New name"), - TD(INPUT(["type"=>'text', "name"=>'name', "value"=>$duser->name])) + TD(INPUT(["type" => 'text', "name" => 'name', "value" => $duser->name])) )), "Set" )); @@ -263,11 +263,11 @@ public function build_operations(User $duser, UserOperationsBuildingEvent $event TBODY( TR( TH("Password"), - TD(INPUT(["type"=>'password', "name"=>'pass1', "autocomplete"=>'new-password'])) + TD(INPUT(["type" => 'password', "name" => 'pass1', "autocomplete" => 'new-password'])) ), TR( TH("Repeat Password"), - TD(INPUT(["type"=>'password', "name"=>'pass2', "autocomplete"=>'new-password'])) + TD(INPUT(["type" => 'password', "name" => 'pass2', "autocomplete" => 'new-password'])) ), ), "Set" @@ -279,17 +279,17 @@ public function build_operations(User $duser, UserOperationsBuildingEvent $event "Change Email", TBODY(TR( TH("Address"), - TD(INPUT(["type"=>'text', "name"=>'address', "value"=>$duser->email, "autocomplete"=>'email', "inputmode"=>'email'])) + TD(INPUT(["type" => 'text', "name" => 'address', "value" => $duser->email, "autocomplete" => 'email', "inputmode" => 'email'])) )), "Set" )); if ($user->can(Permissions::EDIT_USER_CLASS)) { global $_shm_user_classes; - $select = SELECT(["name"=>"class"]); + $select = SELECT(["name" => "class"]); foreach ($_shm_user_classes as $name => $values) { $select->appendChild( - OPTION(["value"=>$name, "selected"=>$name == $duser->class->name], ucwords($name)) + OPTION(["value" => $name, "selected" => $name == $duser->class->name], ucwords($name)) ); } $html->appendChild(SHM_USER_FORM( @@ -307,12 +307,12 @@ public function build_operations(User $duser, UserOperationsBuildingEvent $event "user_admin/delete_user", "Delete User", TBODY( - TR(TD(LABEL(INPUT(["type"=>'checkbox', "name"=>'with_images']), "Delete images"))), - TR(TD(LABEL(INPUT(["type"=>'checkbox', "name"=>'with_comments']), "Delete comments"))), + TR(TD(LABEL(INPUT(["type" => 'checkbox', "name" => 'with_images']), "Delete images"))), + TR(TD(LABEL(INPUT(["type" => 'checkbox', "name" => 'with_comments']), "Delete comments"))), ), TFOOT( - TR(TD(INPUT(["type"=>'button', "class"=>'shm-unlocker', "data-unlock-sel"=>'.deluser', "value"=>'Unlock']))), - TR(TD(INPUT(["type"=>'submit', "class"=>'deluser', "value"=>'Delete User', "disabled"=>'true']))), + TR(TD(INPUT(["type" => 'button', "class" => 'shm-unlocker', "data-unlock-sel" => '.deluser', "value" => 'Unlock']))), + TR(TD(INPUT(["type" => 'submit', "class" => 'deluser', "value" => 'Delete User', "disabled" => 'true']))), ) )); } @@ -353,7 +353,7 @@ public function get_help_html(): HTMLElement */ public function display_user_classes(Page $page, array $classes, array $permissions): void { - $table = TABLE(["class"=>"zebra"]); + $table = TABLE(["class" => "zebra"]); $row = TR(); $row->appendChild(TH("Permission")); @@ -374,9 +374,9 @@ public function display_user_classes(Page $page, array $classes, array $permissi foreach ($classes as $class) { $opacity = array_key_exists($perm->getValue(), $class->abilities) ? 1 : 0.2; if ($class->can($perm->getValue())) { - $cell = TD(["style"=>"color: green; opacity: $opacity;"], "✔"); + $cell = TD(["style" => "color: green; opacity: $opacity;"], "✔"); } else { - $cell = TD(["style"=>"color: red; opacity: $opacity;"], "✘"); + $cell = TD(["style" => "color: red; opacity: $opacity;"], "✘"); } $row->appendChild($cell); } @@ -384,7 +384,7 @@ public function display_user_classes(Page $page, array $classes, array $permissi $doc = $perm->getDocComment(); if ($doc) { $doc = preg_replace('/\/\*\*|\n\s*\*\s*|\*\//', '', $doc); - $row->appendChild(TD(["style"=>"text-align: left;"], $doc)); + $row->appendChild(TD(["style" => "text-align: left;"], $doc)); } else { $row->appendChild(TD("")); } diff --git a/ext/user_config/info.php b/ext/user_config/info.php index a6495dbd9..d546352a4 100644 --- a/ext/user_config/info.php +++ b/ext/user_config/info.php @@ -10,7 +10,7 @@ class UserConfigInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "User-specific settings"; - public array $authors = ["Matthew Barbour"=>"matthew@darkholme.net"]; + public array $authors = ["Matthew Barbour" => "matthew@darkholme.net"]; public string $license = self::LICENSE_WTFPL; public string $description = "Provides system-wide support for user-specific settings"; public ExtensionVisibility $visibility = ExtensionVisibility::HIDDEN; diff --git a/ext/user_config/main.php b/ext/user_config/main.php index cf53dbb0a..2a729732f 100644 --- a/ext/user_config/main.php +++ b/ext/user_config/main.php @@ -93,7 +93,7 @@ public function onDatabaseUpgrade(DatabaseUpgradeEvent $event): void public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { global $user; - if ($event->parent==="user" && !$user->is_anonymous()) { + if ($event->parent === "user" && !$user->is_anonymous()) { $event->add_nav_link("user_config", new Link('user_config'), "User Options", false, 40); } } @@ -154,7 +154,7 @@ public function onPageRequest(PageRequestEvent $event) ]); $duser = User::by_id($input['id']); - if ($user->id!=$duser->id && !$user->can(Permissions::CHANGE_OTHER_USER_SETTING)) { + if ($user->id != $duser->id && !$user->can(Permissions::CHANGE_OTHER_USER_SETTING)) { $this->theme->display_permission_denied(); return; } diff --git a/ext/view/events/image_admin_block_building_event.php b/ext/view/events/image_admin_block_building_event.php index 47cb6a5c1..6a1d458d2 100644 --- a/ext/view/events/image_admin_block_building_event.php +++ b/ext/view/events/image_admin_block_building_event.php @@ -20,7 +20,7 @@ public function __construct(Image $image, User $user, string $context) $this->context = $context; } - public function add_part(string $html, int $position=50) + public function add_part(string $html, int $position = 50) { while (isset($this->parts[$position])) { $position++; diff --git a/ext/view/events/image_info_box_building_event.php b/ext/view/events/image_info_box_building_event.php index 206cbf25f..db9399e6b 100644 --- a/ext/view/events/image_info_box_building_event.php +++ b/ext/view/events/image_info_box_building_event.php @@ -19,7 +19,7 @@ public function __construct(Image $image, User $user) $this->user = $user; } - public function add_part(HTMLElement $html, int $position=50) + public function add_part(HTMLElement $html, int $position = 50) { while (isset($this->parts[$position])) { $position++; diff --git a/ext/view/test.php b/ext/view/test.php index 8faeab77b..320270522 100644 --- a/ext/view/test.php +++ b/ext/view/test.php @@ -47,10 +47,10 @@ public function testPrevNext() $this->assertEquals("/test/post/view/$image_id_2", $page->redirect); // When searching, we skip the middle - $page = $this->get_page("post/prev/$image_id_1", ["search"=>"test"]); + $page = $this->get_page("post/prev/$image_id_1", ["search" => "test"]); $this->assertEquals("/test/post/view/$image_id_3?#search=test", $page->redirect); - $page = $this->get_page("post/next/$image_id_3", ["search"=>"test"]); + $page = $this->get_page("post/next/$image_id_3", ["search" => "test"]); $this->assertEquals("/test/post/view/$image_id_1?#search=test", $page->redirect); // Middle image: has next and prev diff --git a/ext/wiki/info.php b/ext/wiki/info.php index 8c2583a1b..9c28808ae 100644 --- a/ext/wiki/info.php +++ b/ext/wiki/info.php @@ -11,7 +11,7 @@ class WikiInfo extends ExtensionInfo public string $key = self::KEY; public string $name = "Simple Wiki"; public string $url = self::SHIMMIE_URL; - public array $authors = [self::SHISH_NAME=>self::SHISH_EMAIL, "Luana Latte"=>"luana.latte.cat@gmail.com"]; + public array $authors = [self::SHISH_NAME => self::SHISH_EMAIL, "Luana Latte" => "luana.latte.cat@gmail.com"]; public string $license = self::LICENSE_GPLV2; public string $description = "A simple wiki, for those who don't want the hugeness of mediawiki"; public ?string $documentation = "Standard formatting APIs are used (This will be BBCode by default)"; diff --git a/ext/wiki/main.php b/ext/wiki/main.php index c115512ab..179eacfc9 100644 --- a/ext/wiki/main.php +++ b/ext/wiki/main.php @@ -67,7 +67,7 @@ class WikiPage #[Field] public string $body; - public function __construct(array $row=null) + public function __construct(array $row = null) { //assert(!empty($row)); global $database; @@ -80,7 +80,7 @@ public function __construct(array $row=null) $this->title = $row['title']; $this->revision = (int)$row['revision']; $this->locked = bool_escape($row['locked']); - $this->exists = $database->exists("SELECT id FROM wiki_pages WHERE title = :title", ["title"=>$this->title]); + $this->exists = $database->exists("SELECT id FROM wiki_pages WHERE title = :title", ["title" => $this->title]); $this->body = $row['body']; } } @@ -248,7 +248,7 @@ public function onPageNavBuilding(PageNavBuildingEvent $event) public function onPageSubNavBuilding(PageSubNavBuildingEvent $event) { - if ($event->parent=="wiki") { + if ($event->parent == "wiki") { $event->add_nav_link("wiki_rules", new Link('wiki/rules'), "Rules"); $event->add_nav_link("wiki_help", new Link('ext_doc/wiki'), "Help"); } @@ -259,24 +259,24 @@ public function onWikiUpdate(WikiUpdateEvent $event) global $database, $config; $wpage = $event->wikipage; - $exists = $database->exists("SELECT id FROM wiki_pages WHERE title = :title", ["title"=>$wpage->title]); + $exists = $database->exists("SELECT id FROM wiki_pages WHERE title = :title", ["title" => $wpage->title]); try { - if ($config->get_bool(WikiConfig::ENABLE_REVISIONS) || ! $exists) { + if ($config->get_bool(WikiConfig::ENABLE_REVISIONS) || !$exists) { $database->execute( " INSERT INTO wiki_pages(owner_id, owner_ip, date, title, revision, locked, body) VALUES (:owner_id, :owner_ip, now(), :title, :revision, :locked, :body)", - ["owner_id"=>$event->user->id, "owner_ip"=>get_real_ip(), - "title"=>$wpage->title, "revision"=>$wpage->revision, "locked"=>$wpage->locked, "body"=>$wpage->body] + ["owner_id" => $event->user->id, "owner_ip" => get_real_ip(), + "title" => $wpage->title, "revision" => $wpage->revision, "locked" => $wpage->locked, "body" => $wpage->body] ); } else { $database->execute( " UPDATE wiki_pages SET owner_id=:owner_id, owner_ip=:owner_ip, date=now(), locked=:locked, body=:body WHERE title = :title ORDER BY revision DESC LIMIT 1", - ["owner_id"=>$event->user->id, "owner_ip"=>get_real_ip(), - "title"=>$wpage->title, "locked"=>$wpage->locked, "body"=>$wpage->body] + ["owner_id" => $event->user->id, "owner_ip" => get_real_ip(), + "title" => $wpage->title, "locked" => $wpage->locked, "body" => $wpage->body] ); } } catch (\Exception $e) { @@ -289,7 +289,7 @@ public function onWikiDeleteRevision(WikiDeleteRevisionEvent $event) global $database; $database->execute( "DELETE FROM wiki_pages WHERE title=:title AND revision=:rev", - ["title"=>$event->title, "rev"=>$event->revision] + ["title" => $event->title, "rev" => $event->revision] ); } @@ -336,12 +336,12 @@ public static function get_history(string $title): array WHERE LOWER(title) LIKE LOWER(:title) ORDER BY revision DESC ", - ["title"=>$title] + ["title" => $title] ); } #[Query(name: "wiki")] - public static function get_page(string $title, ?int $revision=null): WikiPage + public static function get_page(string $title, ?int $revision = null): WikiPage { global $database; // first try and get the actual page @@ -353,7 +353,7 @@ public static function get_page(string $title, ?int $revision=null): WikiPage AND (:revision = -1 OR revision = :revision) ORDER BY revision DESC ", - ["title"=>$title, "revision"=>$revision ?? -1] + ["title" => $title, "revision" => $revision ?? -1] ); // fall back to wiki:default @@ -363,7 +363,7 @@ public static function get_page(string $title, ?int $revision=null): WikiPage FROM wiki_pages WHERE title LIKE :title ORDER BY revision DESC - ", ["title"=>"wiki:default"]); + ", ["title" => "wiki:default"]); // fall further back to manual if (empty($row)) { @@ -397,7 +397,7 @@ public static function format_tag_wiki_page(WikiPage $page): string SELECT * FROM tags WHERE tag = :title - ", ["title"=>$page->title]); + ", ["title" => $page->title]); if (!empty($row)) { $template = $config->get_string(WikiConfig::TAG_PAGE_TEMPLATE); @@ -414,7 +414,7 @@ public static function format_tag_wiki_page(WikiPage $page): string FROM aliases WHERE newtag = :title ORDER BY oldtag ASC - ", ["title"=>$row["tag"]]); + ", ["title" => $row["tag"]]); if (!empty($aliases)) { $template = str_replace("{aliases}", implode(", ", $aliases), $template); @@ -431,7 +431,7 @@ public static function format_tag_wiki_page(WikiPage $page): string SELECT additional_tags FROM auto_tag WHERE tag = :title - ", ["title"=>$row["tag"]]); + ", ["title" => $row["tag"]]); if (!empty($auto_tags)) { $auto_tags = Tag::explode($auto_tags); @@ -444,7 +444,7 @@ public static function format_tag_wiki_page(WikiPage $page): string SELECT * FROM tags WHERE tag = :title - ", ["title"=>$a_tag]); + ", ["title" => $a_tag]); $tag_html = $tag_list_t->return_tag($a_row, $tag_category_dict ?? []); $f_auto_tags[] = $tag_html[1]; @@ -521,7 +521,7 @@ private function arr_diff(array $f1, array $f2, int $show_equal = 0): string /** * add to output-string, if "show_equal" is enabled */ - $out .= ($show_equal==1) + $out .= ($show_equal == 1) ? $this->formatline(($c1), ($c2), "=", $f1[ $c1 ]) : "" ; /** @@ -535,8 +535,8 @@ private function arr_diff(array $f1, array $f2, int $show_equal = 0): string /** * move the current-pointer in the left and right side */ - $c1 ++; - $c2 ++; + $c1++; + $c2++; } /** @@ -576,7 +576,7 @@ private function arr_diff(array $f1, array $f2, int $show_equal = 0): string * be used, else it will be discarded later */ #hit - if (trim($f1[$c1+$s1]) == trim($f2[$c2])) { + if (trim($f1[$c1 + $s1]) == trim($f2[$c2])) { $found = 1 ; # set flag to stop further search $s2 = 0 ; # reset right side search-pointer $c2-- ; # move back the current right, so next loop hits @@ -593,7 +593,7 @@ private function arr_diff(array $f1, array $f2, int $show_equal = 0): string /** * add current search-line to diffence-buffer */ - $b1 .= $this->formatline(($c1 + $s1), ($c2), "-", $f1[ $c1+$s1 ]); + $b1 .= $this->formatline(($c1 + $s1), ($c2), "-", $f1[ $c1 + $s1 ]); /** * mark this line as 'searched' to prevent doubles. @@ -609,7 +609,7 @@ private function arr_diff(array $f1, array $f2, int $show_equal = 0): string * * comparing current line with the searching line on the right */ - if (trim($f1[$c1]) == trim($f2[$c2+$s2])) { + if (trim($f1[$c1]) == trim($f2[$c2 + $s2])) { $found = 1 ; # flag to stop search $s1 = 0 ; # reset pointer for search $c1-- ; # move current line back, so we hit next loop @@ -622,7 +622,7 @@ private function arr_diff(array $f1, array $f2, int $show_equal = 0): string /** * add current searchline to buffer */ - $b2 .= $this->formatline(($c1), ($c2 + $s2), "+", $f2[ $c2+$s2 ]); + $b2 .= $this->formatline(($c1), ($c2 + $s2), "+", $f2[ $c2 + $s2 ]); /** * mark current line to prevent double-hits diff --git a/ext/wiki/test.php b/ext/wiki/test.php index 8f5551cc2..52da9b008 100644 --- a/ext/wiki/test.php +++ b/ext/wiki/test.php @@ -35,7 +35,7 @@ public function testAccess() $this->assert_text("This is a default page"); if ($allowed || $user == "admin") { - $this->post_page("wiki_admin/edit", ["title"=>"test"]); + $this->post_page("wiki_admin/edit", ["title" => "test"]); $this->assert_text("Editor"); } /* diff --git a/ext/wiki/theme.php b/ext/wiki/theme.php index 66b315a66..2d4dfd024 100644 --- a/ext/wiki/theme.php +++ b/ext/wiki/theme.php @@ -12,7 +12,7 @@ class WikiTheme extends Themelet * $wiki_page The wiki page, has ->title and ->body * $nav_page A wiki page object with navigation, has ->body */ - public function display_page(Page $page, WikiPage $wiki_page, ?WikiPage $nav_page=null) + public function display_page(Page $page, WikiPage $wiki_page, ?WikiPage $nav_page = null) { global $user; diff --git a/index.php b/index.php index 61b176caf..7aebad1c4 100644 --- a/index.php +++ b/index.php @@ -67,9 +67,9 @@ $_tracer->begin( $_SERVER["REQUEST_URI"] ?? "No Request", [ - "user"=>$_COOKIE["shm_user"] ?? "No User", - "ip"=>get_real_ip() ?? "No IP", - "user_agent"=>$_SERVER['HTTP_USER_AGENT'] ?? "No UA", + "user" => $_COOKIE["shm_user"] ?? "No User", + "ip" => get_real_ip() ?? "No IP", + "user_agent" => $_SERVER['HTTP_USER_AGENT'] ?? "No UA", ] ); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 8203ee969..2cd651ef3 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -111,7 +111,7 @@ private static function check_args(?array $args): array if (!$args) { return []; } - foreach ($args as $k=>$v) { + foreach ($args as $k => $v) { if (is_array($v)) { $args[$k] = $v; } else { @@ -121,7 +121,7 @@ private static function check_args(?array $args): array return $args; } - protected static function request($page_name, $get_args=null, $post_args=null): Page + protected static function request($page_name, $get_args = null, $post_args = null): Page { // use a fresh page global $page; @@ -142,12 +142,12 @@ protected static function request($page_name, $get_args=null, $post_args=null): return $page; } - protected static function get_page($page_name, $args=null): Page + protected static function get_page($page_name, $args = null): Page { return self::request($page_name, $args, null); } - protected static function post_page($page_name, $args=null): Page + protected static function post_page($page_name, $args = null): Page { return self::request($page_name, null, $args); } @@ -177,7 +177,7 @@ protected function assert_response(int $code): void $this->assertEquals($code, $page->code); } - protected function page_to_text(string $section=null): string + protected function page_to_text(string $section = null): string { global $page; if ($page->mode == PageMode::PAGE) { @@ -196,12 +196,12 @@ protected function page_to_text(string $section=null): string } } - protected function assert_text(string $text, string $section=null): void + protected function assert_text(string $text, string $section = null): void { $this->assertStringContainsString($text, $this->page_to_text($section)); } - protected function assert_no_text(string $text, string $section=null): void + protected function assert_no_text(string $text, string $section = null): void { $this->assertStringNotContainsString($text, $this->page_to_text($section)); } diff --git a/themes/danbooru/comment.theme.php b/themes/danbooru/comment.theme.php index 525fb2617..935a560c1 100644 --- a/themes/danbooru/comment.theme.php +++ b/themes/danbooru/comment.theme.php @@ -90,7 +90,7 @@ public function display_recent_comments(array $comments) // no recent comments in this theme } - protected function comment_to_html(Comment $comment, bool $trim=false): string + protected function comment_to_html(Comment $comment, bool $trim = false): string { global $user; diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php index 96675fa2c..4b7a1a2ae 100644 --- a/themes/danbooru/themelet.class.php +++ b/themes/danbooru/themelet.class.php @@ -40,15 +40,15 @@ private function build_paginator(int $current_page, int $total_pages, string $ba $prev = $current_page - 1; $at_start = ($current_page <= 3 || $total_pages <= 3); - $at_end = ($current_page >= $total_pages -2); + $at_end = ($current_page >= $total_pages - 2); $first_html = $at_start ? "" : $this->gen_page_link($base_url, $query, 1, "1"); $prev_html = $at_start ? "" : $this->gen_page_link($base_url, $query, $prev, "<<"); $next_html = $at_end ? "" : $this->gen_page_link($base_url, $query, $next, ">>"); $last_html = $at_end ? "" : $this->gen_page_link($base_url, $query, $total_pages, "$total_pages"); - $start = $current_page-2 > 1 ? $current_page-2 : 1; - $end = $current_page+2 <= $total_pages ? $current_page+2 : $total_pages; + $start = $current_page - 2 > 1 ? $current_page - 2 : 1; + $end = $current_page + 2 <= $total_pages ? $current_page + 2 : $total_pages; $pages = []; foreach (range($start, $end) as $i) { @@ -68,6 +68,6 @@ private function build_paginator(int $current_page, int $total_pages, string $ba $ndots = ""; } - return DIV(["id"=>'paginator'], joinHTML(" ", [$prev_html, $first_html, $pdots, $pages_html, $ndots, $last_html, $next_html])); + return DIV(["id" => 'paginator'], joinHTML(" ", [$prev_html, $first_html, $pdots, $pages_html, $ndots, $last_html, $next_html])); } } diff --git a/themes/danbooru/view.theme.php b/themes/danbooru/view.theme.php index 7314829e5..28facb934 100644 --- a/themes/danbooru/view.theme.php +++ b/themes/danbooru/view.theme.php @@ -37,7 +37,7 @@ private function build_stats(Image $image): string
Filesize: $h_filesize
Type: $h_type"; - if ($image->length!=null) { + if ($image->length != null) { $h_length = format_milliseconds($image->length); $html .= "
Length: $h_length"; } diff --git a/themes/danbooru2/comment.theme.php b/themes/danbooru2/comment.theme.php index dd43860eb..4ca014e9e 100644 --- a/themes/danbooru2/comment.theme.php +++ b/themes/danbooru2/comment.theme.php @@ -91,7 +91,7 @@ public function display_recent_comments(array $comments) } - protected function comment_to_html(Comment $comment, bool $trim=false): string + protected function comment_to_html(Comment $comment, bool $trim = false): string { global $user; diff --git a/themes/danbooru2/themelet.class.php b/themes/danbooru2/themelet.class.php index 0f1922755..7e619442b 100644 --- a/themes/danbooru2/themelet.class.php +++ b/themes/danbooru2/themelet.class.php @@ -21,7 +21,7 @@ public function display_paginator(Page $page, string $base, ?string $query, int private function gen_page_link(string $base_url, ?string $query, int $page, string $name): HTMLElement { - return A(["href"=>make_link("$base_url/$page", $query)], $name); + return A(["href" => make_link("$base_url/$page", $query)], $name); } private function gen_page_link_block(string $base_url, ?string $query, int $page, int $current_page, string $name): HTMLElement @@ -40,15 +40,15 @@ private function build_paginator(int $current_page, int $total_pages, string $ba $prev = $current_page - 1; $at_start = ($current_page <= 3 || $total_pages <= 3); - $at_end = ($current_page >= $total_pages -2); + $at_end = ($current_page >= $total_pages - 2); $first_html = $at_start ? "" : $this->gen_page_link($base_url, $query, 1, "1"); $prev_html = $at_start ? "" : $this->gen_page_link($base_url, $query, $prev, "<<"); $next_html = $at_end ? "" : $this->gen_page_link($base_url, $query, $next, ">>"); $last_html = $at_end ? "" : $this->gen_page_link($base_url, $query, $total_pages, "$total_pages"); - $start = $current_page-2 > 1 ? $current_page-2 : 1; - $end = $current_page+2 <= $total_pages ? $current_page+2 : $total_pages; + $start = $current_page - 2 > 1 ? $current_page - 2 : 1; + $end = $current_page + 2 <= $total_pages ? $current_page + 2 : $total_pages; $pages = []; foreach (range($start, $end) as $i) { @@ -62,12 +62,12 @@ private function build_paginator(int $current_page, int $total_pages, string $ba $pdots = ""; } - if ($total_pages > $end+1) { + if ($total_pages > $end + 1) { $ndots = "..."; } else { $ndots = ""; } - return DIV(["id"=>"paginator"], joinHTML(" ", [$prev_html, $first_html, $pdots, $pages_html, $ndots, $last_html, $next_html])); + return DIV(["id" => "paginator"], joinHTML(" ", [$prev_html, $first_html, $pdots, $pages_html, $ndots, $last_html, $next_html])); } } diff --git a/themes/danbooru2/view.theme.php b/themes/danbooru2/view.theme.php index 130eb81d0..99e3c8607 100644 --- a/themes/danbooru2/view.theme.php +++ b/themes/danbooru2/view.theme.php @@ -37,7 +37,7 @@ private function build_information(Image $image): string
Type: $h_type "; - if ($image->length!=null) { + if ($image->length != null) { $h_length = format_milliseconds($image->length); $html .= "
Length: $h_length"; } diff --git a/themes/futaba/comment.theme.php b/themes/futaba/comment.theme.php index ae30fed18..ec39b18e7 100644 --- a/themes/futaba/comment.theme.php +++ b/themes/futaba/comment.theme.php @@ -64,7 +64,7 @@ public function build_upload_box(): string } - protected function comment_to_html(Comment $comment, bool $trim=false): string + protected function comment_to_html(Comment $comment, bool $trim = false): string { $inner_id = $this->inner_id; // because custom themes can't add params, because PHP global $user; diff --git a/themes/futaba/themelet.class.php b/themes/futaba/themelet.class.php index cb2c937d1..e059b3c2b 100644 --- a/themes/futaba/themelet.class.php +++ b/themes/futaba/themelet.class.php @@ -55,8 +55,8 @@ public function futaba_build_paginator(int $current_page, int $total_pages, stri $next_html = $at_end ? "Next" : $this->futaba_gen_page_link($base_url, $query, $next, "Next"); //$last_html = $at_end ? "Last" : $this->futaba_gen_page_link($base_url, $query, $total_pages, "Last"); - $start = $current_page-5 > 1 ? $current_page-5 : 1; - $end = $start+10 < $total_pages ? $start+10 : $total_pages; + $start = $current_page - 5 > 1 ? $current_page - 5 : 1; + $end = $start + 10 < $total_pages ? $start + 10 : $total_pages; $pages = []; foreach (range($start, $end) as $i) { diff --git a/themes/lite/comment.theme.php b/themes/lite/comment.theme.php index ce60276c9..20717a981 100644 --- a/themes/lite/comment.theme.php +++ b/themes/lite/comment.theme.php @@ -6,7 +6,7 @@ class CustomCommentListTheme extends CommentListTheme { - protected function comment_to_html(Comment $comment, bool $trim=false): string + protected function comment_to_html(Comment $comment, bool $trim = false): string { return $this->rr(parent::comment_to_html($comment, $trim)); } diff --git a/themes/lite/page.class.php b/themes/lite/page.class.php index 212c89646..d6d606344 100644 --- a/themes/lite/page.class.php +++ b/themes/lite/page.class.php @@ -112,7 +112,7 @@ public function render() EOD; } /* end of function display_page() */ - public function block_to_html(Block $block, bool $hidable=false): string + public function block_to_html(Block $block, bool $hidable = false): string { $h = $block->header; $b = $block->body; diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index 336cefff2..39c61b720 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -34,7 +34,7 @@ public function display_paginator(Page $page, string $base, ?string $query, int $page->add_block(new Block("Paginator", $body, "main", 90)); } - public function litetheme_gen_page_link(string $base_url, ?string $query, int $page, string $name, ?string $link_class=null): HTMLElement + public function litetheme_gen_page_link(string $base_url, ?string $query, int $page, string $name, ?string $link_class = null): HTMLElement { return A(["href" => make_link("$base_url/$page", $query), "class" => $link_class], $name); } @@ -57,8 +57,8 @@ public function litetheme_build_paginator(int $current_page, int $total_pages, s $at_start = ($current_page <= 1 || $total_pages <= 1); $at_end = ($current_page >= $total_pages); - $first_html = $at_start ? SPAN(["class"=>"tab"], "First") : $this->litetheme_gen_page_link($base_url, $query, 1, "First"); - $prev_html = $at_start ? SPAN(["class"=>"tab"], "Prev") : $this->litetheme_gen_page_link($base_url, $query, $prev, "Prev"); + $first_html = $at_start ? SPAN(["class" => "tab"], "First") : $this->litetheme_gen_page_link($base_url, $query, 1, "First"); + $prev_html = $at_start ? SPAN(["class" => "tab"], "Prev") : $this->litetheme_gen_page_link($base_url, $query, $prev, "Prev"); $random_html = ""; if ($show_random) { @@ -66,11 +66,11 @@ public function litetheme_build_paginator(int $current_page, int $total_pages, s $random_html = $this->litetheme_gen_page_link($base_url, $query, $rand, "Random"); } - $next_html = $at_end ? SPAN(["class"=>"tab"], "Next") : $this->litetheme_gen_page_link($base_url, $query, $next, "Next"); - $last_html = $at_end ? SPAN(["class"=>"tab"], "Last") : $this->litetheme_gen_page_link($base_url, $query, $total_pages, "Last"); + $next_html = $at_end ? SPAN(["class" => "tab"], "Next") : $this->litetheme_gen_page_link($base_url, $query, $next, "Next"); + $last_html = $at_end ? SPAN(["class" => "tab"], "Last") : $this->litetheme_gen_page_link($base_url, $query, $total_pages, "Last"); - $start = $current_page-5 > 1 ? $current_page-5 : 1; - $end = $start+10 < $total_pages ? $start+10 : $total_pages; + $start = $current_page - 5 > 1 ? $current_page - 5 : 1; + $end = $start + 10 < $total_pages ? $start + 10 : $total_pages; $pages = []; foreach (range($start, $end) as $i) { @@ -78,7 +78,7 @@ public function litetheme_build_paginator(int $current_page, int $total_pages, s } return DIV( - ["class"=>"paginator sfoot"], + ["class" => "paginator sfoot"], $first_html, $prev_html, $random_html, diff --git a/themes/lite/view.theme.php b/themes/lite/view.theme.php index 76f95336b..02d55c963 100644 --- a/themes/lite/view.theme.php +++ b/themes/lite/view.theme.php @@ -38,10 +38,10 @@ private function build_stats(Image $image): string
Filesize: $h_filesize
Type: ".$h_type." "; - if ($image->video_codec!=null) { + if ($image->video_codec != null) { $html .= "
Video Codec: $image->video_codec"; } - if ($image->length!=null) { + if ($image->length != null) { $h_length = format_milliseconds($image->length); $html .= "
Length: $h_length"; } diff --git a/themes/rule34v2/themelet.class.php b/themes/rule34v2/themelet.class.php index e9902ad84..e26ff2294 100644 --- a/themes/rule34v2/themelet.class.php +++ b/themes/rule34v2/themelet.class.php @@ -35,14 +35,14 @@ public function build_thumb_html(Image $image): HTMLElement } $html = DIV( - ['class'=>'shm-thumb thumb', 'data-ext'=>$ext, 'data-tags'=>$tags, 'data-post-id'=>$id], + ['class' => 'shm-thumb thumb', 'data-ext' => $ext, 'data-tags' => $tags, 'data-post-id' => $id], A( - ['class'=>'shm-thumb-link', 'href'=>$view_link], - IMG(['id'=>"thumb_$id", 'title'=>$tip, 'alt'=>$tip, 'height'=>$tsize[1], 'width'=>$tsize[0], 'src'=>$thumb_link, 'loading'=>'lazy']) + ['class' => 'shm-thumb-link', 'href' => $view_link], + IMG(['id' => "thumb_$id", 'title' => $tip, 'alt' => $tip, 'height' => $tsize[1], 'width' => $tsize[0], 'src' => $thumb_link, 'loading' => 'lazy']) ), BR(), - A(['href'=>$image_link], 'File Only'), - SPAN(['class'=>'need-del'], ' - ', A(['href'=>'#', 'onclick'=>"image_hash_ban($id); return false;"], 'Ban')) + A(['href' => $image_link], 'File Only'), + SPAN(['class' => 'need-del'], ' - ', A(['href' => '#', 'onclick' => "image_hash_ban($id); return false;"], 'Ban')) ); // cache for ages; will be cleared in ext/index:onImageInfoSet diff --git a/themes/rule34v2/upload.theme.php b/themes/rule34v2/upload.theme.php index 405364e8e..bf4ccb708 100644 --- a/themes/rule34v2/upload.theme.php +++ b/themes/rule34v2/upload.theme.php @@ -44,18 +44,18 @@ public function display_page(Page $page): void $form = SHM_FORM("upload", "POST", true, "file_upload"); $form->appendChild( TABLE( - ["id"=>"large_upload_form", "class"=>"vert"], + ["id" => "large_upload_form", "class" => "vert"], TR( - TD(["width"=>"20"], rawHTML("Common Tags")), - TD(["colspan"=>"5"], INPUT(["name"=>"tags", "type"=>"text", "placeholder"=>"tagme", "autocomplete"=>"off"])) + TD(["width" => "20"], rawHTML("Common Tags")), + TD(["colspan" => "5"], INPUT(["name" => "tags", "type" => "text", "placeholder" => "tagme", "autocomplete" => "off"])) ), TR( - TD(["width"=>"20"], rawHTML("Common Source")), - TD(["colspan"=>"5"], INPUT(["name"=>"source", "type"=>"text"])) + TD(["width" => "20"], rawHTML("Common Source")), + TD(["colspan" => "5"], INPUT(["name" => "source", "type" => "text"])) ), $upload_list, TR( - TD(["colspan"=>"6"], INPUT(["id"=>"uploadbutton", "type"=>"submit", "value"=>"Post"])) + TD(["colspan" => "6"], INPUT(["id" => "uploadbutton", "type" => "submit", "value" => "Post"])) ), ) ); @@ -79,7 +79,7 @@ public function display_page(Page $page): void protected function build_upload_block(): HTMLElement { - return A(["href"=>make_link("upload"), "style"=>'font-size: 2em; display: block;'], "Upload"); + return A(["href" => make_link("upload"), "style" => 'font-size: 2em; display: block;'], "Upload"); } protected function h_upload_list_1(): HTMLElement @@ -92,18 +92,18 @@ protected function h_upload_list_1(): HTMLElement $upload_list->appendChild( TR( - TD(["colspan"=>$tl_enabled ? 2 : 4], "Files"), - $tl_enabled ? TD(["colspan"=>"2"], "URLs") : emptyHTML(), - TD(["colspan"=>"2"], "Post-Specific Tags"), + TD(["colspan" => $tl_enabled ? 2 : 4], "Files"), + $tl_enabled ? TD(["colspan" => "2"], "URLs") : emptyHTML(), + TD(["colspan" => "2"], "Post-Specific Tags"), ) ); - for ($i=0; $i<$upload_count; $i++) { + for ($i = 0; $i < $upload_count; $i++) { $upload_list->appendChild( TR( - TD(["colspan"=>$tl_enabled ? 2 : 4], INPUT(["type"=>"file", "name"=>"data{$i}[]", "accept"=>$accept, "multiple"=>true])), - $tl_enabled ? TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"url{$i}"])) : emptyHTML(), - TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"tags{$i}", "autocomplete"=>"off"])), + TD(["colspan" => $tl_enabled ? 2 : 4], INPUT(["type" => "file", "name" => "data{$i}[]", "accept" => $accept, "multiple" => true])), + $tl_enabled ? TD(["colspan" => "2"], INPUT(["type" => "text", "name" => "url{$i}"])) : emptyHTML(), + TD(["colspan" => "2"], INPUT(["type" => "text", "name" => "tags{$i}", "autocomplete" => "off"])), ) ); } diff --git a/themes/rule34v2/user.theme.php b/themes/rule34v2/user.theme.php index 56e2219fd..f621e1579 100644 --- a/themes/rule34v2/user.theme.php +++ b/themes/rule34v2/user.theme.php @@ -73,30 +73,30 @@ public function display_signup_page(Page $page) $form = SHM_SIMPLE_FORM( "user_admin/create", TABLE( - ["class"=>"form"], + ["class" => "form"], TBODY( TR( TH("Name"), - TD(INPUT(["type"=>'text', "name"=>'name', "required"=>true])) + TD(INPUT(["type" => 'text', "name" => 'name', "required" => true])) ), TR( TH("Password"), - TD(INPUT(["type"=>'password', "name"=>'pass1', "required"=>true])) + TD(INPUT(["type" => 'password', "name" => 'pass1', "required" => true])) ), TR( TH(rawHTML("Repeat Password")), - TD(INPUT(["type"=>'password', "name"=>'pass2', "required"=>true])) + TD(INPUT(["type" => 'password', "name" => 'pass2', "required" => true])) ), TR( TH(rawHTML("Email")), - TD(INPUT(["type"=>'email', "name"=>'email', "required"=>true])) + TD(INPUT(["type" => 'email', "name" => 'email', "required" => true])) ), TR( - TD(["colspan"=>"2"], rawHTML(captcha_get_html())) + TD(["colspan" => "2"], rawHTML(captcha_get_html())) ), ), TFOOT( - TR(TD(["colspan"=>"2"], INPUT(["type"=>"submit", "value"=>"Create Account"]))) + TR(TD(["colspan" => "2"], INPUT(["type" => "submit", "value" => "Create Account"]))) ) ) ); @@ -119,30 +119,30 @@ public function display_user_creator() $form = SHM_SIMPLE_FORM( "user_admin/create_other", TABLE( - ["class"=>"form"], + ["class" => "form"], TBODY( TR( TH("Name"), - TD(INPUT(["type"=>'text', "name"=>'name', "required"=>true])) + TD(INPUT(["type" => 'text', "name" => 'name', "required" => true])) ), TR( TH("Password"), - TD(INPUT(["type"=>'password', "name"=>'pass1', "required"=>true])) + TD(INPUT(["type" => 'password', "name" => 'pass1', "required" => true])) ), TR( TH(rawHTML("Repeat Password")), - TD(INPUT(["type"=>'password', "name"=>'pass2', "required"=>true])) + TD(INPUT(["type" => 'password', "name" => 'pass2', "required" => true])) ), TR( TH(rawHTML("Email")), - TD(INPUT(["type"=>'email', "name"=>'email'])) + TD(INPUT(["type" => 'email', "name" => 'email'])) ), TR( - TD(["colspan"=>2], rawHTML("(Email is optional for admin-created accounts)")), + TD(["colspan" => 2], rawHTML("(Email is optional for admin-created accounts)")), ), ), TFOOT( - TR(TD(["colspan"=>"2"], INPUT(["type"=>"submit", "value"=>"Create Account"]))) + TR(TD(["colspan" => "2"], INPUT(["type" => "submit", "value" => "Create Account"]))) ) ) );