mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
Compare commits
48 commits
a877fb3384
...
2a941e46c7
Author | SHA1 | Date | |
---|---|---|---|
|
2a941e46c7 | ||
|
9adb7eb9fe | ||
|
29a74db9ec | ||
|
5e12e8b6e9 | ||
|
478d119d42 | ||
|
1f6f0a3547 | ||
|
5281807e1f | ||
|
e2554d1fb0 | ||
|
b3478d83d1 | ||
|
ff6f3b2a8c | ||
|
1cd17caf87 | ||
|
6a0c949ed1 | ||
|
146f917d19 | ||
|
c01d1967dd | ||
|
7a4b3f52ae | ||
|
b3ff1d7e34 | ||
|
7268859226 | ||
|
61bede748a | ||
|
0562984999 | ||
|
83e1886e27 | ||
|
10947f3d49 | ||
|
f94423d491 | ||
|
b6200d6690 | ||
|
04f2141a7d | ||
|
4b7d7c2fc7 | ||
|
3d76a8bd09 | ||
|
1c399dcab7 | ||
|
e91c7d42a9 | ||
|
b7db1b0844 | ||
|
0066d53c08 | ||
|
1b08a74508 | ||
|
a5113d7cd3 | ||
|
0f94e1cb13 | ||
|
c6dcf474d3 | ||
|
d0cb7d6389 | ||
|
118ab73c37 | ||
|
91aaadbc6d | ||
|
7d1ae5bf19 | ||
|
3eaf4829bb | ||
|
3b233d9c28 | ||
|
3801eb0946 | ||
|
3a553f07bc | ||
|
b666bc9e0a | ||
|
81c49aa6a5 | ||
|
6fd9a78872 | ||
|
7f3b37560e | ||
|
8d0d6c012c | ||
|
3e6181ab3b |
92 changed files with 722 additions and 298 deletions
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\Sniffs\CodeLayout;
|
||||
|
||||
use PHP_CodeSniffer\Files\File;
|
||||
use PHP_CodeSniffer\Sniffs\Sniff;
|
||||
|
||||
/**
|
||||
* Checks that union type declarations follows the coding guidelines.
|
||||
*/
|
||||
class UnionTypesCheckSniff implements Sniff
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
return [
|
||||
T_FUNCTION,
|
||||
T_CLASS,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(File $phpcsFile, $stackPtr)
|
||||
{
|
||||
$tokens = $phpcsFile->getTokens();
|
||||
if ($tokens[$stackPtr]['type'] === 'T_FUNCTION')
|
||||
{
|
||||
$method_params = $phpcsFile->getMethodParameters($stackPtr);
|
||||
$method_params_array = array_column($method_params, 'type_hint', 'token');
|
||||
foreach ($method_params_array as $stack_pointer => $type_hint)
|
||||
{
|
||||
$this->check_union_type($phpcsFile, $stack_pointer, $type_hint);
|
||||
}
|
||||
|
||||
$method_properties = $phpcsFile->getMethodProperties($stackPtr);
|
||||
$this->check_union_type($phpcsFile, $stackPtr, $method_properties['return_type']);
|
||||
}
|
||||
else if ($tokens[$stackPtr]['type'] === 'T_CLASS')
|
||||
{
|
||||
$class_token = $tokens[$stackPtr];
|
||||
$class_closer_pointer = $class_token['scope_closer'];
|
||||
$first_method_pointer = $phpcsFile->findNext(T_FUNCTION, $stackPtr);
|
||||
$class_members_declarations_end_pointer = $first_method_pointer ?: $class_closer_pointer;
|
||||
|
||||
$stack_pointer = $stackPtr;
|
||||
while(($class_member_pointer = $phpcsFile->findNext(T_VARIABLE, $stack_pointer)) !== false && ($class_member_pointer < $class_members_declarations_end_pointer))
|
||||
{
|
||||
$properties = $phpcsFile->getMemberProperties($class_member_pointer);
|
||||
$this->check_union_type($phpcsFile, $class_member_pointer, $properties['type']);
|
||||
$stack_pointer = $class_member_pointer + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function check_union_type(File $phpcsFile, $stack_pointer, $type_hint)
|
||||
{
|
||||
if (empty($type_hint))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strpos($type_hint, '|') && $type_hint[0] == '?') // Check nullable shortcut syntax
|
||||
{
|
||||
$type = substr($type_hint, 1);
|
||||
$error = 'Nullable shortcut syntax must not be used. Use union type instead: %1$s|null; found %2$s';
|
||||
$data = [$type, $type_hint];
|
||||
$phpcsFile->addError($error, $stack_pointer, 'ShortNullableSyntax', $data);
|
||||
}
|
||||
else if ((count($types_array = explode('|', $type_hint))) > 1) // Check union type layout
|
||||
{
|
||||
$types_array_null_less = $types_array;
|
||||
|
||||
// Check 'null' to be the last element
|
||||
$null_position = array_search('null', $types_array);
|
||||
if ($null_position !== false && $null_position != array_key_last($types_array))
|
||||
{
|
||||
$error = 'The "null" type hint must be the last of the union type elements; found %s';
|
||||
$data = [implode('|', $types_array)];
|
||||
$phpcsFile->addError($error, $stack_pointer, 'NullAlwaysLast', $data);
|
||||
}
|
||||
|
||||
// Check types excepting 'null' to follow alphabetical order
|
||||
if ($null_position !== false)
|
||||
{
|
||||
array_splice($types_array_null_less, $null_position, 1);
|
||||
}
|
||||
|
||||
if (count($types_array_null_less) > 1)
|
||||
{
|
||||
$types_array_null_less_sorted = $types_array_null_less;
|
||||
sort($types_array_null_less_sorted);
|
||||
if (!empty(array_diff_assoc($types_array_null_less, $types_array_null_less_sorted)))
|
||||
{
|
||||
$error = 'Union type elements must be sorted alphabetically excepting the "null" type hint must be the last if any; found %s';
|
||||
$data = [implode('|', $types_array)];
|
||||
$phpcsFile->addError($error, $stack_pointer, 'AlphabeticalSort', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,6 +11,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\Sniffs\Commenting;
|
||||
|
||||
use PHP_CodeSniffer\Files\File;
|
||||
use PHP_CodeSniffer\Sniffs\Sniff;
|
||||
|
||||
|
@ -21,7 +23,7 @@ use PHP_CodeSniffer\Sniffs\Sniff;
|
|||
* @package code_sniffer
|
||||
* @author Manuel Pichler <mapi@phpundercontrol.org>
|
||||
*/
|
||||
class phpbb_Sniffs_Commenting_FileCommentSniff implements Sniff
|
||||
class FileCommentSniff implements Sniff
|
||||
{
|
||||
/**
|
||||
* Returns an array of tokens this test wants to listen for.
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\Sniffs\ControlStructures;
|
||||
|
||||
use PHP_CodeSniffer\Files\File;
|
||||
use PHP_CodeSniffer\Sniffs\Sniff;
|
||||
|
||||
|
@ -18,7 +20,7 @@ use PHP_CodeSniffer\Sniffs\Sniff;
|
|||
* Checks that the opening brace of a control structures is on the line after.
|
||||
* From Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff
|
||||
*/
|
||||
class phpbb_Sniffs_ControlStructures_OpeningBraceBsdAllmanSniff implements Sniff
|
||||
class OpeningBraceBsdAllmanSniff implements Sniff
|
||||
{
|
||||
/**
|
||||
* Registers the tokens that this sniff wants to listen for.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
namespace phpbb\Sniffs\ControlStructures;
|
||||
|
||||
use PHP_CodeSniffer\Files\File;
|
||||
use PHP_CodeSniffer\Sniffs\Sniff;
|
||||
|
@ -18,7 +19,7 @@ use PHP_CodeSniffer\Sniffs\Sniff;
|
|||
* Checks that there is exactly one space between the keyword and the opening
|
||||
* parenthesis of a control structures.
|
||||
*/
|
||||
class phpbb_Sniffs_ControlStructures_OpeningParenthesisSniff implements Sniff
|
||||
class OpeningParenthesisSniff implements Sniff
|
||||
{
|
||||
/**
|
||||
* Registers the tokens that this sniff wants to listen for.
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\Sniffs\ControlStructures;
|
||||
|
||||
use PHP_CodeSniffer\Files\File;
|
||||
use PHP_CodeSniffer\Sniffs\Sniff;
|
||||
|
||||
|
@ -18,7 +20,7 @@ use PHP_CodeSniffer\Sniffs\Sniff;
|
|||
* Checks that the visibility qualifiers are placed after the static keyword
|
||||
* according to the coding guidelines
|
||||
*/
|
||||
class phpbb_Sniffs_ControlStructures_StaticKeywordSniff implements Sniff
|
||||
class StaticKeywordSniff implements Sniff
|
||||
{
|
||||
/**
|
||||
* Registers the tokens that this sniff wants to listen for.
|
||||
|
|
|
@ -11,13 +11,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\Sniffs\Namespaces;
|
||||
|
||||
use PHP_CodeSniffer\Files\File;
|
||||
use PHP_CodeSniffer\Sniffs\Sniff;
|
||||
|
||||
/**
|
||||
* Checks that each use statement is used.
|
||||
*/
|
||||
class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff
|
||||
class UnusedUseSniff implements Sniff
|
||||
{
|
||||
const FIND = [
|
||||
T_NS_SEPARATOR,
|
||||
|
@ -49,9 +51,20 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff
|
|||
$phpcsFile->addError($error, $stack_pointer, 'FullName');
|
||||
}
|
||||
|
||||
if ($found_name === $short_name)
|
||||
/*
|
||||
* Check for possible union types (like string|MyType|null)
|
||||
* and question mark nullable type syntax (like ?MyType)
|
||||
*/
|
||||
$types = explode('|', $found_name);
|
||||
foreach ($types as $type)
|
||||
{
|
||||
return true;
|
||||
// Nullable type syntax
|
||||
$type = (strpos($type, '?') === 0) ? substr($type, 1) : $type;
|
||||
|
||||
if ($short_name === $type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
<!-- There MUST not be more than one statement per line. -->
|
||||
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
|
||||
|
||||
<!-- Call-time pass-by-reference MUST not be used. -->
|
||||
<rule ref="Generic.Functions.CallTimePassByReference.NotAllowed" />
|
||||
|
||||
<!-- Filenames MUST be lowercase. -->
|
||||
<rule ref="Generic.Files.LowercasedFilename" />
|
||||
|
||||
|
|
|
@ -45,4 +45,8 @@
|
|||
<!-- There MUST NOT be unused use statements. -->
|
||||
<rule ref="./phpbb/Sniffs/Namespaces/UnusedUseSniff.php" />
|
||||
|
||||
<!-- The null type SHALL be the last union type element, other types SHALL follow alphabetical order.
|
||||
No nullable type shortcut syntax should be used. -->
|
||||
<rule ref="./phpbb/Sniffs/CodeLayout/UnionTypesCheckSniff.php" />
|
||||
|
||||
</ruleset>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"composer/package-versions-deprecated": "^1.11",
|
||||
"doctrine/dbal": "~3.3.6",
|
||||
"google/recaptcha": "~1.1",
|
||||
"guzzlehttp/guzzle": "~6.3",
|
||||
"guzzlehttp/guzzle": " ^7.0",
|
||||
"marc1706/fast-image-size": "^1.1",
|
||||
"minishlink/web-push": "^8.0",
|
||||
"s9e/text-formatter": "^2.0",
|
||||
|
|
134
phpBB/composer.lock
generated
134
phpBB/composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "96d8bdaa91db532b0a0bf5e1b6c0ec31",
|
||||
"content-hash": "5ed4369e5ba29297443f428dd3001fae",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bantu/ini-get-wrapper",
|
||||
|
@ -1700,37 +1700,47 @@
|
|||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "6.5.8",
|
||||
"version": "7.9.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "a52f0440530b54fa079ce76e8c5d196a42cad981"
|
||||
"reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/a52f0440530b54fa079ce76e8c5d196a42cad981",
|
||||
"reference": "a52f0440530b54fa079ce76e8c5d196a42cad981",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
|
||||
"reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"guzzlehttp/promises": "^1.0",
|
||||
"guzzlehttp/psr7": "^1.9",
|
||||
"php": ">=5.5",
|
||||
"symfony/polyfill-intl-idn": "^1.17"
|
||||
"guzzlehttp/promises": "^1.5.3 || ^2.0.3",
|
||||
"guzzlehttp/psr7": "^2.7.0",
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"psr/http-client": "^1.0",
|
||||
"symfony/deprecation-contracts": "^2.2 || ^3.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-client-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"ext-curl": "*",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
|
||||
"psr/log": "^1.1"
|
||||
"guzzle/client-integration-tests": "3.0.2",
|
||||
"php-http/message-factory": "^1.1",
|
||||
"phpunit/phpunit": "^8.5.39 || ^9.6.20",
|
||||
"psr/log": "^1.1 || ^2.0 || ^3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-curl": "Required for CURL handler support",
|
||||
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
|
||||
"psr/log": "Required for using the Log middleware"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.5-dev"
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -1783,19 +1793,20 @@
|
|||
}
|
||||
],
|
||||
"description": "Guzzle is a PHP HTTP client library",
|
||||
"homepage": "http://guzzlephp.org/",
|
||||
"keywords": [
|
||||
"client",
|
||||
"curl",
|
||||
"framework",
|
||||
"http",
|
||||
"http client",
|
||||
"psr-18",
|
||||
"psr-7",
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/guzzle/issues",
|
||||
"source": "https://github.com/guzzle/guzzle/tree/6.5.8"
|
||||
"source": "https://github.com/guzzle/guzzle/tree/7.9.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1811,33 +1822,37 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-06-20T22:16:07+00:00"
|
||||
"time": "2025-03-27T13:37:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
"version": "1.5.3",
|
||||
"version": "2.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/promises.git",
|
||||
"reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e"
|
||||
"reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/67ab6e18aaa14d753cc148911d273f6e6cb6721e",
|
||||
"reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c",
|
||||
"reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5"
|
||||
"php": "^7.2.5 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^4.4 || ^5.1"
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"phpunit/phpunit": "^8.5.39 || ^9.6.20"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\Promise\\": "src/"
|
||||
}
|
||||
|
@ -1874,7 +1889,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/promises/issues",
|
||||
"source": "https://github.com/guzzle/promises/tree/1.5.3"
|
||||
"source": "https://github.com/guzzle/promises/tree/2.2.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1890,42 +1905,48 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-05-21T12:31:43+00:00"
|
||||
"time": "2025-03-27T13:27:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "1.9.1",
|
||||
"version": "2.7.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b"
|
||||
"reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/e4490cabc77465aaee90b20cfc9a770f8c04be6b",
|
||||
"reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16",
|
||||
"reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"psr/http-message": "~1.0",
|
||||
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"psr/http-factory": "^1.0",
|
||||
"psr/http-message": "^1.1 || ^2.0",
|
||||
"ralouphie/getallheaders": "^3.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-factory-implementation": "1.0",
|
||||
"psr/http-message-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-zlib": "*",
|
||||
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"http-interop/http-factory-tests": "0.9.0",
|
||||
"phpunit/phpunit": "^8.5.39 || ^9.6.20"
|
||||
},
|
||||
"suggest": {
|
||||
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\Psr7\\": "src/"
|
||||
}
|
||||
|
@ -1964,6 +1985,11 @@
|
|||
"name": "Tobias Schultze",
|
||||
"email": "webmaster@tubo-world.de",
|
||||
"homepage": "https://github.com/Tobion"
|
||||
},
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com",
|
||||
"homepage": "https://sagikazarmark.hu"
|
||||
}
|
||||
],
|
||||
"description": "PSR-7 message implementation that also provides common utility methods",
|
||||
|
@ -1979,7 +2005,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/psr7/issues",
|
||||
"source": "https://github.com/guzzle/psr7/tree/1.9.1"
|
||||
"source": "https://github.com/guzzle/psr7/tree/2.7.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1995,7 +2021,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-04-17T16:00:37+00:00"
|
||||
"time": "2025-03-27T12:30:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "justinrainbow/json-schema",
|
||||
|
@ -2802,16 +2828,16 @@
|
|||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
"version": "1.1",
|
||||
"version": "2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-message.git",
|
||||
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba"
|
||||
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
|
||||
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
|
||||
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2820,7 +2846,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -2835,7 +2861,7 @@
|
|||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
"homepage": "https://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP messages",
|
||||
|
@ -2849,9 +2875,9 @@
|
|||
"response"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/php-fig/http-message/tree/1.1"
|
||||
"source": "https://github.com/php-fig/http-message/tree/2.0"
|
||||
},
|
||||
"time": "2023-04-04T09:50:52+00:00"
|
||||
"time": "2023-04-04T09:54:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
|
@ -9433,16 +9459,16 @@
|
|||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "3.12.2",
|
||||
"version": "3.13.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
|
||||
"reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa"
|
||||
"reference": "65ff2489553b83b4597e89c3b8b721487011d186"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa",
|
||||
"reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa",
|
||||
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/65ff2489553b83b4597e89c3b8b721487011d186",
|
||||
"reference": "65ff2489553b83b4597e89c3b8b721487011d186",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -9513,7 +9539,7 @@
|
|||
"type": "thanks_dev"
|
||||
}
|
||||
],
|
||||
"time": "2025-04-13T04:10:18+00:00"
|
||||
"time": "2025-05-11T03:36:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/browser-kit",
|
||||
|
|
|
@ -1746,29 +1746,33 @@ overall_header_body_before
|
|||
overall_header_breadcrumb_append
|
||||
===
|
||||
* Locations:
|
||||
+ styles/prosilver/template/navbar_header.html
|
||||
+ styles/prosilver/template/breadcrumbs.html
|
||||
* Since: 3.1.0-a1
|
||||
* Changed: 4.0.0-a1 Moved to breadcrumbs.html
|
||||
* Purpose: Add links to the list of breadcrumbs in the header
|
||||
|
||||
overall_header_breadcrumb_prepend
|
||||
===
|
||||
* Locations:
|
||||
+ styles/prosilver/template/navbar_header.html
|
||||
+ styles/prosilver/template/breadcrumbs.html
|
||||
* Since: 3.1.0-RC3
|
||||
* Changed: 4.0.0-a1 Moved to breadcrumbs.html
|
||||
* Purpose: Add links to the list of breadcrumbs in the header (after site-home, but before board-index)
|
||||
|
||||
overall_header_breadcrumbs_after
|
||||
===
|
||||
* Locations:
|
||||
+ styles/prosilver/template/navbar_header.html
|
||||
+ styles/prosilver/template/breadcrumbs.html
|
||||
* Since: 3.1.0-RC3
|
||||
* Changed: 4.0.0-a1 Moved to breadcrumbs.html
|
||||
* Purpose: Add content after the breadcrumbs (outside of the breadcrumbs container)
|
||||
|
||||
overall_header_breadcrumbs_before
|
||||
===
|
||||
* Locations:
|
||||
+ styles/prosilver/template/navbar_header.html
|
||||
+ styles/prosilver/template/breadcrumbs.html
|
||||
* Since: 3.1.0-RC3
|
||||
* Changed: 4.0.0-a1 Moved to breadcrumbs.html
|
||||
* Purpose: Add content before the breadcrumbs (outside of the breadcrumbs container)
|
||||
|
||||
overall_header_content_before
|
||||
|
@ -1830,15 +1834,17 @@ overall_header_navigation_prepend
|
|||
overall_header_navlink_append
|
||||
===
|
||||
* Locations:
|
||||
+ styles/prosilver/template/navbar_header.html
|
||||
+ styles/prosilver/template/breadcrumbs.html
|
||||
* Since: 3.1.0-b3
|
||||
* Changed: 4.0.0-a1 Moved to breadcrumbs.html
|
||||
* Purpose: Add content after each individual navlink (breadcrumb)
|
||||
|
||||
overall_header_navlink_prepend
|
||||
===
|
||||
* Locations:
|
||||
+ styles/prosilver/template/navbar_header.html
|
||||
+ styles/prosilver/template/breadcrumbs.html
|
||||
* Since: 3.1.0-b3
|
||||
* Changed: 4.0.0-a1 Moved to breadcrumbs.html
|
||||
* Purpose: Add content before each individual navlink (breadcrumb)
|
||||
|
||||
overall_header_page_body_before
|
||||
|
|
|
@ -475,6 +475,41 @@ class acp_profile
|
|||
$cp->vars[$key] = $var;
|
||||
}
|
||||
|
||||
// step 3 - all arrays
|
||||
if ($action == 'edit')
|
||||
{
|
||||
// Get language entries
|
||||
$sql = 'SELECT *
|
||||
FROM ' . PROFILE_FIELDS_LANG_TABLE . '
|
||||
WHERE lang_id <> ' . $this->edit_lang_id . "
|
||||
AND field_id = $field_id
|
||||
ORDER BY option_id ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$l_lang_options = [];
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$l_lang_options[$row['lang_id']][$row['option_id']] = $row['lang_value'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'SELECT lang_id, lang_name, lang_explain, lang_default_value
|
||||
FROM ' . PROFILE_LANG_TABLE . '
|
||||
WHERE lang_id <> ' . $this->edit_lang_id . "
|
||||
AND field_id = $field_id
|
||||
ORDER BY lang_id ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$l_lang_name = $l_lang_explain = $l_lang_default_value = [];
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$l_lang_name[$row['lang_id']] = $row['lang_name'];
|
||||
$l_lang_explain[$row['lang_id']] = $row['lang_explain'];
|
||||
$l_lang_default_value[$row['lang_id']] = $row['lang_default_value'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
foreach ($exclude[3] as $key)
|
||||
{
|
||||
$cp->vars[$key] = $request->variable($key, array(0 => ''), true);
|
||||
|
|
|
@ -130,7 +130,7 @@ function phpbb_gmgetdate($time = false)
|
|||
*
|
||||
* @return array|string data array if $string_only is false
|
||||
*/
|
||||
function get_formatted_filesize($value, bool $string_only = true, array $allowed_units = null)
|
||||
function get_formatted_filesize($value, bool $string_only = true, array|null $allowed_units = null)
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
@ -253,7 +253,7 @@ function still_on_time($extra_time = 15)
|
|||
* @return mixed Boolean (true, false) if comparison operator is specified.
|
||||
* Integer (-1, 0, 1) otherwise.
|
||||
*/
|
||||
function phpbb_version_compare(string $version1, string $version2, string $operator = null)
|
||||
function phpbb_version_compare(string $version1, string $version2, string|null $operator = null)
|
||||
{
|
||||
$version1 = strtolower($version1);
|
||||
$version2 = strtolower($version2);
|
||||
|
|
|
@ -215,7 +215,7 @@ function adm_back_link($u_action)
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
function build_select(array $options_ary, int|string|bool $option_default = false): array
|
||||
function build_select(array $options_ary, bool|int|string $option_default = false): array
|
||||
{
|
||||
global $language;
|
||||
|
||||
|
|
|
@ -680,7 +680,7 @@ switch ($mode)
|
|||
'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx") : '',
|
||||
|
||||
'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}&hash=" . generate_link_hash('switchperm')) : '',
|
||||
'U_EDIT_SELF' => ($user_id == $user->data['user_id'] && $auth->acl_get('u_chgprofileinfo')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_profile&mode=profile_info') : '',
|
||||
'U_EDIT_SELF' => ($user_id == $user->data['user_id'] && $auth->acl_get('u_chgprofileinfo')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_profile') : '',
|
||||
|
||||
'S_USER_NOTES' => ($user_notes_enabled) ? true : false,
|
||||
'S_WARN_USER' => ($warn_user_enabled) ? true : false,
|
||||
|
|
|
@ -82,7 +82,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
|
|||
* @param \phpbb\path_helper $path_helper phpBB path helper
|
||||
* @param \phpbb\cache\driver\driver_interface|null $cache Cache driver
|
||||
*/
|
||||
public function __construct(\phpbb\config\config $config, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\cache\driver\driver_interface $cache = null)
|
||||
public function __construct(\phpbb\config\config $config, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\cache\driver\driver_interface|null $cache = null)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->imagesize = $imagesize;
|
||||
|
|
|
@ -28,7 +28,7 @@ class email extends base
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get_user_column(): ?string
|
||||
public function get_user_column(): string|null
|
||||
{
|
||||
return 'user_email';
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class ip extends base
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get_user_column(): ?string
|
||||
public function get_user_column(): string|null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ interface type_interface
|
|||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function get_user_column(): ?string;
|
||||
public function get_user_column(): string|null;
|
||||
|
||||
/**
|
||||
* Sets a user object to the ban type to have it excluded
|
||||
|
|
|
@ -48,7 +48,7 @@ class class_loader
|
|||
* @param string $php_ext The file extension for PHP files
|
||||
* @param \phpbb\cache\driver\driver_interface|null $cache An implementation of the phpBB cache interface.
|
||||
*/
|
||||
public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null)
|
||||
public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface|null $cache = null)
|
||||
{
|
||||
if ($namespace[0] !== '\\')
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ class class_loader
|
|||
*
|
||||
* @param \phpbb\cache\driver\driver_interface|null $cache An implementation of the phpBB cache interface.
|
||||
*/
|
||||
public function set_cache(\phpbb\cache\driver\driver_interface $cache = null)
|
||||
public function set_cache(\phpbb\cache\driver\driver_interface|null $cache = null)
|
||||
{
|
||||
if ($cache)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ class runtime_exception extends base
|
|||
* @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining.
|
||||
* @param integer $code The Exception code.
|
||||
*/
|
||||
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
|
||||
public function __construct($prefix, $message = '', array $parameters = [], \Exception|null $previous = null, $code = 0)
|
||||
{
|
||||
parent::__construct($prefix . $message, $parameters, $previous, $code);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ class extension_manager extends manager
|
|||
* @param string $root_path phpBB root path
|
||||
* @param config|null $config Config object
|
||||
*/
|
||||
public function __construct(installer $installer, driver_interface $cache, ext_manager $extension_manager, filesystem $filesystem, $package_type, $exception_prefix, $root_path, config $config = null)
|
||||
public function __construct(installer $installer, driver_interface $cache, ext_manager $extension_manager, filesystem $filesystem, $package_type, $exception_prefix, $root_path, config|null $config = null)
|
||||
{
|
||||
$this->extension_manager = $extension_manager;
|
||||
$this->filesystem = $filesystem;
|
||||
|
@ -86,7 +86,7 @@ class extension_manager extends manager
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function pre_install(array $packages, IOInterface $io = null)
|
||||
public function pre_install(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
$installed_manually = array_intersect(array_keys($this->extension_manager->all_available()), array_keys($packages));
|
||||
if (count($installed_manually) !== 0)
|
||||
|
@ -98,7 +98,7 @@ class extension_manager extends manager
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function post_install(array $packages, IOInterface $io = null)
|
||||
public function post_install(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
if ($this->enable_on_install)
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ class extension_manager extends manager
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function pre_update(array $packages, IOInterface $io = null)
|
||||
protected function pre_update(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
/** @psalm-suppress InvalidArgument */
|
||||
$io->writeError([['DISABLING_EXTENSIONS', [], 1]]);
|
||||
|
@ -158,7 +158,7 @@ class extension_manager extends manager
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function post_update(array $packages, IOInterface $io = null)
|
||||
protected function post_update(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
/** @psalm-suppress InvalidArgument */
|
||||
$io->writeError([['ENABLING_EXTENSIONS', [], 1]]);
|
||||
|
@ -184,7 +184,7 @@ class extension_manager extends manager
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove(array $packages, IOInterface $io = null)
|
||||
public function remove(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
$packages = $this->normalize_version($packages);
|
||||
|
||||
|
@ -200,7 +200,7 @@ class extension_manager extends manager
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function pre_remove(array $packages, IOInterface $io = null)
|
||||
public function pre_remove(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
if ($this->purge_on_remove)
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ class installer
|
|||
* @param request $request phpBB request object
|
||||
* @param config|null $config Config object
|
||||
*/
|
||||
public function __construct($root_path, filesystem $filesystem, request $request, config $config = null)
|
||||
public function __construct($root_path, filesystem $filesystem, request $request, config|null $config = null)
|
||||
{
|
||||
if ($config)
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ class installer
|
|||
*
|
||||
* @throws runtime_exception
|
||||
*/
|
||||
public function install(array $packages, $whitelist, IOInterface $io = null)
|
||||
public function install(array $packages, $whitelist, IOInterface|null $io = null)
|
||||
{
|
||||
$this->wrap(function() use ($packages, $whitelist, $io) {
|
||||
$this->do_install($packages, $whitelist, $io);
|
||||
|
@ -155,7 +155,7 @@ class installer
|
|||
* @throws runtime_exception
|
||||
* @throws JsonValidationException
|
||||
*/
|
||||
protected function do_install(array $packages, $whitelist, io\io_interface $io = null)
|
||||
protected function do_install(array $packages, $whitelist, io\io_interface|null $io = null)
|
||||
{
|
||||
if (!$io)
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ class installer
|
|||
* @return Composer|PartialComposer
|
||||
* @throws JsonValidationException
|
||||
*/
|
||||
protected function get_composer(?string $config_file): PartialComposer
|
||||
protected function get_composer(string|null $config_file): PartialComposer
|
||||
{
|
||||
static $composer_factory;
|
||||
if (!$composer_factory)
|
||||
|
|
|
@ -46,7 +46,7 @@ class html_output_formatter extends \Composer\Console\HtmlOutputFormatter
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function format(?string $message): ?string
|
||||
public function format(string|null $message): string|null
|
||||
{
|
||||
$formatted = parent::format($message);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class web_io extends BufferIO implements io_interface
|
|||
* @param int $verbosity Verbosity level
|
||||
* @param OutputFormatterInterface|null $formatter Output formatter
|
||||
*/
|
||||
public function __construct(language $language, $input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
|
||||
public function __construct(language $language, $input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface|null $formatter = null)
|
||||
{
|
||||
$this->language = $language;
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class manager implements manager_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function install(array $packages, IOInterface $io = null)
|
||||
public function install(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
$packages = $this->normalize_version($packages);
|
||||
|
||||
|
@ -103,7 +103,7 @@ class manager implements manager_interface
|
|||
* Each entry may be a name or an array associating a version constraint to a name
|
||||
* @param IOInterface|null $io IO object used for the output
|
||||
*/
|
||||
protected function pre_install(array $packages, IOInterface $io = null)
|
||||
protected function pre_install(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -114,14 +114,14 @@ class manager implements manager_interface
|
|||
* Each entry may be a name or an array associating a version constraint to a name
|
||||
* @param IOInterface|null $io IO object used for the output
|
||||
*/
|
||||
protected function post_install(array $packages, IOInterface $io = null)
|
||||
protected function post_install(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function update(array $packages, IOInterface $io = null)
|
||||
public function update(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
$packages = $this->normalize_version($packages);
|
||||
|
||||
|
@ -148,7 +148,7 @@ class manager implements manager_interface
|
|||
* Each entry may be a name or an array associating a version constraint to a name
|
||||
* @param IOInterface|null $io IO object used for the output
|
||||
*/
|
||||
protected function pre_update(array $packages, IOInterface $io = null)
|
||||
protected function pre_update(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -159,14 +159,14 @@ class manager implements manager_interface
|
|||
* Each entry may be a name or an array associating a version constraint to a name
|
||||
* @param IOInterface|null $io IO object used for the output
|
||||
*/
|
||||
protected function post_update(array $packages, IOInterface $io = null)
|
||||
protected function post_update(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove(array $packages, IOInterface $io = null)
|
||||
public function remove(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
$packages = $this->normalize_version($packages);
|
||||
|
||||
|
@ -195,7 +195,7 @@ class manager implements manager_interface
|
|||
* Each entry may be a name or an array associating a version constraint to a name
|
||||
* @param IOInterface|null $io IO object used for the output
|
||||
*/
|
||||
protected function pre_remove(array $packages, IOInterface $io = null)
|
||||
protected function pre_remove(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ class manager implements manager_interface
|
|||
* Each entry may be a name or an array associating a version constraint to a name
|
||||
* @param IOInterface|null $io IO object used for the output
|
||||
*/
|
||||
protected function post_remove(array $packages, IOInterface $io = null)
|
||||
protected function post_remove(array $packages, IOInterface|null $io = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ interface manager_interface
|
|||
*
|
||||
* @throws runtime_exception
|
||||
*/
|
||||
public function install(array $packages, IOInterface $io = null);
|
||||
public function install(array $packages, IOInterface|null $io = null);
|
||||
|
||||
/**
|
||||
* Updates or installs a set of packages
|
||||
|
@ -41,7 +41,7 @@ interface manager_interface
|
|||
*
|
||||
* @throws runtime_exception
|
||||
*/
|
||||
public function update(array $packages, IOInterface $io = null);
|
||||
public function update(array $packages, IOInterface|null $io = null);
|
||||
|
||||
/**
|
||||
* Removes a set of packages
|
||||
|
@ -52,7 +52,7 @@ interface manager_interface
|
|||
*
|
||||
* @throws runtime_exception
|
||||
*/
|
||||
public function remove(array $packages, IOInterface $io = null);
|
||||
public function remove(array $packages, IOInterface|null $io = null);
|
||||
|
||||
/**
|
||||
* Tells whether or not a package is managed by Composer.
|
||||
|
|
|
@ -53,7 +53,7 @@ class resolver implements ControllerResolverInterface
|
|||
* @param string $phpbb_root_path Relative path to phpBB root
|
||||
* @param \phpbb\template\template|null $template
|
||||
*/
|
||||
public function __construct(ContainerInterface $container, $phpbb_root_path, \phpbb\template\template $template = null)
|
||||
public function __construct(ContainerInterface $container, $phpbb_root_path, \phpbb\template\template|null $template = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->template = $template;
|
||||
|
|
|
@ -42,7 +42,7 @@ class datetime extends \DateTime
|
|||
* @param string $time String in a format accepted by strtotime().
|
||||
* @param \DateTimeZone|null $timezone Time zone of the time.
|
||||
*/
|
||||
public function __construct($user, $time = 'now', \DateTimeZone $timezone = null)
|
||||
public function __construct($user, $time = 'now', \DateTimeZone|null $timezone = null)
|
||||
{
|
||||
$this->user = $user;
|
||||
$timezone = $timezone ?: $this->user->timezone;
|
||||
|
|
|
@ -73,10 +73,10 @@ class connection_factory
|
|||
public static function get_connection_from_params(
|
||||
string $driver,
|
||||
string $host,
|
||||
?string $user = null,
|
||||
?string $password = null,
|
||||
?string $name = null,
|
||||
?string $port = null): Connection
|
||||
string|null $user = null,
|
||||
string|null $password = null,
|
||||
string|null $name = null,
|
||||
string|null $port = null): Connection
|
||||
{
|
||||
$available_drivers = DriverManager::getAvailableDrivers();
|
||||
if (!in_array($driver, $available_drivers))
|
||||
|
|
|
@ -37,11 +37,11 @@ class connection_parameter_factory
|
|||
*/
|
||||
public static function get_configuration(
|
||||
string $driver,
|
||||
?string $host = null,
|
||||
?string $user = null,
|
||||
?string $password = null,
|
||||
?string $name = null,
|
||||
?string $port = null) : array
|
||||
string|null $host = null,
|
||||
string|null $user = null,
|
||||
string|null $password = null,
|
||||
string|null $name = null,
|
||||
string|null $port = null) : array
|
||||
{
|
||||
$params = [
|
||||
'driver' => $driver,
|
||||
|
@ -73,11 +73,11 @@ class connection_parameter_factory
|
|||
*/
|
||||
private static function build_connection_parameters(
|
||||
array $params,
|
||||
?string $host = null,
|
||||
?string $user = null,
|
||||
?string $password = null,
|
||||
?string $name = null,
|
||||
?string $port = null) : array
|
||||
string|null $host = null,
|
||||
string|null $user = null,
|
||||
string|null $password = null,
|
||||
string|null $name = null,
|
||||
string|null $port = null) : array
|
||||
{
|
||||
if ($params['driver'] === 'pdo_sqlite')
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ class connection_parameter_factory
|
|||
*
|
||||
* @return array Doctrine's DBAL configuration for SQLite.
|
||||
*/
|
||||
private static function build_sqlite_parameters(array $params, string $path, ?string $user, ?string $password) : array
|
||||
private static function build_sqlite_parameters(array $params, string $path, string|null $user, string|null $password) : array
|
||||
{
|
||||
$params['path'] = $path;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ abstract class container_aware_migration extends migration implements ContainerA
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
public function setContainer(ContainerInterface|null $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class remove_jabber extends migration
|
|||
];
|
||||
}
|
||||
|
||||
public function move_jabber_to_email_notifications(?int $start)
|
||||
public function move_jabber_to_email_notifications(int|null $start)
|
||||
{
|
||||
$limit = 1000;
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ class schema_generator
|
|||
* @param mixed $data Array of values to be set.
|
||||
* @param callable|null $value_transform Callback to transform the value being set.
|
||||
*/
|
||||
private static function set_all(&$schema, $data, ?callable $value_transform = null)
|
||||
private static function set_all(&$schema, $data, callable|null $value_transform = null)
|
||||
{
|
||||
$data = (!is_array($data)) ? [$data] : $data;
|
||||
foreach ($data as $key => $change)
|
||||
|
@ -317,7 +317,7 @@ class schema_generator
|
|||
*
|
||||
* @return Closure|null The value transformation callback or null if it is not needed.
|
||||
*/
|
||||
private static function get_value_transform(string $change_type, string $schema_type) : ?Closure
|
||||
private static function get_value_transform(string $change_type, string $schema_type) : Closure|null
|
||||
{
|
||||
if ($change_type !== 'add')
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ class error_handler extends ErrorHandler
|
|||
/**
|
||||
* @psalm-suppress MethodSignatureMismatch
|
||||
*/
|
||||
public function __construct(BufferingLogger $bootstrappingLogger = null, private readonly bool $debug = false) // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found
|
||||
public function __construct(BufferingLogger|null $bootstrappingLogger = null, private readonly bool $debug = false) // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found
|
||||
{
|
||||
parent::__construct($bootstrappingLogger, $debug);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class dispatcher extends EventDispatcher implements dispatcher_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dispatch(object $event, string $eventName = null) : object
|
||||
public function dispatch(object $event, string|null $eventName = null) : object
|
||||
{
|
||||
if ($this->disabled)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ class recursive_event_filter_iterator extends \RecursiveFilterIterator
|
|||
*
|
||||
* @return recursive_event_filter_iterator
|
||||
*/
|
||||
public function getChildren(): ?\RecursiveFilterIterator
|
||||
public function getChildren(): \RecursiveFilterIterator|null
|
||||
{
|
||||
$inner_iterator = $this->getInnerIterator();
|
||||
assert($inner_iterator instanceof \RecursiveIterator);
|
||||
|
|
|
@ -44,7 +44,7 @@ class http_exception extends runtime_exception implements HttpExceptionInterface
|
|||
* @param array $headers Additional headers to set in the response.
|
||||
* @param integer $code The Exception code.
|
||||
*/
|
||||
public function __construct($status_code, $message = "", array $parameters = array(), \Exception $previous = null, array $headers = array(), $code = 0)
|
||||
public function __construct($status_code, $message = "", array $parameters = array(), \Exception|null $previous = null, array $headers = array(), $code = 0)
|
||||
{
|
||||
$this->status_code = $status_code;
|
||||
$this->headers = $headers;
|
||||
|
|
|
@ -35,7 +35,7 @@ class runtime_exception extends \RuntimeException implements exception_interface
|
|||
* @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining.
|
||||
* @param integer $code The Exception code.
|
||||
*/
|
||||
public function __construct($message = "", array $parameters = array(), \Exception $previous = null, $code = 0)
|
||||
public function __construct($message = "", array $parameters = array(), \Exception|null $previous = null, $code = 0)
|
||||
{
|
||||
$this->parameters = $parameters;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class manager
|
|||
* @param \phpbb\cache\service|null $cache A cache instance or null
|
||||
* @param string $cache_name The name of the cache variable, defaults to _ext
|
||||
*/
|
||||
public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, finder_factory $finder_factory, $extension_table, $phpbb_root_path, \phpbb\cache\service $cache = null, $cache_name = '_ext')
|
||||
public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, finder_factory $finder_factory, $extension_table, $phpbb_root_path, \phpbb\cache\service|null $cache = null, $cache_name = '_ext')
|
||||
{
|
||||
$this->cache = $cache;
|
||||
$this->cache_name = $cache_name;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace phpbb\feed\exception;
|
|||
|
||||
class no_feed_exception extends feed_unavailable_exception
|
||||
{
|
||||
public function __construct(\Exception $previous = null, $code = 0)
|
||||
public function __construct(\Exception|null $previous = null, $code = 0)
|
||||
{
|
||||
parent::__construct('NO_FEED', array(), $previous, $code);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace phpbb\feed\exception;
|
|||
|
||||
class no_forum_exception extends feed_unavailable_exception
|
||||
{
|
||||
public function __construct($forum_id, \Exception $previous = null, $code = 0)
|
||||
public function __construct($forum_id, \Exception|null $previous = null, $code = 0)
|
||||
{
|
||||
parent::__construct('NO_FORUM', array($forum_id), $previous, $code);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace phpbb\feed\exception;
|
|||
|
||||
class no_topic_exception extends feed_unavailable_exception
|
||||
{
|
||||
public function __construct($topic_id, \Exception $previous = null, $code = 0)
|
||||
public function __construct($topic_id, \Exception|null $previous = null, $code = 0)
|
||||
{
|
||||
parent::__construct('NO_TOPIC', array($topic_id), $previous, $code);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace phpbb\feed\exception;
|
|||
|
||||
class unauthorized_forum_exception extends unauthorized_exception
|
||||
{
|
||||
public function __construct($forum_id, \Exception $previous = null, $code = 0)
|
||||
public function __construct($forum_id, \Exception|null $previous = null, $code = 0)
|
||||
{
|
||||
parent::__construct('SORRY_AUTH_READ', array($forum_id), $previous, $code);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace phpbb\feed\exception;
|
|||
|
||||
class unauthorized_topic_exception extends unauthorized_exception
|
||||
{
|
||||
public function __construct($topic_id, \Exception $previous = null, $code = 0)
|
||||
public function __construct($topic_id, \Exception|null $previous = null, $code = 0)
|
||||
{
|
||||
parent::__construct('SORRY_AUTH_READ_TOPIC', array($topic_id), $previous, $code);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class filespec
|
|||
* @param \phpbb\mimetype\guesser|null $mimetype_guesser Mime type guesser
|
||||
* @param \phpbb\plupload\plupload|null $plupload Plupload
|
||||
*/
|
||||
public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
|
||||
public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, \phpbb\mimetype\guesser|null $mimetype_guesser = null, \phpbb\plupload\plupload|null $plupload = null)
|
||||
{
|
||||
$this->filesystem = $phpbb_filesystem;
|
||||
$this->language = $language;
|
||||
|
|
|
@ -86,7 +86,7 @@ class filespec_storage
|
|||
* @param \phpbb\mimetype\guesser|null $mimetype_guesser Mime type guesser
|
||||
* @param \phpbb\plupload\plupload|null $plupload Plupload
|
||||
*/
|
||||
public function __construct(language $language, \FastImageSize\FastImageSize $imagesize, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
|
||||
public function __construct(language $language, \FastImageSize\FastImageSize $imagesize, \phpbb\mimetype\guesser|null $mimetype_guesser = null, \phpbb\plupload\plupload|null $plupload = null)
|
||||
{
|
||||
$this->language = $language;
|
||||
$this->imagesize = $imagesize;
|
||||
|
|
|
@ -26,7 +26,7 @@ class filesystem_exception extends runtime_exception
|
|||
* @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining.
|
||||
* @param integer $code The Exception code.
|
||||
*/
|
||||
public function __construct($message = '', $filename = '', $parameters = array(), \Exception $previous = null, $code = 0)
|
||||
public function __construct($message = '', $filename = '', $parameters = array(), \Exception|null $previous = null, $code = 0)
|
||||
{
|
||||
parent::__construct($message, array_merge(array('filename' => $filename), $parameters), $previous, $code);
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ class filesystem implements filesystem_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function mirror($origin_dir, $target_dir, \Traversable $iterator = null, $options = array())
|
||||
public function mirror($origin_dir, $target_dir, \Traversable|null $iterator = null, $options = array())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -190,7 +190,7 @@ interface filesystem_interface
|
|||
* The filename which triggered the error can be
|
||||
* retrieved by filesystem_exception::get_filename()
|
||||
*/
|
||||
public function mirror($origin_dir, $target_dir, \Traversable $iterator = null, $options = array());
|
||||
public function mirror($origin_dir, $target_dir, \Traversable|null $iterator = null, $options = array());
|
||||
|
||||
/**
|
||||
* Creates a directory recursively.
|
||||
|
|
|
@ -33,7 +33,7 @@ class factory
|
|||
* @param string $phpbb_root_path Path to the phpbb root directory
|
||||
* @param string $php_ext php file extension
|
||||
*/
|
||||
public function __construct(?service $cache, bool $use_cache, string $phpbb_root_path, string $php_ext)
|
||||
public function __construct(service|null $cache, bool $use_cache, string $phpbb_root_path, string $php_ext)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
$this->use_cache = $use_cache;
|
||||
|
|
|
@ -58,7 +58,7 @@ class finder
|
|||
* @param string $cache_name The name of the cache variable, defaults to
|
||||
* _ext_finder
|
||||
*/
|
||||
public function __construct(?service $cache, bool $use_cache, string $phpbb_root_path, string $php_ext, string $cache_name = '_ext_finder')
|
||||
public function __construct(service|null $cache, bool $use_cache, string $phpbb_root_path, string $php_ext, string $cache_name = '_ext_finder')
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->cache = $cache;
|
||||
|
|
|
@ -52,7 +52,7 @@ class form_helper
|
|||
*
|
||||
* @return array Array containing form_token and creation_time of form token
|
||||
*/
|
||||
public function get_form_tokens(string $form_name, ?int &$now = 0, ?string &$token_sid = '', ?string &$token = ''): array
|
||||
public function get_form_tokens(string $form_name, int|null &$now = 0, string|null &$token_sid = '', string|null &$token = ''): array
|
||||
{
|
||||
$now = time();
|
||||
$token_sid = ($this->user->data['user_id'] == ANONYMOUS && !empty($this->config['form_token_sid_guests'])) ? $this->user->session_id : '';
|
||||
|
@ -71,7 +71,7 @@ class form_helper
|
|||
* @param int|null $timespan Lifetime of token or null if default value should be used
|
||||
* @return bool True if form token is valid, false if not
|
||||
*/
|
||||
public function check_form_tokens(string $form_name, ?int $timespan = null): bool
|
||||
public function check_form_tokens(string $form_name, int|null $timespan = null): bool
|
||||
{
|
||||
if ($timespan === null)
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ abstract class database_task extends task_base
|
|||
*
|
||||
* @return Result|null Result of the query.
|
||||
*/
|
||||
protected function query(string $sql) : ?Result
|
||||
protected function query(string $sql) : Result|null
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ abstract class database_task extends task_base
|
|||
*
|
||||
* @return Statement|null The prepared statement object or null if preparing failed
|
||||
*/
|
||||
protected function create_prepared_stmt(string $sql): ?Statement
|
||||
protected function create_prepared_stmt(string $sql): Statement|null
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ abstract class database_task extends task_base
|
|||
*
|
||||
* @return int|null The last insert ID.
|
||||
*/
|
||||
protected function get_last_insert_id() : ?int
|
||||
protected function get_last_insert_id() : int|null
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ trait sequential_task
|
|||
*
|
||||
* @throws resource_limit_reached_exception When resources are exhausted.
|
||||
*/
|
||||
protected function execute(config $config, array $data, ?string $counter_name = null) : void
|
||||
protected function execute(config $config, array $data, string|null $counter_name = null) : void
|
||||
{
|
||||
if ($counter_name === null)
|
||||
{
|
||||
|
|
|
@ -119,8 +119,8 @@ abstract class base implements messenger_interface
|
|||
user $user,
|
||||
string $phpbb_root_path,
|
||||
string $template_cache_path,
|
||||
?manager $ext_manager = null,
|
||||
?log_interface $log = null
|
||||
manager|null $ext_manager = null,
|
||||
log_interface|null $log = null
|
||||
)
|
||||
{
|
||||
$this->assets_bag = $assets_bag;
|
||||
|
@ -469,7 +469,7 @@ abstract class base implements messenger_interface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_template_paths(string|array $path_name, string|array $paths): void
|
||||
protected function set_template_paths(array|string $path_name, array|string $paths): void
|
||||
{
|
||||
$this->setup_template();
|
||||
$this->template->set_custom_style($path_name, $paths);
|
||||
|
|
|
@ -91,7 +91,7 @@ class email extends messenger_base
|
|||
* method additionally checks if the type provides an email template.
|
||||
* @return bool
|
||||
*/
|
||||
public function is_available(type_interface $notification_type = null)
|
||||
public function is_available(type_interface|null $notification_type = null)
|
||||
{
|
||||
return parent::is_available($notification_type) && $this->config['email_enable'] && !empty($this->user->data['user_email']);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
|
|||
* only if the type is provided and if it doesn't provide an email template.
|
||||
* @return bool
|
||||
*/
|
||||
public function is_available(type_interface $notification_type = null)
|
||||
public function is_available(type_interface|null $notification_type = null)
|
||||
{
|
||||
return $notification_type === null || $notification_type->get_email_template() !== false;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class webpush extends base implements extended_method_interface
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function is_available(type_interface $notification_type = null): bool
|
||||
public function is_available(type_interface|null $notification_type = null): bool
|
||||
{
|
||||
return $this->config['webpush_enable']
|
||||
&& $this->config['webpush_vapid_public']
|
||||
|
|
|
@ -57,7 +57,7 @@ class request implements request_interface
|
|||
* Initialises the request class, that means it stores all input data in {@link $input input}
|
||||
* and then calls {@link \phpbb\request\deactivated_super_global \phpbb\request\deactivated_super_global}
|
||||
*/
|
||||
public function __construct(\phpbb\request\type_cast_helper_interface $type_cast_helper = null, $disable_super_globals = true)
|
||||
public function __construct(\phpbb\request\type_cast_helper_interface|null $type_cast_helper = null, $disable_super_globals = true)
|
||||
{
|
||||
if ($type_cast_helper)
|
||||
{
|
||||
|
@ -70,12 +70,12 @@ class request implements request_interface
|
|||
|
||||
foreach ($this->super_globals as $const => $super_global)
|
||||
{
|
||||
$this->input[$const] = isset($GLOBALS[$super_global]) ? $GLOBALS[$super_global] : array();
|
||||
$this->input[$const] = isset($GLOBALS[$super_global]) ? (array) $GLOBALS[$super_global] : array();
|
||||
}
|
||||
|
||||
// simulate request_order = GP
|
||||
$this->original_request = $this->input[request_interface::REQUEST];
|
||||
$this->input[request_interface::REQUEST] = $this->input[request_interface::POST] + $this->input[request_interface::GET];
|
||||
$this->original_request = (array) $this->input[request_interface::REQUEST];
|
||||
$this->input[request_interface::REQUEST] = (array) $this->input[request_interface::POST] + (array) $this->input[request_interface::GET];
|
||||
|
||||
if ($disable_super_globals)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ class loader_resolver implements LoaderResolverInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resolve($resource, $type = null): false|\Symfony\Component\Config\Loader\LoaderInterface
|
||||
public function resolve($resource, $type = null): \Symfony\Component\Config\Loader\LoaderInterface|false
|
||||
{
|
||||
/** @var \Symfony\Component\Config\Loader\LoaderInterface $loader */
|
||||
foreach ($this->loaders as $loader)
|
||||
|
|
|
@ -48,7 +48,7 @@ class default_resources_locator implements resources_locator_interface
|
|||
* @param string $environment Name of the current environment
|
||||
* @param manager|null $extension_manager Extension manager
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $environment, manager $extension_manager = null)
|
||||
public function __construct($phpbb_root_path, $environment, manager|null $extension_manager = null)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->environment = $environment;
|
||||
|
|
|
@ -112,10 +112,16 @@ abstract class base implements search_backend_interface
|
|||
}
|
||||
}
|
||||
|
||||
// If the sort direction differs from the direction in the cache, then reverse the ids array
|
||||
// If the sort direction differs from the direction in the cache, then recalculate array keys
|
||||
if ($reverse_ids)
|
||||
{
|
||||
$stored_ids = array_reverse($stored_ids);
|
||||
$keys = array_keys($stored_ids);
|
||||
array_walk($keys, function (&$value, $key) use ($result_count)
|
||||
{
|
||||
$value = ($value >= 0) ? $result_count - $value - 1 : $value;
|
||||
}
|
||||
);
|
||||
$stored_ids = array_combine($keys, $stored_ids);
|
||||
}
|
||||
|
||||
for ($i = $start, $n = $start + $per_page; ($i < $n) && ($i < $result_count); $i++)
|
||||
|
@ -166,6 +172,8 @@ abstract class base implements search_backend_interface
|
|||
}
|
||||
|
||||
$store_ids = array_slice($id_ary, 0, $length);
|
||||
$id_range = range($start, $start + $length - 1);
|
||||
$store_ids = array_combine($id_range, $store_ids);
|
||||
|
||||
// create a new resultset if there is none for this search_key yet
|
||||
// or add the ids to the existing resultset
|
||||
|
@ -200,29 +208,26 @@ abstract class base implements search_backend_interface
|
|||
$this->db->sql_query($sql);
|
||||
|
||||
$store = array(-1 => $result_count, -2 => $sort_dir);
|
||||
$id_range = range($start, $start + $length - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we use one set of results for both sort directions so we have to calculate the indizes
|
||||
// for the reversed array and we also have to reverse the ids themselves
|
||||
// for the reversed array
|
||||
if ($store[-2] != $sort_dir)
|
||||
{
|
||||
$store_ids = array_reverse($store_ids);
|
||||
$id_range = range($store[-1] - $start - $length, $store[-1] - $start - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$id_range = range($start, $start + $length - 1);
|
||||
$keys = array_keys($store_ids);
|
||||
array_walk($keys, function (&$value, $key) use ($store) {
|
||||
$value = $store[-1] - $value - 1;
|
||||
});
|
||||
$store_ids = array_combine($keys, $store_ids);
|
||||
}
|
||||
}
|
||||
|
||||
$store_ids = array_combine($id_range, $store_ids);
|
||||
|
||||
// append the ids
|
||||
if (is_array($store_ids))
|
||||
{
|
||||
$store += $store_ids;
|
||||
ksort($store);
|
||||
|
||||
// if the cache is too big
|
||||
if (count($store) - 2 > 20 * $this->config['search_block_size'])
|
||||
|
@ -316,7 +321,7 @@ abstract class base implements search_backend_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create_index(int &$post_counter = 0): ?array
|
||||
public function create_index(int &$post_counter = 0): array|null
|
||||
{
|
||||
$max_post_id = $this->get_max_post_id();
|
||||
$forums_indexing_enabled = $this->forum_ids_with_indexing_enabled();
|
||||
|
@ -377,7 +382,7 @@ abstract class base implements search_backend_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete_index(int &$post_counter = null): ?array
|
||||
public function delete_index(int|null &$post_counter = null): array|null
|
||||
{
|
||||
$max_post_id = $this->get_max_post_id();
|
||||
|
||||
|
|
|
@ -550,7 +550,6 @@ class fulltext_mysql extends base implements search_backend_interface
|
|||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
// if the total result count is not cached yet, retrieve it from the db
|
||||
if (!$result_count && count($id_ary))
|
||||
{
|
||||
|
@ -576,10 +575,10 @@ class fulltext_mysql extends base implements search_backend_interface
|
|||
$id_ary[] = (int) $row[$field];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
}
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
|
||||
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
||||
$this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
||||
|
@ -758,6 +757,8 @@ class fulltext_mysql extends base implements search_backend_interface
|
|||
// Build the query for really selecting the post_ids
|
||||
if ($type == 'posts')
|
||||
{
|
||||
// For sorting by non-unique columns, add unique sort key to avoid duplicated rows in results
|
||||
$sql_sort .= ', p.post_id' . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
||||
$sql = "SELECT $sql_select
|
||||
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . "
|
||||
WHERE $sql_author
|
||||
|
@ -821,10 +822,10 @@ class fulltext_mysql extends base implements search_backend_interface
|
|||
$id_ary[] = (int) $row[$field];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
}
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
|
||||
if (count($id_ary))
|
||||
{
|
||||
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||
|
@ -912,7 +913,7 @@ class fulltext_mysql extends base implements search_backend_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create_index(int &$post_counter = 0): ?array
|
||||
public function create_index(int &$post_counter = 0): array|null
|
||||
{
|
||||
// Make sure we can actually use MySQL with fulltext indexes
|
||||
if ($error = $this->init())
|
||||
|
@ -984,7 +985,7 @@ class fulltext_mysql extends base implements search_backend_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete_index(int &$post_counter = null): ?array
|
||||
public function delete_index(int|null &$post_counter = null): array|null
|
||||
{
|
||||
// Make sure we can actually use MySQL with fulltext indexes
|
||||
if ($error = $this->init())
|
||||
|
|
|
@ -1004,6 +1004,8 @@ class fulltext_native extends base implements search_backend_interface
|
|||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
|
||||
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
||||
$this->save_ids($search_key, $this->search_query, $author_ary, $total_results, $id_ary, $start, $sort_dir);
|
||||
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
||||
|
@ -1225,6 +1227,8 @@ class fulltext_native extends base implements search_backend_interface
|
|||
// Build the query for really selecting the post_ids
|
||||
if ($type == 'posts')
|
||||
{
|
||||
// For sorting by non-unique columns, add unique sort key to avoid duplicated rows in results
|
||||
$sql_sort .= ', p.post_id' . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
||||
$sql = "SELECT $select
|
||||
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t' : '') . "
|
||||
WHERE $sql_author
|
||||
|
@ -1289,6 +1293,8 @@ class fulltext_native extends base implements search_backend_interface
|
|||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
|
||||
if (count($id_ary))
|
||||
{
|
||||
$this->save_ids($search_key, '', $author_ary, $total_results, $id_ary, $start, $sort_dir);
|
||||
|
@ -1621,7 +1627,7 @@ class fulltext_native extends base implements search_backend_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete_index(int &$post_counter = null): ?array
|
||||
public function delete_index(int|null &$post_counter = null): array|null
|
||||
{
|
||||
$truncate_tables = [
|
||||
$this->search_wordlist_table,
|
||||
|
|
|
@ -478,8 +478,6 @@ class fulltext_postgres extends base implements search_backend_interface
|
|||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
|
||||
// if the total result count is not cached yet, retrieve it from the db
|
||||
if (!$result_count)
|
||||
{
|
||||
|
@ -509,10 +507,10 @@ class fulltext_postgres extends base implements search_backend_interface
|
|||
$id_ary[] = $row[$field];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
}
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
|
||||
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
||||
$this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
||||
|
@ -683,6 +681,8 @@ class fulltext_postgres extends base implements search_backend_interface
|
|||
// Build the query for really selecting the post_ids
|
||||
if ($type == 'posts')
|
||||
{
|
||||
// For sorting by non-unique columns, add unique sort key to avoid duplicated rows in results
|
||||
$sql_sort .= ', p.post_id' . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
||||
$sql = "SELECT p.post_id
|
||||
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . "
|
||||
WHERE $sql_author
|
||||
|
@ -775,10 +775,10 @@ class fulltext_postgres extends base implements search_backend_interface
|
|||
$id_ary[] = (int) $row[$field];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
}
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
|
||||
if (count($id_ary))
|
||||
{
|
||||
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||
|
@ -867,7 +867,7 @@ class fulltext_postgres extends base implements search_backend_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create_index(int &$post_counter = 0): ?array
|
||||
public function create_index(int &$post_counter = 0): array|null
|
||||
{
|
||||
// Make sure we can actually use PostgreSQL with fulltext indexes
|
||||
if ($error = $this->init())
|
||||
|
@ -926,7 +926,7 @@ class fulltext_postgres extends base implements search_backend_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete_index(int &$post_counter = null): ?array
|
||||
public function delete_index(int|null &$post_counter = null): array|null
|
||||
{
|
||||
// Make sure we can actually use PostgreSQL with fulltext indexes
|
||||
if ($error = $this->init())
|
||||
|
|
|
@ -629,7 +629,7 @@ class fulltext_sphinx implements search_backend_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create_index(int &$post_counter = 0): ?array
|
||||
public function create_index(int &$post_counter = 0): array|null
|
||||
{
|
||||
if (!$this->index_created())
|
||||
{
|
||||
|
@ -656,7 +656,7 @@ class fulltext_sphinx implements search_backend_interface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete_index(int &$post_counter = null): ?array
|
||||
public function delete_index(int|null &$post_counter = null): array|null
|
||||
{
|
||||
if ($this->index_created())
|
||||
{
|
||||
|
|
|
@ -163,7 +163,7 @@ interface search_backend_interface
|
|||
* @param int $post_counter
|
||||
* @return array|null array with current status or null if finished
|
||||
*/
|
||||
public function create_index(int &$post_counter = 0): ?array;
|
||||
public function create_index(int &$post_counter = 0): array|null;
|
||||
|
||||
/**
|
||||
* Drop fulltext index
|
||||
|
@ -171,7 +171,7 @@ interface search_backend_interface
|
|||
* @param int $post_counter
|
||||
* @return array|null array with current status or null if finished
|
||||
*/
|
||||
public function delete_index(int &$post_counter = 0): ?array;
|
||||
public function delete_index(int &$post_counter = 0): array|null;
|
||||
|
||||
/**
|
||||
* Returns true if both FULLTEXT indexes exist
|
||||
|
|
|
@ -28,7 +28,7 @@ class config
|
|||
* @param string $name The name of the section that shall be returned
|
||||
* @return config_section|null The section object or null if none was found
|
||||
*/
|
||||
public function get_section_by_name(string $name): ?config_section
|
||||
public function get_section_by_name(string $name): config_section|null
|
||||
{
|
||||
for ($i = 0, $size = count($this->sections); $i < $size; $i++)
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ class config_section extends config_item
|
|||
* @return config_variable|null The first variable object from this section with the
|
||||
* given name or null if none was found
|
||||
*/
|
||||
public function get_variable_by_name(string $name): ?config_variable
|
||||
public function get_variable_by_name(string $name): config_variable|null
|
||||
{
|
||||
for ($i = 0, $size = count($this->variables); $i < $size; $i++)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ class storage_exception extends runtime_exception
|
|||
* @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining
|
||||
* @param integer $code The Exception code
|
||||
*/
|
||||
public function __construct($message = '', $filename = '', $parameters = [], \Exception $previous = null, $code = 0)
|
||||
public function __construct($message = '', $filename = '', $parameters = [], \Exception|null $previous = null, $code = 0)
|
||||
{
|
||||
parent::__construct($message, array_merge(array('filename' => $filename), $parameters), $previous, $code);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class environment extends \Twig\Environment
|
|||
* @param dispatcher_interface|null $phpbb_dispatcher Event dispatcher object
|
||||
* @param array $options Array of options to pass to Twig
|
||||
*/
|
||||
public function __construct(assets_bag $assets_bag, config $phpbb_config, filesystem $filesystem, path_helper $path_helper, $cache_path, manager $extension_manager = null, LoaderInterface $loader = null, dispatcher_interface $phpbb_dispatcher = null, $options = array())
|
||||
public function __construct(assets_bag $assets_bag, config $phpbb_config, filesystem $filesystem, path_helper $path_helper, $cache_path, manager|null $extension_manager = null, LoaderInterface|null $loader = null, dispatcher_interface|null $phpbb_dispatcher = null, $options = array())
|
||||
{
|
||||
$this->phpbb_config = $phpbb_config;
|
||||
|
||||
|
@ -271,7 +271,7 @@ class environment extends \Twig\Environment
|
|||
* @return \Twig\Template A template instance representing the given template name
|
||||
* @throws \Twig\Error\LoaderError
|
||||
*/
|
||||
public function loadTemplate(string $cls, string $name, int $index = null) : \Twig\Template
|
||||
public function loadTemplate(string $cls, string $name, int|null $index = null) : \Twig\Template
|
||||
{
|
||||
if (strpos($name, '@') === false)
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ class avatar extends AbstractExtension
|
|||
*
|
||||
* @return string The avatar HTML for the specified mode
|
||||
*/
|
||||
public function get_avatar(environment $environment, string $mode, array $row, ?string $alt, ?bool $ignore_config, ?bool $lazy): string
|
||||
public function get_avatar(environment $environment, string $mode, array $row, string|null $alt, bool|null $ignore_config, bool|null $lazy): string
|
||||
{
|
||||
$alt = $alt ?? false;
|
||||
$ignore_config = $ignore_config ?? false;
|
||||
|
|
|
@ -70,9 +70,9 @@ class twig extends \phpbb\template\base
|
|||
\phpbb\template\context $context,
|
||||
environment $twig_environment,
|
||||
$cache_path,
|
||||
\phpbb\user $user = null,
|
||||
\phpbb\user|null $user = null,
|
||||
$extensions = [],
|
||||
\phpbb\extension\manager $extension_manager = null
|
||||
\phpbb\extension\manager|null $extension_manager = null
|
||||
)
|
||||
{
|
||||
$this->path_helper = $path_helper;
|
||||
|
|
|
@ -709,7 +709,7 @@ class user extends \phpbb\session
|
|||
* @param ?\DateTimeZone $timezone Time zone of the time.
|
||||
* @return \phpbb\datetime Date time object linked to the current users locale
|
||||
*/
|
||||
public function create_datetime(string $time = 'now', ?\DateTimeZone $timezone = null)
|
||||
public function create_datetime(string $time = 'now', \DateTimeZone|null $timezone = null)
|
||||
{
|
||||
$timezone = $timezone ?: $this->create_timezone();
|
||||
return new $this->datetime($this, $time, $timezone);
|
||||
|
@ -723,7 +723,7 @@ class user extends \phpbb\session
|
|||
* @param ?\DateTimeZone $timezone Timezone of the date/time, falls back to timezone of current user
|
||||
* @return string|false Returns the unix timestamp or false if date is invalid
|
||||
*/
|
||||
public function get_timestamp_from_format($format, $time, ?\DateTimeZone $timezone = null)
|
||||
public function get_timestamp_from_format($format, $time, \DateTimeZone|null $timezone = null)
|
||||
{
|
||||
$timezone = $timezone ?: $this->create_timezone();
|
||||
$date = \DateTime::createFromFormat($format, $time, $timezone);
|
||||
|
|
53
phpBB/styles/prosilver/template/breadcrumbs.html
Normal file
53
phpBB/styles/prosilver/template/breadcrumbs.html
Normal file
|
@ -0,0 +1,53 @@
|
|||
<ul id="nav-breadcrumbs" class="nav-breadcrumbs linklist navlinks" role="menubar">
|
||||
{% set MICRODATA = 'itemtype="https://schema.org/ListItem" itemprop="itemListElement" itemscope' %}
|
||||
{% set navlink_position = 1 %}
|
||||
|
||||
{% EVENT overall_header_breadcrumbs_before %}
|
||||
|
||||
<li class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">
|
||||
{% if U_SITE_HOME %}
|
||||
<span class="crumb" {{ MICRODATA }}>
|
||||
{% apply spaceless %}
|
||||
<a itemprop="item" href="{{ U_SITE_HOME }}" data-navbar-reference="home">
|
||||
{{ Icon('font', 'home', '', true, 'fas o-icon-baseline') }}
|
||||
<span itemprop="name">{{ L_SITE_HOME }}</span>
|
||||
</a>
|
||||
{% endapply %}
|
||||
<meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}">
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% EVENT overall_header_breadcrumb_prepend %}
|
||||
|
||||
<span class="crumb" {{ MICRODATA }}>
|
||||
{% apply spaceless %}
|
||||
<a itemprop="item" href="{{ U_INDEX }}" accesskey="h" data-navbar-reference="index">
|
||||
{% if not U_SITE_HOME %}{{ Icon('font', 'home', '', true, 'fas o-icon-baseline') }}{% endif %}
|
||||
<span itemprop="name">{{ L_INDEX }}</span>
|
||||
</a>
|
||||
{% endapply %}
|
||||
<meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}">
|
||||
</span>
|
||||
|
||||
{% for navlink in navlinks %}
|
||||
{% set NAVLINK_NAME = navlink.BREADCRUMB_NAME | default(navlink.FORUM_NAME) %}
|
||||
{% set NAVLINK_LINK = navlink.U_BREADCRUMB | default(navlink.U_VIEW_FORUM) %}
|
||||
|
||||
{% EVENT overall_header_navlink_prepend %}
|
||||
<span class="crumb" {{ MICRODATA }}{% if navlink.MICRODATA %} {{ navlink.MICRODATA }}{% endif %}>
|
||||
{% apply spaceless %}
|
||||
<a itemprop="item" href="{{ NAVLINK_LINK }}">
|
||||
<span itemprop="name">{{ NAVLINK_NAME }}</span>
|
||||
</a>
|
||||
{% endapply %}
|
||||
<meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}">
|
||||
</span>
|
||||
{% EVENT overall_header_navlink_append %}
|
||||
{% endfor %}
|
||||
|
||||
{% EVENT overall_header_breadcrumb_append %}
|
||||
|
||||
</li>
|
||||
|
||||
{% EVENT overall_header_breadcrumbs_after %}
|
||||
</ul>
|
|
@ -44,7 +44,7 @@
|
|||
<!-- END faq_block -->
|
||||
|
||||
<div class="to-top-button">
|
||||
<a href="#faqlinks">
|
||||
<a href="#faqlinks" title="{{ lang('BACK_TO_TOP') }}">
|
||||
{{ Icon('font', 'chevron-up', '', false) }}
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -203,68 +203,5 @@
|
|||
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
<ul id="nav-breadcrumbs" class="nav-breadcrumbs linklist navlinks" role="menubar">
|
||||
{% set MICRODATA = 'itemtype="https://schema.org/ListItem" itemprop="itemListElement" itemscope' %}
|
||||
{% set navlink_position = 1 %}
|
||||
|
||||
{% EVENT overall_header_breadcrumbs_before %}
|
||||
|
||||
<li class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">
|
||||
{% if U_SITE_HOME %}
|
||||
<span class="crumb" {{ MICRODATA }}>
|
||||
{% apply spaceless %}
|
||||
<a itemprop="item" href="{{ U_SITE_HOME }}" data-navbar-reference="home">
|
||||
{{ Icon('font', 'home', '', true, 'fas o-icon-baseline') }}
|
||||
<span itemprop="name">{{ L_SITE_HOME }}</span>
|
||||
</a>
|
||||
{% endapply %}
|
||||
<meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}">
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% EVENT overall_header_breadcrumb_prepend %}
|
||||
|
||||
<span class="crumb" {{ MICRODATA }}>
|
||||
{% apply spaceless %}
|
||||
<a itemprop="item" href="{{ U_INDEX }}" accesskey="h" data-navbar-reference="index">
|
||||
{% if not U_SITE_HOME %}{{ Icon('font', 'home', '', true, 'fas o-icon-baseline') }}{% endif %}
|
||||
<span itemprop="name">{{ L_INDEX }}</span>
|
||||
</a>
|
||||
{% endapply %}
|
||||
<meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}">
|
||||
</span>
|
||||
|
||||
{% for navlink in navlinks %}
|
||||
{% set NAVLINK_NAME = navlink.BREADCRUMB_NAME | default(navlink.FORUM_NAME) %}
|
||||
{% set NAVLINK_LINK = navlink.U_BREADCRUMB | default(navlink.U_VIEW_FORUM) %}
|
||||
|
||||
{% EVENT overall_header_navlink_prepend %}
|
||||
<span class="crumb" {{ MICRODATA }}{% if navlink.MICRODATA %} {{ navlink.MICRODATA }}{% endif %}>
|
||||
{% apply spaceless %}
|
||||
<a itemprop="item" href="{{ NAVLINK_LINK }}">
|
||||
<span itemprop="name">{{ NAVLINK_NAME }}</span>
|
||||
</a>
|
||||
{% endapply %}
|
||||
<meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}">
|
||||
</span>
|
||||
{% EVENT overall_header_navlink_append %}
|
||||
{% endfor %}
|
||||
|
||||
{% EVENT overall_header_breadcrumb_append %}
|
||||
|
||||
</li>
|
||||
|
||||
{% EVENT overall_header_breadcrumbs_after %}
|
||||
|
||||
{% if S_DISPLAY_SEARCH and not S_IN_SEARCH %}
|
||||
<li class="rightside responsive-search">
|
||||
<a href="{{ U_SEARCH }}" title="{{ lang('SEARCH_ADV_EXPLAIN') }}" role="menuitem">
|
||||
{{ Icon('font', 'search', lang('SEARCH'), true) }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<!-- EVENT overall_header_stylesheets_after -->
|
||||
|
||||
{% if NOTIFICATIONS_WEBPUSH_ENABLE %}
|
||||
{% include('ucp_notifications_webpush.html') %}
|
||||
{% include 'ucp_notifications_webpush.html' %}
|
||||
{% endif %}
|
||||
|
||||
</head>
|
||||
|
@ -79,7 +79,11 @@
|
|||
<div id="wrap" class="wrap">
|
||||
<a id="top" class="top-anchor" accesskey="t"></a>
|
||||
<div id="page-header">
|
||||
<!-- EVENT overall_header_navbar_before -->
|
||||
|
||||
<div class="headerbar" role="banner">
|
||||
|
||||
{% include 'navbar_header.html' %}
|
||||
<!-- EVENT overall_header_headerbar_before -->
|
||||
<div class="inner">
|
||||
|
||||
|
@ -117,10 +121,10 @@
|
|||
</div>
|
||||
<!-- EVENT overall_header_headerbar_after -->
|
||||
</div>
|
||||
<!-- EVENT overall_header_navbar_before -->
|
||||
<!-- INCLUDE navbar_header.html -->
|
||||
</div>
|
||||
|
||||
{% include 'breadcrumbs.html' %}
|
||||
|
||||
<!-- EVENT overall_header_page_body_before -->
|
||||
|
||||
<a id="start_here" class="anchor"></a>
|
||||
|
|
|
@ -423,9 +423,6 @@
|
|||
<!-- EVENT viewtopic_body_postrow_back2top_before -->
|
||||
<div class="back2top">
|
||||
<!-- EVENT viewtopic_body_postrow_back2top_prepend -->
|
||||
<a href="#top" class="top" title="{L_BACK_TO_TOP}">
|
||||
{{ Icon('font', 'circle-chevron-up', lang('BACK_TO_TOP'), false, 'fas c-top-icon') }}
|
||||
</a>
|
||||
<!-- EVENT viewtopic_body_postrow_back2top_append -->
|
||||
</div>
|
||||
<!-- EVENT viewtopic_body_postrow_back2top_after -->
|
||||
|
@ -496,6 +493,12 @@
|
|||
<!-- ENDIF -->
|
||||
</div>
|
||||
|
||||
<div class="to-top-button">
|
||||
<a href="#top" title="{{ lang('BACK_TO_TOP') }}">
|
||||
{{ Icon('font', 'chevron-up', '', false) }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- EVENT viewtopic_body_footer_before -->
|
||||
<!-- INCLUDE jumpbox.html -->
|
||||
|
||||
|
|
|
@ -99,18 +99,19 @@ th a:hover {
|
|||
}
|
||||
|
||||
/* round cornered boxes and backgrounds */
|
||||
.headerbar {
|
||||
color: #ffffff;
|
||||
.headerbar,
|
||||
.headerbar h1 {
|
||||
color: #eaf8ff;
|
||||
}
|
||||
|
||||
.headerbar,
|
||||
.forumbg {
|
||||
background-color: #13a4ec;
|
||||
background-color: #4688ce;
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
|
||||
.forabg {
|
||||
background-color: #13a4ec;
|
||||
background-color: #4688ce;
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
|
||||
|
@ -118,6 +119,18 @@ th a:hover {
|
|||
background-color: #c9dee8;
|
||||
}
|
||||
|
||||
.headerbar .navbar a {
|
||||
color: #eaf8ff;
|
||||
}
|
||||
|
||||
.headerbar .navbar .dropdown a {
|
||||
color: #0f4d8a;
|
||||
}
|
||||
|
||||
.header-profile {
|
||||
text-shadow: 0 0 1.75rem #eaf8ff;
|
||||
}
|
||||
|
||||
.panel {
|
||||
background-color: #f0f3f5;
|
||||
color: #29303d;
|
||||
|
@ -814,6 +827,10 @@ dd.profile-warnings {
|
|||
/* icon images */
|
||||
.site_logo { background-image: url("./images/site_logo.svg"); }
|
||||
|
||||
.c-hero-logo-img g {
|
||||
fill: #eaf8ff;
|
||||
}
|
||||
|
||||
/* colours and backgrounds for cp.css */
|
||||
|
||||
/* main cp box */
|
||||
|
@ -1109,6 +1126,7 @@ input.disabled {
|
|||
|
||||
.dropdown-extended .dropdown-extended-item {
|
||||
border-top-color: #bdbdbd;
|
||||
color: #47536b;
|
||||
}
|
||||
|
||||
.dropdown-extended .dropdown-extended-item:hover {
|
||||
|
|
|
@ -17,7 +17,7 @@ body {
|
|||
line-height: normal;
|
||||
word-wrap: break-word;
|
||||
margin: 0;
|
||||
padding: 12px 0;
|
||||
padding: 0 0 12px;
|
||||
-webkit-print-color-adjust: exact;
|
||||
}
|
||||
|
||||
|
@ -151,12 +151,13 @@ a:hover {
|
|||
/* Main blocks
|
||||
---------------------------------------- */
|
||||
.wrap {
|
||||
border: 1px solid transparent;
|
||||
border-radius: 8px;
|
||||
border: solid transparent;
|
||||
border-width: 0 1px 1px;
|
||||
border-radius: 0 0 8px 8px;
|
||||
min-width: 625px;
|
||||
max-width: 1152px;
|
||||
margin: 0 auto;
|
||||
padding: 15px;
|
||||
padding: 0 15px 15px;
|
||||
}
|
||||
|
||||
.page-body {
|
||||
|
@ -200,7 +201,7 @@ a:hover {
|
|||
/* Round cornered boxes and backgrounds
|
||||
---------------------------------------- */
|
||||
.headerbar {
|
||||
border-radius: 7px;
|
||||
border-radius: 0 0 7px 7px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 0.5rem;
|
||||
|
@ -212,6 +213,11 @@ a:hover {
|
|||
padding: 3px 10px;
|
||||
}
|
||||
|
||||
.headerbar .navbar {
|
||||
background: none;
|
||||
padding: calc(var(--ps-line-height) * 0.25) 5px calc(var(--ps-line-height) * 0.5);
|
||||
}
|
||||
|
||||
.forabg {
|
||||
border-radius: 7px;
|
||||
clear: both;
|
||||
|
@ -340,6 +346,10 @@ ul.linklist .dropdown-up .dropdown {
|
|||
bottom: 18px;
|
||||
}
|
||||
|
||||
ul.nav-breadcrumbs {
|
||||
margin: calc(var(--ps-line-height) * 0.75) 0;
|
||||
}
|
||||
|
||||
/* Bulletin icons for list items
|
||||
---------------------------------------- */
|
||||
ul.linklist.bulletin > li:before {
|
||||
|
|
|
@ -465,7 +465,7 @@ p.author {
|
|||
clear: left;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
margin-top: calc(var(--ps-font-small) * 1.4);
|
||||
margin: calc(var(--ps-font-small) * 1.4) 0;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
|
|
|
@ -328,7 +328,6 @@
|
|||
vertical-align: bottom;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
/* Pagination
|
||||
|
|
|
@ -24,6 +24,7 @@ use phpbb\template\template;
|
|||
use phpbb\user;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use GuzzleHttp\Psr7\Utils;
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions_acp.php';
|
||||
|
||||
|
@ -266,7 +267,7 @@ class phpbb_captcha_turnstile_test extends \phpbb_database_test_case
|
|||
$response_mock = $this->createMock(Response::class);
|
||||
|
||||
$client_mock->method('request')->willReturn($response_mock);
|
||||
$response_mock->method('getBody')->willReturn(json_encode(['success' => true]));
|
||||
$response_mock->method('getBody')->willReturn(Utils::streamFor(json_encode(['success' => true])));
|
||||
|
||||
// Mock config values for secret
|
||||
$this->config->method('offsetGet')->willReturn('secret_value');
|
||||
|
@ -354,7 +355,7 @@ class phpbb_captcha_turnstile_test extends \phpbb_database_test_case
|
|||
$response_mock = $this->createMock(Response::class);
|
||||
|
||||
$client_mock->method('request')->willReturn($response_mock);
|
||||
$response_mock->method('getBody')->willReturn(json_encode(['success' => false]));
|
||||
$response_mock->method('getBody')->willReturn(Utils::streamFor(json_encode(['success' => false])));
|
||||
|
||||
// Mock config values for secret
|
||||
$this->config->method('offsetGet')->willReturn('secret_value');
|
||||
|
|
|
@ -69,4 +69,32 @@ class phpbb_functional_acp_profile_field_test extends phpbb_functional_test_case
|
|||
|
||||
$this->assertContainsLang('ADDED_PROFILE_FIELD', $crawler->text());
|
||||
}
|
||||
|
||||
public function test_edit_profile_fields()
|
||||
{
|
||||
// Custom profile fields page
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_profile&mode=profile&sid=' . $this->sid);
|
||||
|
||||
// Get all profile fields edit URLs
|
||||
$edits = $crawler->filter('td.actions a')
|
||||
->reduce(
|
||||
function ($node, $i) {
|
||||
$url = $node->attr('href');
|
||||
return ((bool) strpos($url, 'action=edit'));
|
||||
})
|
||||
->each(
|
||||
function ($node, $i) {
|
||||
$url = $node->attr('href');
|
||||
return ($url);
|
||||
});
|
||||
|
||||
foreach ($edits as $edit_url)
|
||||
{
|
||||
$crawler = self::request('GET', 'adm/' . $edit_url . '&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton('Save')->form();
|
||||
$crawler= self::submit($form);
|
||||
|
||||
$this->assertContainsLang('CHANGED_PROFILE_FIELD', $crawler->text());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,6 +229,159 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
|||
$this->delete_topic($topic_multiple_results_count2['topic_id']);
|
||||
}
|
||||
|
||||
public function test_caching_search_results()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
|
||||
// Sphinx search doesn't use phpBB search results caching
|
||||
if (strpos($this->search_backend, 'fulltext_sphinx'))
|
||||
{
|
||||
$this->markTestSkipped("Sphinx search doesn't use phpBB search results caching");
|
||||
}
|
||||
|
||||
$this->purge_cache();
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
|
||||
$crawler = self::request('GET', 'search.php?author_id=2&sr=posts');
|
||||
$posts_found_text = $crawler->filter('.searchresults-title')->text();
|
||||
|
||||
// Get total user's post count
|
||||
preg_match('!(\d+)!', $posts_found_text, $matches);
|
||||
$posts_count = (int) $matches[1];
|
||||
|
||||
$this->assertStringContainsString("Search found $posts_count matches", $posts_found_text, $this->search_backend);
|
||||
|
||||
// Set this value to cache less results than total count
|
||||
$sql = 'UPDATE ' . CONFIG_TABLE . '
|
||||
SET config_value = ' . floor($posts_count / 3) . "
|
||||
WHERE config_name = '" . $this->db->sql_escape('search_block_size') . "'";
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
// Temporarily set posts_per_page to the value allowing to get several pages (4+)
|
||||
$crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post');
|
||||
$form = $crawler->selectButton('Submit')->form();
|
||||
$values = $form->getValues();
|
||||
$current_posts_per_page = $values['config[posts_per_page]'];
|
||||
$values['config[posts_per_page]'] = floor($posts_count / 10);
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertEquals(1, $crawler->filter('.successbox')->count(), $this->search_backend);
|
||||
|
||||
// Now actually test caching search results
|
||||
$this->purge_cache();
|
||||
|
||||
// Default sort direction is 'd' (descending), browse the 1st page
|
||||
$crawler = self::request('GET', 'search.php?author_id=2&sr=posts');
|
||||
$pagination = $crawler->filter('.pagination')->eq(0);
|
||||
$posts_found_text = $pagination->text();
|
||||
|
||||
$this->assertStringContainsString("Search found $posts_count matches", $posts_found_text, $this->search_backend);
|
||||
|
||||
// Filter all search result page links on the 1st page
|
||||
$pagination = $pagination->filter('li > a')->reduce(
|
||||
function ($node, $i)
|
||||
{
|
||||
return ($node->attr('class') == 'button');
|
||||
}
|
||||
);
|
||||
|
||||
// Get last page number
|
||||
$last_page = (int) $pagination->last()->text();
|
||||
|
||||
// Browse the last search page
|
||||
$crawler = self::$client->click($pagination->selectLink($last_page)->link());
|
||||
$pagination = $crawler->filter('.pagination')->eq(0);
|
||||
|
||||
// Filter all search result page links on the last page
|
||||
$pagination = $pagination->filter('li > a')->reduce(
|
||||
function ($node, $i)
|
||||
{
|
||||
return ($node->attr('class') == 'button');
|
||||
}
|
||||
);
|
||||
|
||||
// Now change sort direction to ascending
|
||||
$form = $crawler->selectButton('sort')->form();
|
||||
$values = $form->getValues();
|
||||
$values['sd'] = 'a';
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
|
||||
$pagination = $crawler->filter('.pagination')->eq(0);
|
||||
|
||||
// Filter all search result page links on the 1st page with new sort direction
|
||||
$pagination = $pagination->filter('li > a')->reduce(
|
||||
function ($node, $i)
|
||||
{
|
||||
return ($node->attr('class') == 'button');
|
||||
}
|
||||
);
|
||||
|
||||
// Browse the rest of search results pages with new sort direction
|
||||
$pages = range(2, $last_page);
|
||||
foreach ($pages as $page_number)
|
||||
{
|
||||
$crawler = self::$client->click($pagination->selectLink($page_number)->link());
|
||||
$pagination = $crawler->filter('.pagination')->eq(0);
|
||||
$pagination = $pagination->filter('li > a')->reduce(
|
||||
function ($node, $i)
|
||||
{
|
||||
return ($node->attr('class') == 'button');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Get search results cache varname
|
||||
$finder = new \Symfony\Component\Finder\Finder();
|
||||
$finder
|
||||
->name('data_search_results_*.php')
|
||||
->files()
|
||||
->in($phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT);
|
||||
$iterator = $finder->getIterator();
|
||||
$iterator->rewind();
|
||||
$cache_filename = $iterator->current();
|
||||
$cache_varname = substr($cache_filename->getBasename('.php'), 4);
|
||||
|
||||
// Get cached post ids data
|
||||
$cache = $this->get_cache_driver();
|
||||
$post_ids_cached = $cache->get($cache_varname);
|
||||
|
||||
$cached_results_count = count($post_ids_cached) - 2; // Don't count '-1' and '-2' indexes
|
||||
|
||||
$post_ids_cached_backup = $post_ids_cached;
|
||||
|
||||
// Cached data still should have initial 'd' sort direction
|
||||
$this->assertTrue($post_ids_cached[-2] === 'd', $this->search_backend);
|
||||
|
||||
// Cached search results count should be equal to displayed on search results page
|
||||
$this->assertEquals($posts_count, $post_ids_cached[-1], $this->search_backend);
|
||||
|
||||
// Actual cached data array count should be equal to displayed on search results page too
|
||||
$this->assertEquals($posts_count, $cached_results_count, $this->search_backend);
|
||||
|
||||
// Cached data array shouldn't change after removing duplicates. That is, it shouldn't have any duplicates.
|
||||
unset($post_ids_cached[-2], $post_ids_cached[-1]);
|
||||
unset($post_ids_cached_backup[-2], $post_ids_cached_backup[-1]);
|
||||
$post_ids_cached = array_unique($post_ids_cached);
|
||||
$this->assertEquals($post_ids_cached_backup, $post_ids_cached, $this->search_backend);
|
||||
|
||||
// Restore this value to default
|
||||
$sql = 'UPDATE ' . CONFIG_TABLE . "
|
||||
SET config_value = 250
|
||||
WHERE config_name = '" . $this->db->sql_escape('search_block_size') . "'";
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
// Restore posts_per_page value
|
||||
$crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post');
|
||||
$form = $crawler->selectButton('Submit')->form();
|
||||
$values = $form->getValues();
|
||||
$values['config[posts_per_page]'] = $current_posts_per_page;
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertEquals(1, $crawler->filter('.successbox')->count(), $this->search_backend);
|
||||
}
|
||||
|
||||
protected function create_search_index($backend = null)
|
||||
{
|
||||
$this->add_lang('acp/search');
|
||||
|
|
|
@ -56,7 +56,7 @@ class phpbb_mock_container_builder implements ContainerInterface
|
|||
*
|
||||
* @api
|
||||
*/
|
||||
public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): ?object
|
||||
public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): object|null
|
||||
{
|
||||
if ($this->has($id))
|
||||
{
|
||||
|
|
|
@ -82,13 +82,13 @@ class search_backend_mock implements search_backend_interface
|
|||
// Nothing
|
||||
}
|
||||
|
||||
public function create_index(int &$post_counter = 0): ?array
|
||||
public function create_index(int &$post_counter = 0): array|null
|
||||
{
|
||||
$this->index_created = true;
|
||||
return null;
|
||||
}
|
||||
|
||||
public function delete_index(int &$post_counter = 0): ?array
|
||||
public function delete_index(int &$post_counter = 0): array|null
|
||||
{
|
||||
$this->index_created = true;
|
||||
return null;
|
||||
|
|
|
@ -221,7 +221,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
|
|||
return implode('-', func_get_args());
|
||||
}
|
||||
|
||||
public function create_datetime_callback($time = 'now', \DateTimeZone $timezone = null)
|
||||
public function create_datetime_callback($time = 'now', \DateTimeZone|null $timezone = null)
|
||||
{
|
||||
$timezone = $timezone ?: $this->user->timezone;
|
||||
return new \phpbb\datetime($this->user, $time, $timezone);
|
||||
|
|
|
@ -346,7 +346,7 @@ class phpbb_test_case_helpers
|
|||
* @param string $styles_path Path to the styles dir
|
||||
* @return ContainerInterface
|
||||
*/
|
||||
public function set_s9e_services(ContainerInterface $container = null, $fixture = null, $styles_path = null)
|
||||
public function set_s9e_services(ContainerInterface|null $container = null, $fixture = null, $styles_path = null)
|
||||
{
|
||||
static $first_run;
|
||||
global $config, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $request, $user;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use phpbb\filesystem\exception\filesystem_exception;
|
||||
use phpbb\filesystem\filesystem_interface;
|
||||
use phpbb\update\get_updates;
|
||||
|
@ -63,13 +64,14 @@ class phpbb_update_get_updates_test extends phpbb_test_case
|
|||
|
||||
public function test_download_success()
|
||||
{
|
||||
$response_mock = $this->createMock(Response::class);
|
||||
$this->http_client->expects($this->once())
|
||||
->method('request')
|
||||
->with('GET', 'http://example.com/update.zip', [
|
||||
'sink' => '/path/to/storage',
|
||||
'allow_redirects' => false
|
||||
])
|
||||
->willReturn(true);
|
||||
->willReturn($response_mock);
|
||||
|
||||
$client_reflection = new \ReflectionProperty($this->update, 'http_client');
|
||||
$client_reflection->setValue($this->update, $this->http_client);
|
||||
|
@ -84,7 +86,7 @@ class phpbb_update_get_updates_test extends phpbb_test_case
|
|||
->method('request')
|
||||
->willReturnCallback(function ($method, $url, $options)
|
||||
{
|
||||
throw new ClientException('bad client', new \GuzzleHttp\Psr7\Request($method, $url));
|
||||
throw new ClientException('bad client', new \GuzzleHttp\Psr7\Request($method, $url), new \GuzzleHttp\Psr7\Response());
|
||||
});
|
||||
$client_reflection = new \ReflectionProperty($this->update, 'http_client');
|
||||
$client_reflection->setValue($this->update, $this->http_client);
|
||||
|
|
Loading…
Add table
Reference in a new issue