mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 20:08:55 +00:00
Compare commits
24 commits
0b1311572d
...
f9785a8cf5
Author | SHA1 | Date | |
---|---|---|---|
|
f9785a8cf5 | ||
|
e34e1759c7 | ||
|
8f8a93fa71 | ||
|
f1d8255aca | ||
|
851de03961 | ||
|
0a86130f7f | ||
|
083ae1102b | ||
|
c726382d84 | ||
|
db19a4a578 | ||
|
0b3897b8c3 | ||
|
b2d48b679f | ||
|
5deeea025f | ||
|
6947dc8c92 | ||
|
f23af6f485 | ||
|
b8e5caedbf | ||
|
50e7103080 | ||
|
d8bbe3e58c | ||
|
bf2c22354a | ||
|
215d1bf1eb | ||
|
759f061656 | ||
|
ddc7f1df34 | ||
|
6b6b5ffc28 | ||
|
4f66ec8758 | ||
|
50cf4892ea |
17 changed files with 279 additions and 93 deletions
|
@ -36,7 +36,7 @@
|
||||||
"composer/composer": "^2.0",
|
"composer/composer": "^2.0",
|
||||||
"composer/installers": "^1.9",
|
"composer/installers": "^1.9",
|
||||||
"composer/package-versions-deprecated": "^1.11",
|
"composer/package-versions-deprecated": "^1.11",
|
||||||
"doctrine/dbal": "~3.3.6",
|
"doctrine/dbal": "^3.9",
|
||||||
"google/recaptcha": "~1.1",
|
"google/recaptcha": "~1.1",
|
||||||
"guzzlehttp/guzzle": " ^7.0",
|
"guzzlehttp/guzzle": " ^7.0",
|
||||||
"marc1706/fast-image-size": "^1.1",
|
"marc1706/fast-image-size": "^1.1",
|
||||||
|
|
38
phpBB/composer.lock
generated
38
phpBB/composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "5ed4369e5ba29297443f428dd3001fae",
|
"content-hash": "39f3a7c03ba85a8c7892e5c076372eb0",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bantu/ini-get-wrapper",
|
"name": "bantu/ini-get-wrapper",
|
||||||
|
@ -1128,38 +1128,38 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/dbal",
|
"name": "doctrine/dbal",
|
||||||
"version": "3.3.8",
|
"version": "3.9.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/dbal.git",
|
"url": "https://github.com/doctrine/dbal.git",
|
||||||
"reference": "f873a820227bc352d023791775a01f078a30dfe1"
|
"reference": "ec16c82f20be1a7224e65ac67144a29199f87959"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/dbal/zipball/f873a820227bc352d023791775a01f078a30dfe1",
|
"url": "https://api.github.com/repos/doctrine/dbal/zipball/ec16c82f20be1a7224e65ac67144a29199f87959",
|
||||||
"reference": "f873a820227bc352d023791775a01f078a30dfe1",
|
"reference": "ec16c82f20be1a7224e65ac67144a29199f87959",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"composer-runtime-api": "^2",
|
"composer-runtime-api": "^2",
|
||||||
"doctrine/cache": "^1.11|^2.0",
|
"doctrine/cache": "^1.11|^2.0",
|
||||||
"doctrine/deprecations": "^0.5.3|^1",
|
"doctrine/deprecations": "^0.5.3|^1",
|
||||||
"doctrine/event-manager": "^1.0",
|
"doctrine/event-manager": "^1|^2",
|
||||||
"php": "^7.3 || ^8.0",
|
"php": "^7.4 || ^8.0",
|
||||||
"psr/cache": "^1|^2|^3",
|
"psr/cache": "^1|^2|^3",
|
||||||
"psr/log": "^1|^2|^3"
|
"psr/log": "^1|^2|^3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"doctrine/coding-standard": "9.0.0",
|
"doctrine/coding-standard": "12.0.0",
|
||||||
"jetbrains/phpstorm-stubs": "2022.1",
|
"fig/log-test": "^1",
|
||||||
"phpstan/phpstan": "1.8.2",
|
"jetbrains/phpstorm-stubs": "2023.1",
|
||||||
"phpstan/phpstan-strict-rules": "^1.3",
|
"phpstan/phpstan": "2.1.1",
|
||||||
"phpunit/phpunit": "9.5.21",
|
"phpstan/phpstan-strict-rules": "^2",
|
||||||
"psalm/plugin-phpunit": "0.17.0",
|
"phpunit/phpunit": "9.6.22",
|
||||||
"squizlabs/php_codesniffer": "3.7.1",
|
"slevomat/coding-standard": "8.13.1",
|
||||||
"symfony/cache": "^5.2|^6.0",
|
"squizlabs/php_codesniffer": "3.10.2",
|
||||||
"symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0",
|
"symfony/cache": "^5.4|^6.0|^7.0",
|
||||||
"vimeo/psalm": "4.24.0"
|
"symfony/console": "^4.4|^5.4|^6.0|^7.0"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"symfony/console": "For helpful console commands such as SQL execution and import of files."
|
"symfony/console": "For helpful console commands such as SQL execution and import of files."
|
||||||
|
@ -1219,7 +1219,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/doctrine/dbal/issues",
|
"issues": "https://github.com/doctrine/dbal/issues",
|
||||||
"source": "https://github.com/doctrine/dbal/tree/3.3.8"
|
"source": "https://github.com/doctrine/dbal/tree/3.9.4"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -1235,7 +1235,7 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2022-08-05T15:35:35+00:00"
|
"time": "2025-01-16T08:28:55+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/deprecations",
|
"name": "doctrine/deprecations",
|
||||||
|
|
|
@ -2821,6 +2821,13 @@ ucp_pm_viewmessage_custom_fields_before
|
||||||
* Purpose: Add data before the custom fields on the user profile when viewing
|
* Purpose: Add data before the custom fields on the user profile when viewing
|
||||||
a private message
|
a private message
|
||||||
|
|
||||||
|
ucp_pm_viewmessage_message_content_before
|
||||||
|
===
|
||||||
|
* Locations:
|
||||||
|
+ styles/prosilver/template/ucp_pm_viewmessage.html
|
||||||
|
* Since: 3.3.16-RC1
|
||||||
|
* Purpose: Add content before the private message text
|
||||||
|
|
||||||
ucp_pm_viewmessage_options_before
|
ucp_pm_viewmessage_options_before
|
||||||
===
|
===
|
||||||
* Locations:
|
* Locations:
|
||||||
|
|
|
@ -70,11 +70,11 @@ $lang = array_merge($lang, array(
|
||||||
|
|
||||||
<p>phpBB supports the following databases:</p>
|
<p>phpBB supports the following databases:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>MySQL 4.1.3 or above (MySQLi required)</li>
|
<li>MySQL 5.6 or above</li>
|
||||||
<li>PostgreSQL 8.3+</li>
|
<li>MariaDB 10.2.7 or above</li>
|
||||||
<li>SQLite 3.6.15+</li>
|
<li>PostgreSQL 9.4 or above</li>
|
||||||
<li>MS SQL Server 2000 or above (directly or via ODBC)</li>
|
<li>SQLite 3.8.3 or above</li>
|
||||||
<li>MS SQL Server 2005 or above (native)</li>
|
<li>MS SQL Server 2012 or above (via ODBC or the native adapter)</li>
|
||||||
<li>Oracle</li>
|
<li>Oracle</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -184,9 +184,9 @@ $lang = array_merge($lang, array(
|
||||||
'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.',
|
'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.',
|
||||||
|
|
||||||
// Database options
|
// Database options
|
||||||
'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC',
|
'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server via ODBC',
|
||||||
'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]',
|
'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server [ Native ]',
|
||||||
'DB_OPTION_MYSQLI' => 'MySQL with MySQLi Extension',
|
'DB_OPTION_MYSQLI' => 'MySQL',
|
||||||
'DB_OPTION_ORACLE' => 'Oracle',
|
'DB_OPTION_ORACLE' => 'Oracle',
|
||||||
'DB_OPTION_POSTGRES' => 'PostgreSQL',
|
'DB_OPTION_POSTGRES' => 'PostgreSQL',
|
||||||
'DB_OPTION_SQLITE3' => 'SQLite 3',
|
'DB_OPTION_SQLITE3' => 'SQLite 3',
|
||||||
|
@ -202,10 +202,13 @@ $lang = array_merge($lang, array(
|
||||||
'INST_ERR_DB_NO_WRITABLE' => 'Both the database and the directory containing it must be writable.',
|
'INST_ERR_DB_NO_WRITABLE' => 'Both the database and the directory containing it must be writable.',
|
||||||
'INST_ERR_DB_NO_ERROR' => 'No error message given.',
|
'INST_ERR_DB_NO_ERROR' => 'No error message given.',
|
||||||
'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.',
|
'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.',
|
||||||
'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.',
|
'INST_ERR_DB_NO_MARIADB' => 'The version of MariaDB installed on this machine is too old, it must be upgraded to at least 10.2.7.',
|
||||||
'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.',
|
'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is too old, it must be upgraded to at least 5.6.',
|
||||||
'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the <var>NLS_CHARACTERSET</var> parameter to <var>UTF8</var>. Either upgrade your installation to 9.2+ or change the parameter.',
|
'INST_ERR_DB_NO_MSSQL' => 'The version of Microsoft SQL Server installed on this machine is too old, it must be upgraded to at least SQL Server 2012 (11.0.2100.60)',
|
||||||
'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in <var>UNICODE</var> or <var>UTF8</var> encoding. Try installing with a database in <var>UNICODE</var> or <var>UTF8</var> encoding.',
|
'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.8.3.',
|
||||||
|
'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed is too old, it must be upgraded to at least 12.1.0.2.',
|
||||||
|
'INST_ERR_DB_NO_POSTGRES' => 'The version of the PostgreSQL you have installed is too old, it must be upgraded to at least 9.4.',
|
||||||
|
'INST_ERR_DB_NO_POSTGRES_UTF8' => 'The database you have selected was not created in <var>UNICODE</var> or <var>UTF8</var> encoding. Try installing with a database in <var>UNICODE</var> or <var>UTF8</var> encoding.',
|
||||||
'INST_SCHEMA_FILE_NOT_WRITABLE' => 'The schema file is not writable',
|
'INST_SCHEMA_FILE_NOT_WRITABLE' => 'The schema file is not writable',
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -445,8 +445,11 @@ class content_visibility
|
||||||
{
|
{
|
||||||
if ($row['post_postcount'] && !isset($poster_postcounts[(int) $row['poster_id']]))
|
if ($row['post_postcount'] && !isset($poster_postcounts[(int) $row['poster_id']]))
|
||||||
{
|
{
|
||||||
|
if($row['post_visibility'] != 0 || $visibility != ITEM_DELETED ){
|
||||||
$poster_postcounts[(int) $row['poster_id']] = 1;
|
$poster_postcounts[(int) $row['poster_id']] = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if ($row['post_postcount'])
|
else if ($row['post_postcount'])
|
||||||
{
|
{
|
||||||
$poster_postcounts[(int) $row['poster_id']]++;
|
$poster_postcounts[(int) $row['poster_id']]++;
|
||||||
|
|
|
@ -79,7 +79,7 @@ class connection_parameter_factory
|
||||||
string|null $name = null,
|
string|null $name = null,
|
||||||
string|null $port = null) : array
|
string|null $port = null) : array
|
||||||
{
|
{
|
||||||
if ($params['driver'] === 'pdo_sqlite')
|
if (in_array($params['driver'], ['pdo_sqlite', 'sqlite3']))
|
||||||
{
|
{
|
||||||
return self::enrich_parameters(
|
return self::enrich_parameters(
|
||||||
self::build_sqlite_parameters($params, $host, $user, $password)
|
self::build_sqlite_parameters($params, $host, $user, $password)
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace phpbb\db\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SQLite3 Database Abstraction Layer
|
* SQLite3 Database Abstraction Layer
|
||||||
* Minimum Requirement: 3.6.15+
|
* Minimum Requirement: 3.8.3+
|
||||||
*/
|
*/
|
||||||
class sqlite3 extends \phpbb\db\driver\driver
|
class sqlite3 extends \phpbb\db\driver\driver
|
||||||
{
|
{
|
||||||
|
|
|
@ -289,6 +289,12 @@ class doctrine implements tools_interface
|
||||||
|
|
||||||
if (count($primary_key_indexes))
|
if (count($primary_key_indexes))
|
||||||
{
|
{
|
||||||
|
// For PostgreSQL, drop primary index first to avoid "Dependent objects still exist" error
|
||||||
|
if (stripos($this->get_schema_manager()->getDatabasePlatform()->getname(), 'postgresql') !== false)
|
||||||
|
{
|
||||||
|
$this->get_schema_manager()->dropIndex('"primary"', $table_name);
|
||||||
|
}
|
||||||
|
|
||||||
$ret = $this->alter_schema(
|
$ret = $this->alter_schema(
|
||||||
function (Schema $schema) use ($table_name, $column_name): void
|
function (Schema $schema) use ($table_name, $column_name): void
|
||||||
{
|
{
|
||||||
|
@ -478,7 +484,7 @@ class doctrine implements tools_interface
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
// @todo: check if it makes sense to properly handle the exception
|
// @todo: check if it makes sense to properly handle the exception
|
||||||
return false;
|
return [$e->getMessage()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class database
|
||||||
// Note: php 5.5 alpha 2 deprecated mysql.
|
// Note: php 5.5 alpha 2 deprecated mysql.
|
||||||
// Keep mysqli before mysql in this list.
|
// Keep mysqli before mysql in this list.
|
||||||
'mysqli' => array(
|
'mysqli' => array(
|
||||||
'LABEL' => 'MySQL with MySQLi Extension',
|
'LABEL' => 'MySQL',
|
||||||
'SCHEMA' => 'mysql_41',
|
'SCHEMA' => 'mysql_41',
|
||||||
'MODULE' => 'mysqli',
|
'MODULE' => 'mysqli',
|
||||||
'DOCTRINE' => ['pdo_mysql'],
|
'DOCTRINE' => ['pdo_mysql'],
|
||||||
|
@ -59,7 +59,7 @@ class database
|
||||||
'2.0.x' => true,
|
'2.0.x' => true,
|
||||||
),
|
),
|
||||||
'mssqlnative' => array(
|
'mssqlnative' => array(
|
||||||
'LABEL' => 'MS SQL Server 2005+ [ Native ]',
|
'LABEL' => 'MS SQL Server [ Native ]',
|
||||||
'SCHEMA' => 'mssql',
|
'SCHEMA' => 'mssql',
|
||||||
'MODULE' => 'sqlsrv',
|
'MODULE' => 'sqlsrv',
|
||||||
'DOCTRINE' => ['pdo_sqlsrv'],
|
'DOCTRINE' => ['pdo_sqlsrv'],
|
||||||
|
@ -78,7 +78,7 @@ class database
|
||||||
'2.0.x' => false,
|
'2.0.x' => false,
|
||||||
),
|
),
|
||||||
'postgres' => array(
|
'postgres' => array(
|
||||||
'LABEL' => 'PostgreSQL 8.3+',
|
'LABEL' => 'PostgreSQL',
|
||||||
'SCHEMA' => 'postgres',
|
'SCHEMA' => 'postgres',
|
||||||
'MODULE' => 'pgsql',
|
'MODULE' => 'pgsql',
|
||||||
'DOCTRINE' => ['pdo_pgsql'],
|
'DOCTRINE' => ['pdo_pgsql'],
|
||||||
|
@ -405,10 +405,29 @@ class database
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if database version is supported
|
// Check if database version is supported
|
||||||
|
/** @psalm-suppress UndefinedInterfaceMethod */
|
||||||
|
$db_server_version = $doctrine_db->getWrappedConnection()->getServerVersion();
|
||||||
switch ($dbms)
|
switch ($dbms)
|
||||||
{
|
{
|
||||||
|
case 'mysqli':
|
||||||
|
if (stripos($db->sql_server_info(), 'mariadb') !== false && version_compare($db_server_version, '10.2.7', '<'))
|
||||||
|
{
|
||||||
|
$errors[] = array(
|
||||||
|
'title' => 'INST_ERR_DB_NO_MARIADB',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (version_compare($db_server_version, '5.6', '<'))
|
||||||
|
{
|
||||||
|
$errors[] = array(
|
||||||
|
'title' => 'INST_ERR_DB_NO_MYSQLI',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'sqlite3':
|
case 'sqlite3':
|
||||||
if (version_compare($db->sql_server_info(true), '3.6.15', '<'))
|
if (version_compare($db_server_version, '3.8.3', '<'))
|
||||||
{
|
{
|
||||||
$errors[] = array(
|
$errors[] = array(
|
||||||
'title' => 'INST_ERR_DB_NO_SQLITE3',
|
'title' => 'INST_ERR_DB_NO_SQLITE3',
|
||||||
|
@ -416,20 +435,7 @@ class database
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$sql = "SELECT *
|
if (version_compare($db_server_version, '12.1.0.2', '<'))
|
||||||
FROM NLS_DATABASE_PARAMETERS
|
|
||||||
WHERE PARAMETER = 'NLS_RDBMS_VERSION'
|
|
||||||
OR PARAMETER = 'NLS_CHARACTERSET'";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$stats = [];
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$stats[$row['parameter']] = $row['value'];
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8')
|
|
||||||
{
|
{
|
||||||
$errors[] = array(
|
$errors[] = array(
|
||||||
'title' => 'INST_ERR_DB_NO_ORACLE',
|
'title' => 'INST_ERR_DB_NO_ORACLE',
|
||||||
|
@ -437,6 +443,14 @@ class database
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'postgres':
|
case 'postgres':
|
||||||
|
if (version_compare($db_server_version, '9.4', '<'))
|
||||||
|
{
|
||||||
|
$errors[] = array(
|
||||||
|
'title' => 'INST_ERR_DB_NO_POSTGRES',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$sql = "SHOW server_encoding;";
|
$sql = "SHOW server_encoding;";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
|
@ -445,7 +459,17 @@ class database
|
||||||
if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
|
if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
|
||||||
{
|
{
|
||||||
$errors[] = array(
|
$errors[] = array(
|
||||||
'title' => 'INST_ERR_DB_NO_POSTGRES',
|
'title' => 'INST_ERR_DB_NO_POSTGRES_UTF8',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'mssqlnative':
|
||||||
|
case 'mssql_odbc':
|
||||||
|
if (version_compare($db_server_version, '11.0.2100.60', '<'))
|
||||||
|
{
|
||||||
|
$errors[] = array(
|
||||||
|
'title' => 'INST_ERR_DB_NO_MSSQL',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -34,16 +34,17 @@ self.addEventListener('push', event => {
|
||||||
notificationVersion = parseInt(notificationData.version, 10);
|
notificationVersion = parseInt(notificationData.version, 10);
|
||||||
pushToken = notificationData.token;
|
pushToken = notificationData.token;
|
||||||
} catch {
|
} catch {
|
||||||
self.registration.showNotification(event.data.text());
|
event.waitUntil(self.registration.showNotification(event.data.text()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.waitUntil((async() => {
|
||||||
const getNotificationUrl = '{{ U_WEBPUSH_GET_NOTIFICATION }}';
|
const getNotificationUrl = '{{ U_WEBPUSH_GET_NOTIFICATION }}';
|
||||||
const assetsVersion = parseInt('{{ ASSETS_VERSION }}', 10);
|
const assetsVersion = parseInt('{{ ASSETS_VERSION }}', 10);
|
||||||
|
|
||||||
// Force update if versions differ
|
// Force update if versions differ
|
||||||
if (assetsVersion !== notificationVersion) {
|
if (assetsVersion !== notificationVersion) {
|
||||||
self.registration.update();
|
await self.registration.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
@ -52,23 +53,29 @@ self.addEventListener('push', event => {
|
||||||
formData.append('user_id', userId.toString(10));
|
formData.append('user_id', userId.toString(10));
|
||||||
formData.append('token', pushToken);
|
formData.append('token', pushToken);
|
||||||
|
|
||||||
fetch(getNotificationUrl, {
|
try {
|
||||||
|
const response = await fetch(getNotificationUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
},
|
},
|
||||||
body: formData,
|
body: formData,
|
||||||
})
|
});
|
||||||
.then(response => response.json())
|
|
||||||
.then(response => {
|
const responseData = await response.json();
|
||||||
const responseBody = response.title + '\n' + response.text;
|
|
||||||
|
const responseBody = responseData.title + '\n' + responseData.text;
|
||||||
const options = {
|
const options = {
|
||||||
body: responseBody,
|
body: responseBody,
|
||||||
data: response,
|
data: responseData,
|
||||||
icon: response.avatar.src,
|
icon: responseData.avatar.src,
|
||||||
};
|
};
|
||||||
self.registration.showNotification(response.heading, options);
|
|
||||||
});
|
await self.registration.showNotification(responseData.heading, options);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Push error:', e);
|
||||||
|
}
|
||||||
|
})());
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
to hide visually and `aria-hidden="true"` to hide from screen-readers; using
|
to hide visually and `aria-hidden="true"` to hide from screen-readers; using
|
||||||
`hidden` or `display: none` would prevent the task from running.
|
`hidden` or `display: none` would prevent the task from running.
|
||||||
#}
|
#}
|
||||||
<img class="sr-only" aria-hidden="true" src="{{ CRON_TASK_URL|e('html_attr') }}" width="1" height="1" alt="">
|
<img class="sr-only" aria-hidden="true" src="{{ CRON_TASK_URL|e('url') }}" width="1" height="1" alt="">
|
||||||
|
|
|
@ -149,6 +149,7 @@
|
||||||
<!-- IF S_BCC_RECIPIENT --><br /><strong>{L_BCC}{L_COLON}</strong> <!-- BEGIN bcc_recipient --><!-- IF bcc_recipient.NAME_FULL -->{bcc_recipient.NAME_FULL}<!-- ELSE --><a href="{bcc_recipient.U_VIEW}"<!-- IF bcc_recipient.COLOUR --> style="color:{bcc_recipient.COLOUR};"<!-- ENDIF -->><strong>{bcc_recipient.NAME}</strong></a><!-- ENDIF --> <!-- END bcc_recipient --><!-- ENDIF -->
|
<!-- IF S_BCC_RECIPIENT --><br /><strong>{L_BCC}{L_COLON}</strong> <!-- BEGIN bcc_recipient --><!-- IF bcc_recipient.NAME_FULL -->{bcc_recipient.NAME_FULL}<!-- ELSE --><a href="{bcc_recipient.U_VIEW}"<!-- IF bcc_recipient.COLOUR --> style="color:{bcc_recipient.COLOUR};"<!-- ENDIF -->><strong>{bcc_recipient.NAME}</strong></a><!-- ENDIF --> <!-- END bcc_recipient --><!-- ENDIF -->
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{% EVENT ucp_pm_viewmessage_message_content_before %}
|
||||||
|
|
||||||
<div class="content">{MESSAGE}</div>
|
<div class="content">{MESSAGE}</div>
|
||||||
|
|
||||||
|
|
131
tests/cron/wrapper_test.php
Normal file
131
tests/cron/wrapper_test.php
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
<?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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../template/template_test_case.php';
|
||||||
|
|
||||||
|
class phpbb_cron_wrapper_test extends phpbb_template_template_test_case
|
||||||
|
{
|
||||||
|
private $task;
|
||||||
|
private $routing_helper;
|
||||||
|
private $wrapper;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
global $phpbb_root_path;
|
||||||
|
|
||||||
|
$this->setup_engine([], $phpbb_root_path . 'styles/all/template');
|
||||||
|
|
||||||
|
global $phpbb_filesystem;
|
||||||
|
|
||||||
|
$phpbb_filesystem = new \phpbb\filesystem\filesystem();
|
||||||
|
|
||||||
|
$this->task = $this->createMock(\phpbb\cron\task\task::class);
|
||||||
|
$this->routing_helper = $this->createMock(\phpbb\routing\helper::class);
|
||||||
|
|
||||||
|
$this->wrapper = new \phpbb\cron\task\wrapper(
|
||||||
|
$this->task,
|
||||||
|
$this->routing_helper,
|
||||||
|
$this->template
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_generate_template_pagination()
|
||||||
|
{
|
||||||
|
$this->task = $this->createMock(\phpbb\cron\task\parametrized::class);
|
||||||
|
$this->task->expects($this->any())
|
||||||
|
->method('get_parameters')
|
||||||
|
->willReturn(['f' => '5']);
|
||||||
|
$this->task->expects($this->any())
|
||||||
|
->method('get_name')
|
||||||
|
->willReturn('test_task');
|
||||||
|
$this->routing_helper = $this->createMock(\phpbb\routing\helper::class);
|
||||||
|
$this->routing_helper->expects($this->any())
|
||||||
|
->method('route')
|
||||||
|
->with('phpbb_cron_run', ['cron_type' => 'test_task', 'f' => '5'])
|
||||||
|
->willReturn('app.php/cron/foo?f=5');
|
||||||
|
|
||||||
|
$this->wrapper = new \phpbb\cron\task\wrapper(
|
||||||
|
$this->task,
|
||||||
|
$this->routing_helper,
|
||||||
|
$this->template
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals('<img class="sr-only" aria-hidden="true" src="app.php%2Fcron%2Ffoo%3Ff%3D5" width="1" height="1" alt="">', str_replace(["\n", "\t"], '', $this->wrapper->get_html_tag()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_is_parametrized_false()
|
||||||
|
{
|
||||||
|
$this->assertFalse($this->wrapper->is_parametrized());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_is_ready()
|
||||||
|
{
|
||||||
|
$this->task->method('is_runnable')->willReturn(true);
|
||||||
|
$this->task->method('should_run')->willReturn(true);
|
||||||
|
|
||||||
|
$this->assertTrue($this->wrapper->is_ready());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_get_url_non_parametrized()
|
||||||
|
{
|
||||||
|
$this->task->method('get_name')->willReturn('test_task');
|
||||||
|
$this->routing_helper->expects($this->once())
|
||||||
|
->method('route')
|
||||||
|
->with('phpbb_cron_run', ['cron_type' => 'test_task'])
|
||||||
|
->willReturn('/cron/url');
|
||||||
|
|
||||||
|
$this->assertEquals('/cron/url', $this->wrapper->get_url());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_get_html_tag()
|
||||||
|
{
|
||||||
|
$this->template = $this->createMock(\phpbb\template\template::class);
|
||||||
|
$this->wrapper = new \phpbb\cron\task\wrapper(
|
||||||
|
$this->task,
|
||||||
|
$this->routing_helper,
|
||||||
|
$this->template
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->template->expects($this->once())
|
||||||
|
->method('set_filenames');
|
||||||
|
$this->template->expects($this->once())
|
||||||
|
->method('assign_var');
|
||||||
|
$this->template->expects($this->once())
|
||||||
|
->method('assign_display')
|
||||||
|
->willReturn('<img src="cron">');
|
||||||
|
|
||||||
|
$this->assertEquals('<img src="cron">', $this->wrapper->get_html_tag());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_call_forwards_to_task()
|
||||||
|
{
|
||||||
|
$this->task = $this->getMockBuilder(\phpbb\cron\task\task::class)
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->setMethods(['get_name', 'run', 'is_runnable', 'should_run', 'some_method'])
|
||||||
|
->getMock();
|
||||||
|
$this->routing_helper = $this->createMock(\phpbb\routing\helper::class);
|
||||||
|
|
||||||
|
$this->wrapper = new \phpbb\cron\task\wrapper(
|
||||||
|
$this->task,
|
||||||
|
$this->routing_helper,
|
||||||
|
$this->template
|
||||||
|
);
|
||||||
|
$this->task->expects($this->once())
|
||||||
|
->method('some_method')
|
||||||
|
->with('arg1', 'arg2')
|
||||||
|
->willReturn('result');
|
||||||
|
|
||||||
|
$result = $this->wrapper->some_method('arg1', 'arg2');
|
||||||
|
$this->assertEquals('result', $result);
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/template_test_case.php';
|
||||||
|
|
||||||
class phpbb_template_extension_test extends phpbb_template_template_test_case
|
class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
{
|
{
|
||||||
protected function setup_engine(array $new_config = [])
|
protected function setup_engine(array $new_config = [], string $template_path = '')
|
||||||
{
|
{
|
||||||
global $config, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
global $config, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $parent_template_path;
|
protected $parent_template_path;
|
||||||
|
|
||||||
protected function setup_engine(array $new_config = array())
|
protected function setup_engine(array $new_config = array(), string $template_path = '')
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx, $user;
|
global $phpbb_root_path, $phpEx, $user;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use phpbb\template\twig\twig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* This file is part of the phpBB Forum Software package.
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
@ -14,6 +17,7 @@
|
||||||
class phpbb_template_template_test_case extends phpbb_test_case
|
class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
{
|
{
|
||||||
protected $lang;
|
protected $lang;
|
||||||
|
/** @var twig */
|
||||||
protected $template;
|
protected $template;
|
||||||
protected $template_path;
|
protected $template_path;
|
||||||
protected $user;
|
protected $user;
|
||||||
|
@ -68,7 +72,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
return $defaults;
|
return $defaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setup_engine(array $new_config = array())
|
protected function setup_engine(array $new_config = array(), string $template_path = '')
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
@ -90,7 +94,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->template_path = $this->test_path . '/templates';
|
$this->template_path = $template_path ?: $this->test_path . '/templates';
|
||||||
|
|
||||||
$cache_path = $phpbb_root_path . 'cache/twig';
|
$cache_path = $phpbb_root_path . 'cache/twig';
|
||||||
$context = new \phpbb\template\context();
|
$context = new \phpbb\template\context();
|
||||||
|
|
|
@ -21,7 +21,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $parent_template_path;
|
protected $parent_template_path;
|
||||||
|
|
||||||
protected function setup_engine(array $new_config = array())
|
protected function setup_engine(array $new_config = [], string $template_path = '')
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx, $user;
|
global $phpbb_root_path, $phpEx, $user;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue