mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 20:08:55 +00:00
Compare commits
74 commits
8b130a4143
...
0b51e1b3c7
Author | SHA1 | Date | |
---|---|---|---|
|
0b51e1b3c7 | ||
|
954bc07de1 | ||
|
044536dffb | ||
|
6ccc6f0383 | ||
|
4f10e6e212 | ||
|
3b03f3a8f9 | ||
|
e47ba9e81d | ||
|
8d016bafa2 | ||
|
6d6f4fdeba | ||
|
35221f8ba5 | ||
|
03031e846d | ||
|
9219c03b36 | ||
|
72c3745868 | ||
|
579b4a8287 | ||
|
b8c49f9711 | ||
|
2f43c1facd | ||
|
9c49a2b86b | ||
|
d017eff8f1 | ||
|
d4a3311b76 | ||
|
bc470285fc | ||
|
1d7543c778 | ||
|
8411da1819 | ||
|
e34e1759c7 | ||
|
8f8a93fa71 | ||
|
f1d8255aca | ||
|
851de03961 | ||
|
0a86130f7f | ||
|
083ae1102b | ||
|
c726382d84 | ||
|
db19a4a578 | ||
|
0b3897b8c3 | ||
|
b2d48b679f | ||
|
5deeea025f | ||
|
d3bb7e5bd3 | ||
|
b6c42b3768 | ||
|
da2733a7d8 | ||
|
b8204d24f9 | ||
|
6947dc8c92 | ||
|
b9df5bbbf0 | ||
|
f23af6f485 | ||
|
b8e5caedbf | ||
|
50e7103080 | ||
|
d8bbe3e58c | ||
|
bf2c22354a | ||
|
215d1bf1eb | ||
|
759f061656 | ||
|
ddc7f1df34 | ||
|
ccbdfb49c7 | ||
|
43cf7b73bd | ||
|
6b6b5ffc28 | ||
|
4f66ec8758 | ||
|
3a5247d01b | ||
|
5e0dc9ef2e | ||
|
8338ff9e56 | ||
|
84e7e34a66 | ||
|
18bae795f0 | ||
|
09fd86ffb0 | ||
|
4a00212f2d | ||
|
cb47d78d26 | ||
|
0eb98d51e2 | ||
|
82a5e20f3e | ||
|
71fe9d60c4 | ||
|
59b482a222 | ||
|
d934c8c4b7 | ||
|
d07aeb00d8 | ||
|
599cb06107 | ||
|
71f0a3cb62 | ||
|
299d6a0030 | ||
|
b84bc9adfc | ||
|
80af2dc25e | ||
|
dbe91cac88 | ||
|
9fad235917 | ||
|
95da75d82c | ||
|
24c3bc3f1f |
53 changed files with 973 additions and 197 deletions
|
@ -91,6 +91,12 @@
|
||||||
<dd><input type="checkbox" class="radio" id="field_is_contact" name="field_is_contact" value="1"<!-- IF S_FIELD_CONTACT --> checked="checked"<!-- ENDIF --> /></dd>
|
<dd><input type="checkbox" class="radio" id="field_is_contact" name="field_is_contact" value="1"<!-- IF S_FIELD_CONTACT --> checked="checked"<!-- ENDIF --> /></dd>
|
||||||
<dd><input class="text medium" type="text" name="field_contact_desc" id="field_contact_desc" value="{FIELD_CONTACT_DESC}" /> <label for="field_contact_desc">{L_FIELD_CONTACT_DESC}</label></dd>
|
<dd><input class="text medium" type="text" name="field_contact_desc" id="field_contact_desc" value="{FIELD_CONTACT_DESC}" /> <label for="field_contact_desc">{L_FIELD_CONTACT_DESC}</label></dd>
|
||||||
<dd><input class="text medium" type="text" name="field_contact_url" id="field_contact_url" value="{FIELD_CONTACT_URL}" /> <label for="field_contact_url">{L_FIELD_CONTACT_URL}</label></dd>
|
<dd><input class="text medium" type="text" name="field_contact_url" id="field_contact_url" value="{FIELD_CONTACT_URL}" /> <label for="field_contact_url">{L_FIELD_CONTACT_URL}</label></dd>
|
||||||
|
<dt><label for="field_icon">{{ lang('FIELD_ICON') ~ lang('COLON') }}</label><br /><span>{{ lang('FIELD_ICON_EXPLAIN') }}</span></dt>
|
||||||
|
<dd><input name="field_icon" id="field_icon" type="text" size="15" maxlength="255" value="{{ FIELD_ICON }}" placeholder="{{ lang('FIELD_ICON') }}" />{{ Icon('font', FIELD_ICON, '', true, 'acp-icon', {'style': 'margin:0 6px;' ~ (FIELD_ICON_COLOR ? (' color: #' ~ FIELD_ICON_COLOR ~ ';') : '')}) }}</dd>
|
||||||
|
<dd>
|
||||||
|
<input name="field_icon_color" type="text" id="contact_field_icon_bgcolor" value="{{ FIELD_ICON_COLOR }}" size="7" maxlength="6" placeholder="{{ lang('FIELD_ICON_COLOR') }}" />
|
||||||
|
<input type="color" id="field_icon_color_picker" aria-label="{{ lang('FIELD_ICON_COLOR') }}">
|
||||||
|
</dd>
|
||||||
<!-- EVENT acp_profile_contact_last -->
|
<!-- EVENT acp_profile_contact_last -->
|
||||||
</dl>
|
</dl>
|
||||||
{% EVENT acp_profile_contact_after %}
|
{% EVENT acp_profile_contact_after %}
|
||||||
|
|
|
@ -3152,3 +3152,29 @@ span + .o-icon {
|
||||||
.acp-icon-disabled {
|
.acp-icon-disabled {
|
||||||
color: #d0d0d0;
|
color: #d0d0d0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
input[type="color"] {
|
||||||
|
background-color: transparent;
|
||||||
|
border: solid 1px #d3d3d3;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
padding: 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="color"]::-webkit-color-swatch-wrapper {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="color"]::-webkit-color-swatch {
|
||||||
|
border: 0;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="color"]::-moz-color-swatch {
|
||||||
|
border: 0;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
|
@ -244,6 +244,67 @@ function parse_document(container)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically display custom profile fields FontAwesome icon
|
||||||
|
*/
|
||||||
|
const DEFAULT_COLOR = '#000000';
|
||||||
|
const HEX_REGEX = /^#[A-Fa-f0-9]{6}$/;
|
||||||
|
const colorPicker = document.getElementById('field_icon_color_picker');
|
||||||
|
const colorText = colorPicker.previousElementSibling;
|
||||||
|
|
||||||
|
const syncColors = (source, target) => {
|
||||||
|
const value = '#' + source.value.trim();
|
||||||
|
target.value = HEX_REGEX.test(value) ? value : DEFAULT_COLOR;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleInput = ({ target }) => {
|
||||||
|
if (target === colorPicker) {
|
||||||
|
colorText.value = target.value.substring(1);
|
||||||
|
} else {
|
||||||
|
syncColors(colorText, colorPicker);
|
||||||
|
}
|
||||||
|
const icon = field_icon?.nextElementSibling;
|
||||||
|
if (icon && icon.tagName.toLowerCase() === 'i') {
|
||||||
|
icon.style.color = colorPicker.value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
colorPicker.addEventListener('input', handleInput);
|
||||||
|
colorText.addEventListener('input', handleInput);
|
||||||
|
colorText.addEventListener('blur', () => {
|
||||||
|
if (!colorText.value.trim()) {
|
||||||
|
colorPicker.value = DEFAULT_COLOR;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
syncColors(colorText, colorPicker);
|
||||||
|
|
||||||
|
var field_icon = document.getElementById('field_icon');
|
||||||
|
if (!field_icon.nextElementSibling) {
|
||||||
|
icon_demo = document.createElement('i');
|
||||||
|
icon_demo.setAttribute('style', `margin:0 6px; color: ${colorPicker.value}`);
|
||||||
|
icon_demo.setAttribute('class', `o-icon o-icon-font fa-fw fas acp-icon`);
|
||||||
|
field_icon.after(icon_demo);
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateIconClass = (element, newClass) => {
|
||||||
|
|
||||||
|
element.classList.forEach(className => {
|
||||||
|
if (className.startsWith('fa-') && className !== 'fa-fw') {
|
||||||
|
element.classList.remove(className);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
element.classList.add(`fa-${newClass}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
field_icon.addEventListener('keyup', function() {
|
||||||
|
updateIconClass(this.nextElementSibling, this.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
field_icon.addEventListener('blur', function() {
|
||||||
|
updateIconClass(this.nextElementSibling, this.value);
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run onload functions
|
* Run onload functions
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<form method="post" action="#" id="language_selector">
|
<form method="post" action="#" id="language_selector">
|
||||||
<fieldset class="nobg">
|
<fieldset class="nobg">
|
||||||
<label for="language">{L_SELECT_LANG}{L_COLON}</label>
|
<label for="language">{L_SELECT_LANG}{L_COLON}</label>
|
||||||
<select id="language" name="language">
|
<select id="language" name="language">
|
||||||
<!-- BEGIN language_select_item -->
|
<!-- BEGIN language_select_item -->
|
||||||
<option value="{language_select_item.VALUE}"<!-- IF language_select_item.SELECTED --> selected="selected"<!-- ENDIF -->>{language_select_item.NAME}</option>
|
<option value="{language_select_item.VALUE}"<!-- IF language_select_item.SELECTED --> selected="selected"<!-- ENDIF -->>{language_select_item.NAME}</option>
|
||||||
<!-- END language_select_item -->
|
<!-- END language_select_item -->
|
||||||
|
|
|
@ -33,11 +33,10 @@
|
||||||
"ext-sodium": "*",
|
"ext-sodium": "*",
|
||||||
"bantu/ini-get-wrapper": "~1.0",
|
"bantu/ini-get-wrapper": "~1.0",
|
||||||
"carlos-mg89/oauth": "^0.8.15",
|
"carlos-mg89/oauth": "^0.8.15",
|
||||||
"chita/topological_sort": "^3.0",
|
|
||||||
"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",
|
||||||
|
|
81
phpBB/composer.lock
generated
81
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",
|
||||||
|
@ -171,49 +171,6 @@
|
||||||
},
|
},
|
||||||
"time": "2025-02-08T12:14:07+00:00"
|
"time": "2025-02-08T12:14:07+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "chita/topological_sort",
|
|
||||||
"version": "v3.0.1",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/CHItA/TopologicalSort.git",
|
|
||||||
"reference": "9e0401c712d0c7cf012f264cc105669844d2479e"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/CHItA/TopologicalSort/zipball/9e0401c712d0c7cf012f264cc105669844d2479e",
|
|
||||||
"reference": "9e0401c712d0c7cf012f264cc105669844d2479e",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=7.1.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^7.0"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"CHItA\\TopologicalSort\\": "src/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Máté Bartus",
|
|
||||||
"email": "mate.bartus@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Topological sort function",
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/CHItA/TopologicalSort/issues",
|
|
||||||
"source": "https://github.com/CHItA/TopologicalSort/tree/v3.0.1"
|
|
||||||
},
|
|
||||||
"time": "2021-01-04T21:31:59+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "composer/ca-bundle",
|
"name": "composer/ca-bundle",
|
||||||
"version": "1.5.6",
|
"version": "1.5.6",
|
||||||
|
@ -1171,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."
|
||||||
|
@ -1262,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": [
|
||||||
{
|
{
|
||||||
|
@ -1278,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:
|
||||||
|
|
|
@ -360,6 +360,7 @@ class acp_profile
|
||||||
$field_row = array_merge($profile_field->get_default_option_values(), array(
|
$field_row = array_merge($profile_field->get_default_option_values(), array(
|
||||||
'field_ident' => str_replace(' ', '_', utf8_clean_string($request->variable('field_ident', '', true))),
|
'field_ident' => str_replace(' ', '_', utf8_clean_string($request->variable('field_ident', '', true))),
|
||||||
'field_required' => 0,
|
'field_required' => 0,
|
||||||
|
'field_icon' => json_encode(['name' => '', 'color' => '']),
|
||||||
'field_show_novalue'=> 0,
|
'field_show_novalue'=> 0,
|
||||||
'field_hide' => 0,
|
'field_hide' => 0,
|
||||||
'field_show_profile'=> 0,
|
'field_show_profile'=> 0,
|
||||||
|
@ -381,7 +382,7 @@ class acp_profile
|
||||||
|
|
||||||
// $exclude contains the data we gather in each step
|
// $exclude contains the data we gather in each step
|
||||||
$exclude = array(
|
$exclude = array(
|
||||||
1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_show_on_ml', 'field_required', 'field_show_novalue', 'field_hide', 'field_show_profile', 'field_no_view', 'field_is_contact', 'field_contact_desc', 'field_contact_url'),
|
1 => array('field_ident', 'field_icon', 'field_icon_color', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_show_on_ml', 'field_required', 'field_show_novalue', 'field_hide', 'field_show_profile', 'field_no_view', 'field_is_contact', 'field_contact_desc', 'field_contact_url'),
|
||||||
2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'),
|
2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'),
|
||||||
3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options')
|
3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options')
|
||||||
);
|
);
|
||||||
|
@ -427,6 +428,13 @@ class acp_profile
|
||||||
|
|
||||||
$options = $profile_field->prepare_options_form($exclude, $visibility_ary);
|
$options = $profile_field->prepare_options_form($exclude, $visibility_ary);
|
||||||
|
|
||||||
|
$field_icon_data = json_decode($field_row['field_icon'], true);
|
||||||
|
$field_icon_name = $request->variable('field_icon', $field_icon_data['name'] ?: '');
|
||||||
|
$field_icon_color = $field_icon_name ? $request->variable('field_icon_color', $field_icon_data['color'] ?: '') : '';
|
||||||
|
$cp->vars['field_icon'] = json_encode([
|
||||||
|
'name' => $field_icon_name,
|
||||||
|
'color' => $field_icon_color,
|
||||||
|
]);
|
||||||
$cp->vars['field_ident'] = ($action == 'create' && $step == 1) ? utf8_clean_string($request->variable('field_ident', $field_row['field_ident'], true)) : $request->variable('field_ident', $field_row['field_ident']);
|
$cp->vars['field_ident'] = ($action == 'create' && $step == 1) ? utf8_clean_string($request->variable('field_ident', $field_row['field_ident'], true)) : $request->variable('field_ident', $field_row['field_ident']);
|
||||||
$cp->vars['lang_name'] = $request->variable('lang_name', $field_row['lang_name'], true);
|
$cp->vars['lang_name'] = $request->variable('lang_name', $field_row['lang_name'], true);
|
||||||
$cp->vars['lang_explain'] = $request->variable('lang_explain', $field_row['lang_explain'], true);
|
$cp->vars['lang_explain'] = $request->variable('lang_explain', $field_row['lang_explain'], true);
|
||||||
|
@ -630,6 +638,7 @@ class acp_profile
|
||||||
{
|
{
|
||||||
// Create basic options - only small differences between field types
|
// Create basic options - only small differences between field types
|
||||||
case 1:
|
case 1:
|
||||||
|
$field_icon_data = json_decode($cp->vars['field_icon'], true);
|
||||||
$template_vars = array(
|
$template_vars = array(
|
||||||
'S_STEP_ONE' => true,
|
'S_STEP_ONE' => true,
|
||||||
'S_FIELD_REQUIRED' => ($cp->vars['field_required']) ? true : false,
|
'S_FIELD_REQUIRED' => ($cp->vars['field_required']) ? true : false,
|
||||||
|
@ -648,6 +657,8 @@ class acp_profile
|
||||||
'L_LANG_SPECIFIC' => sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], $config['default_lang']),
|
'L_LANG_SPECIFIC' => sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], $config['default_lang']),
|
||||||
'FIELD_TYPE' => $profile_field->get_name(),
|
'FIELD_TYPE' => $profile_field->get_name(),
|
||||||
'FIELD_IDENT' => $cp->vars['field_ident'],
|
'FIELD_IDENT' => $cp->vars['field_ident'],
|
||||||
|
'FIELD_ICON' => $field_icon_data['name'],
|
||||||
|
'FIELD_ICON_COLOR' => $field_icon_data['color'],
|
||||||
'LANG_NAME' => $cp->vars['lang_name'],
|
'LANG_NAME' => $cp->vars['lang_name'],
|
||||||
'LANG_EXPLAIN' => $cp->vars['lang_explain'],
|
'LANG_EXPLAIN' => $cp->vars['lang_explain'],
|
||||||
);
|
);
|
||||||
|
@ -984,6 +995,7 @@ class acp_profile
|
||||||
'field_is_contact' => $cp->vars['field_is_contact'],
|
'field_is_contact' => $cp->vars['field_is_contact'],
|
||||||
'field_contact_desc' => $cp->vars['field_contact_desc'],
|
'field_contact_desc' => $cp->vars['field_contact_desc'],
|
||||||
'field_contact_url' => $cp->vars['field_contact_url'],
|
'field_contact_url' => $cp->vars['field_contact_url'],
|
||||||
|
'field_icon' => $cp->vars['field_icon'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$field_data = $cp->vars;
|
$field_data = $cp->vars;
|
||||||
|
|
|
@ -373,8 +373,11 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||||
|
|
||||||
if ($cp_block_row['S_PROFILE_CONTACT'])
|
if ($cp_block_row['S_PROFILE_CONTACT'])
|
||||||
{
|
{
|
||||||
|
$icon_data = json_decode($cp_block_row['PROFILE_FIELD_ICON'], true);
|
||||||
$template->assign_block_vars('contact', array(
|
$template->assign_block_vars('contact', array(
|
||||||
'ID' => $cp_block_row['PROFILE_FIELD_IDENT'],
|
'ID' => $cp_block_row['PROFILE_FIELD_IDENT'],
|
||||||
|
'ICON' => $icon_data['name'],
|
||||||
|
'ICON_COLOR'=> $icon_data['color'],
|
||||||
'NAME' => $cp_block_row['PROFILE_FIELD_NAME'],
|
'NAME' => $cp_block_row['PROFILE_FIELD_NAME'],
|
||||||
'U_CONTACT' => $cp_block_row['PROFILE_FIELD_CONTACT'],
|
'U_CONTACT' => $cp_block_row['PROFILE_FIELD_CONTACT'],
|
||||||
));
|
));
|
||||||
|
|
|
@ -93,6 +93,9 @@ $lang = array_merge($lang, array(
|
||||||
'FIELD_DESCRIPTION' => 'Field description',
|
'FIELD_DESCRIPTION' => 'Field description',
|
||||||
'FIELD_DESCRIPTION_EXPLAIN' => 'The explanation for this field presented to the user.',
|
'FIELD_DESCRIPTION_EXPLAIN' => 'The explanation for this field presented to the user.',
|
||||||
'FIELD_DROPDOWN' => 'Dropdown box',
|
'FIELD_DROPDOWN' => 'Dropdown box',
|
||||||
|
'FIELD_ICON' => 'Field icon',
|
||||||
|
'FIELD_ICON_COLOR' => 'Icon colour',
|
||||||
|
'FIELD_ICON_EXPLAIN' => 'Enter a Font Awesome icon name to display with this contact field. Optionally, set its colour using a 6-digit hex code or the colour picker. Leave blank to use phpBB’s default icon and clear the colour.',
|
||||||
'FIELD_IDENT' => 'Field identification',
|
'FIELD_IDENT' => 'Field identification',
|
||||||
'FIELD_IDENT_ALREADY_EXIST' => 'The chosen field identification already exist. Please choose another name.',
|
'FIELD_IDENT_ALREADY_EXIST' => 'The chosen field identification already exist. Please choose another name.',
|
||||||
'FIELD_IDENT_EXPLAIN' => 'The field identification is a name to identify the profile field within the database and the templates.',
|
'FIELD_IDENT_EXPLAIN' => 'The field identification is a name to identify the profile field within the database and the templates.',
|
||||||
|
|
|
@ -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',
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1681,6 +1681,18 @@ switch ($mode)
|
||||||
$memberrow = array_merge($memberrow, $cp_row['row']);
|
$memberrow = array_merge($memberrow, $cp_row['row']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify the memberrow data before template variables are assigned.
|
||||||
|
*
|
||||||
|
* @event core.memberlist_modify_memberrow
|
||||||
|
* @var int user_id The current user ID.
|
||||||
|
* @var array row Array of raw user data.
|
||||||
|
* @var array memberrow Array of member template variables.
|
||||||
|
* @since 3.3.16-RC1
|
||||||
|
*/
|
||||||
|
$vars = ['user_id', 'row', 'memberrow'];
|
||||||
|
extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_memberrow', compact($vars)));
|
||||||
|
|
||||||
$template->assign_block_vars('memberrow', $memberrow);
|
$template->assign_block_vars('memberrow', $memberrow);
|
||||||
|
|
||||||
if (isset($cp_row['blockrow']) && count($cp_row['blockrow']))
|
if (isset($cp_row['blockrow']) && count($cp_row['blockrow']))
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?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\db\migration\data\v400;
|
||||||
|
|
||||||
|
class custom_profile_field_contact_icon extends \phpbb\db\migration\migration
|
||||||
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields', 'field_icon');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function depends_on()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'\phpbb\db\migration\data\v400\dev',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update_schema()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'add_columns' => [
|
||||||
|
$this->table_prefix . 'profile_fields' => [
|
||||||
|
'field_icon' => array('VCHAR:255', json_encode(['name' => '', 'color' => ''])),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function revert_schema()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'drop_columns' => array(
|
||||||
|
$this->table_prefix . 'profile_fields' => array(
|
||||||
|
'field_icon',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,21 +14,17 @@
|
||||||
namespace phpbb\db\migration;
|
namespace phpbb\db\migration;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use LogicException;
|
|
||||||
use phpbb\config\config;
|
use phpbb\config\config;
|
||||||
use phpbb\db\driver\driver_interface;
|
use phpbb\db\driver\driver_interface;
|
||||||
use phpbb\db\migrator;
|
use phpbb\db\migrator;
|
||||||
use phpbb\db\tools\tools_interface;
|
use phpbb\db\tools\tools_interface;
|
||||||
use UnexpectedValueException;
|
use UnexpectedValueException;
|
||||||
use CHItA\TopologicalSort\TopologicalSort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The schema generator generates the schema based on the existing migrations
|
* The schema generator generates the schema based on the existing migrations
|
||||||
*/
|
*/
|
||||||
class schema_generator
|
class schema_generator
|
||||||
{
|
{
|
||||||
use TopologicalSort;
|
|
||||||
|
|
||||||
/** @var config */
|
/** @var config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
|
@ -103,24 +99,56 @@ class schema_generator
|
||||||
return $this->tables;
|
return $this->tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
$migrations = $this->class_names;
|
$dependency_counts = [];
|
||||||
$filter = function($class_name) {
|
$dependencies = [];
|
||||||
return !migrator::is_migration($class_name);
|
$applicable_migrations = [];
|
||||||
};
|
$migration_count = 0;
|
||||||
|
foreach ($this->class_names as $class_name)
|
||||||
$edges = function($class_name) {
|
|
||||||
return $class_name::depends_on();
|
|
||||||
};
|
|
||||||
|
|
||||||
$apply_for_each = function($class_name) {
|
|
||||||
$this->apply_migration_to_schema($class_name);
|
|
||||||
};
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
$this->topologicalSort($migrations, $edges, true, $apply_for_each, $filter);
|
if (!migrator::is_migration($class_name))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$migration_count++;
|
||||||
|
$migration_dependencies = $class_name::depends_on();
|
||||||
|
if (empty($migration_dependencies))
|
||||||
|
{
|
||||||
|
$applicable_migrations[] = $class_name;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dependency_counts[$class_name] = count($migration_dependencies);
|
||||||
|
foreach ($migration_dependencies as $migration_dependency)
|
||||||
|
{
|
||||||
|
$dependencies[$migration_dependency][] = $class_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (LogicException $e)
|
|
||||||
|
$applied_migrations = 0;
|
||||||
|
while (!empty($applicable_migrations))
|
||||||
|
{
|
||||||
|
$migration = array_pop($applicable_migrations);
|
||||||
|
$this->apply_migration_to_schema($migration);
|
||||||
|
++$applied_migrations;
|
||||||
|
|
||||||
|
if (!array_key_exists($migration, $dependencies))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dependents = $dependencies[$migration];
|
||||||
|
foreach ($dependents as $dependent)
|
||||||
|
{
|
||||||
|
$dependency_counts[$dependent]--;
|
||||||
|
if ($dependency_counts[$dependent] === 0)
|
||||||
|
{
|
||||||
|
$applicable_migrations[] = $dependent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($migration_count !== $applied_migrations)
|
||||||
{
|
{
|
||||||
throw new UnexpectedValueException(
|
throw new UnexpectedValueException(
|
||||||
"Migrations either have circular dependencies or unsatisfiable dependencies."
|
"Migrations either have circular dependencies or unsatisfiable dependencies."
|
||||||
|
|
|
@ -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()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -339,6 +339,14 @@ class helper
|
||||||
protected function render_language_select($selected_language = null)
|
protected function render_language_select($selected_language = null)
|
||||||
{
|
{
|
||||||
$langs = $this->lang_helper->get_available_languages();
|
$langs = $this->lang_helper->get_available_languages();
|
||||||
|
|
||||||
|
// The first language will be selected by default. Unless a user has consciously included
|
||||||
|
// other languages in the installation process, it will be British English anyway.
|
||||||
|
if ($selected_language === null && count($langs))
|
||||||
|
{
|
||||||
|
$selected_language = $langs[0]['iso'];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($langs as $lang)
|
foreach ($langs as $lang)
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('language_select_item', array(
|
$this->template->assign_block_vars('language_select_item', array(
|
||||||
|
|
|
@ -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,17 +443,35 @@ class database
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'postgres':
|
case 'postgres':
|
||||||
$sql = "SHOW server_encoding;";
|
if (version_compare($db_server_version, '9.4', '<'))
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$row = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
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',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = "SHOW server_encoding;";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
|
||||||
|
{
|
||||||
|
$errors[] = array(
|
||||||
|
'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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,31 +145,29 @@ class check_filesystem extends \phpbb\install\task_base
|
||||||
// Try to create file if it does not exists
|
// Try to create file if it does not exists
|
||||||
if (!file_exists($path))
|
if (!file_exists($path))
|
||||||
{
|
{
|
||||||
$fp = @fopen($path, 'w');
|
if (!is_resource($fp = @fopen($path, 'w')))
|
||||||
@fclose($fp);
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
$this->filesystem->phpbb_chmod($path,
|
$exists = $writable = false;
|
||||||
\phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE
|
|
||||||
);
|
|
||||||
$exists = true;
|
|
||||||
}
|
}
|
||||||
catch (\phpbb\filesystem\exception\filesystem_exception $e)
|
else
|
||||||
{
|
{
|
||||||
// Do nothing
|
@fclose($fp);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$this->filesystem->phpbb_chmod($path,
|
||||||
|
\phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE
|
||||||
|
);
|
||||||
|
$exists = true;
|
||||||
|
}
|
||||||
|
catch (\phpbb\filesystem\exception\filesystem_exception $e)
|
||||||
|
{
|
||||||
|
$writable = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!$this->filesystem->is_writable($path))
|
||||||
if (file_exists($path))
|
|
||||||
{
|
{
|
||||||
if (!$this->filesystem->is_writable($path))
|
$writable = false;
|
||||||
{
|
|
||||||
$writable = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$exists = $writable = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->set_test_passed(($exists && $writable) || $failable);
|
$this->set_test_passed(($exists && $writable) || $failable);
|
||||||
|
|
|
@ -65,6 +65,8 @@ class language_file_helper
|
||||||
$available_languages[] = $this->get_language_data_from_json($data);
|
$available_languages[] = $this->get_language_data_from_json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usort($available_languages, [$this, 'sort_by_local_name']);
|
||||||
|
|
||||||
return $available_languages;
|
return $available_languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,4 +125,16 @@ class language_file_helper
|
||||||
'turnstile_lang' => $data['extra']['turnstile-lang'] ?? '',
|
'turnstile_lang' => $data['extra']['turnstile-lang'] ?? '',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts the languages by their name instead of iso code
|
||||||
|
*
|
||||||
|
* @param mixed $a First language data
|
||||||
|
* @param mixed $b Second language data
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
private static function sort_by_local_name(mixed $a, mixed $b): int
|
||||||
|
{
|
||||||
|
return $a['local_name'] <=> $b['local_name'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,6 +332,7 @@ class manager
|
||||||
|
|
||||||
$tpl_fields[] = [
|
$tpl_fields[] = [
|
||||||
'PROFILE_FIELD_IDENT' => $field_ident,
|
'PROFILE_FIELD_IDENT' => $field_ident,
|
||||||
|
'PROFILE_FIELD_ICON' => $field_data['field_icon'],
|
||||||
'PROFILE_FIELD_TYPE' => $field_data['field_type'],
|
'PROFILE_FIELD_TYPE' => $field_data['field_type'],
|
||||||
'PROFILE_FIELD_NAME' => $profile_field->get_field_name($field_data['lang_name']),
|
'PROFILE_FIELD_NAME' => $profile_field->get_field_name($field_data['lang_name']),
|
||||||
'PROFILE_FIELD_EXPLAIN' => $this->language->lang($field_data['lang_explain']),
|
'PROFILE_FIELD_EXPLAIN' => $this->language->lang($field_data['lang_explain']),
|
||||||
|
@ -484,6 +485,7 @@ class manager
|
||||||
|
|
||||||
$tpl_fields['row'] += [
|
$tpl_fields['row'] += [
|
||||||
"PROFILE_{$ident_upper}_IDENT" => $ident,
|
"PROFILE_{$ident_upper}_IDENT" => $ident,
|
||||||
|
"PROFILE_{$ident_upper}_ICON" => $ident_ary['data']['field_icon'],
|
||||||
"PROFILE_{$ident_upper}_VALUE" => $value,
|
"PROFILE_{$ident_upper}_VALUE" => $value,
|
||||||
"PROFILE_{$ident_upper}_VALUE_RAW" => $value_raw,
|
"PROFILE_{$ident_upper}_VALUE_RAW" => $value_raw,
|
||||||
"PROFILE_{$ident_upper}_CONTACT" => $contact_url,
|
"PROFILE_{$ident_upper}_CONTACT" => $contact_url,
|
||||||
|
@ -498,6 +500,7 @@ class manager
|
||||||
|
|
||||||
$tpl_fields['blockrow'][] = [
|
$tpl_fields['blockrow'][] = [
|
||||||
'PROFILE_FIELD_IDENT' => $ident,
|
'PROFILE_FIELD_IDENT' => $ident,
|
||||||
|
'PROFILE_FIELD_ICON' => $ident_ary['data']['field_icon'],
|
||||||
'PROFILE_FIELD_VALUE' => $value,
|
'PROFILE_FIELD_VALUE' => $value,
|
||||||
'PROFILE_FIELD_VALUE_RAW' => $value_raw,
|
'PROFILE_FIELD_VALUE_RAW' => $value_raw,
|
||||||
'PROFILE_FIELD_CONTACT' => $contact_url,
|
'PROFILE_FIELD_CONTACT' => $contact_url,
|
||||||
|
|
|
@ -161,6 +161,16 @@ class environment extends \Twig\Environment
|
||||||
return $this->assets_bag;
|
return $this->assets_bag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the event dispatcher instance
|
||||||
|
*
|
||||||
|
* @return dispatcher_interface
|
||||||
|
*/
|
||||||
|
public function get_phpbb_dispatcher()
|
||||||
|
{
|
||||||
|
return $this->phpbb_dispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the namespace look up order
|
* Get the namespace look up order
|
||||||
*
|
*
|
||||||
|
|
|
@ -24,9 +24,13 @@ class event extends \Twig\Node\Node
|
||||||
/** @var \phpbb\template\twig\environment */
|
/** @var \phpbb\template\twig\environment */
|
||||||
protected $environment;
|
protected $environment;
|
||||||
|
|
||||||
public function __construct(\Twig\Node\Expression\AbstractExpression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null)
|
/** @var array */
|
||||||
|
protected $template_event_priority_array;
|
||||||
|
|
||||||
|
public function __construct(\Twig\Node\Expression\AbstractExpression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null, $template_event_priority_array = [])
|
||||||
{
|
{
|
||||||
$this->environment = $environment;
|
$this->environment = $environment;
|
||||||
|
$this->template_event_priority_array = $template_event_priority_array;
|
||||||
|
|
||||||
parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
|
parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
|
||||||
}
|
}
|
||||||
|
@ -42,10 +46,20 @@ class event extends \Twig\Node\Node
|
||||||
|
|
||||||
$location = $this->listener_directory . $this->getNode('expr')->getAttribute('name');
|
$location = $this->listener_directory . $this->getNode('expr')->getAttribute('name');
|
||||||
|
|
||||||
|
$template_event_listeners = [];
|
||||||
|
|
||||||
|
// Group and sort extension template events in according to their priority (0 by default if not set)
|
||||||
foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path)
|
foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path)
|
||||||
{
|
{
|
||||||
$ext_namespace = str_replace('/', '_', $ext_namespace);
|
$ext_namespace = str_replace('/', '_', $ext_namespace);
|
||||||
|
$priority_key = intval($this->template_event_priority_array[$ext_namespace][$location] ?? 0);
|
||||||
|
$template_event_listeners[$priority_key][] = $ext_namespace;
|
||||||
|
}
|
||||||
|
krsort($template_event_listeners);
|
||||||
|
|
||||||
|
$template_event_listeners = array_merge(...$template_event_listeners);
|
||||||
|
foreach ($template_event_listeners as $ext_namespace)
|
||||||
|
{
|
||||||
if ($this->environment->isDebug())
|
if ($this->environment->isDebug())
|
||||||
{
|
{
|
||||||
// If debug mode is enabled, lets check for new/removed EVENT
|
// If debug mode is enabled, lets check for new/removed EVENT
|
||||||
|
@ -54,8 +68,7 @@ class event extends \Twig\Node\Node
|
||||||
// purge the cache when a new event template file is added)
|
// purge the cache when a new event template file is added)
|
||||||
$compiler
|
$compiler
|
||||||
->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n")
|
->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n")
|
||||||
->indent()
|
->indent();
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->environment->isDebug() || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html'))
|
if ($this->environment->isDebug() || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html'))
|
||||||
|
@ -66,16 +79,14 @@ class event extends \Twig\Node\Node
|
||||||
// We set the namespace lookup order to be this extension first, then the main path
|
// We set the namespace lookup order to be this extension first, then the main path
|
||||||
->write("\$this->env->setNamespaceLookUpOrder(array('{$ext_namespace}', '__main__'));\n")
|
->write("\$this->env->setNamespaceLookUpOrder(array('{$ext_namespace}', '__main__'));\n")
|
||||||
->write("\$this->env->loadTemplate(\$this->env->getTemplateClass('@{$ext_namespace}/{$location}.html'), '@{$ext_namespace}/{$location}.html')->display(\$context);\n")
|
->write("\$this->env->loadTemplate(\$this->env->getTemplateClass('@{$ext_namespace}/{$location}.html'), '@{$ext_namespace}/{$location}.html')->display(\$context);\n")
|
||||||
->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n")
|
->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n");
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->environment->isDebug())
|
if ($this->environment->isDebug())
|
||||||
{
|
{
|
||||||
$compiler
|
$compiler
|
||||||
->outdent()
|
->outdent()
|
||||||
->write("}\n\n")
|
->write("}\n\n");
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,9 @@ class event extends \Twig\TokenParser\AbstractTokenParser
|
||||||
/** @var \phpbb\template\twig\environment */
|
/** @var \phpbb\template\twig\environment */
|
||||||
protected $environment;
|
protected $environment;
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
protected $template_event_priority_array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
@ -26,6 +29,25 @@ class event extends \Twig\TokenParser\AbstractTokenParser
|
||||||
public function __construct(\phpbb\template\twig\environment $environment)
|
public function __construct(\phpbb\template\twig\environment $environment)
|
||||||
{
|
{
|
||||||
$this->environment = $environment;
|
$this->environment = $environment;
|
||||||
|
$phpbb_dispatcher = $this->environment->get_phpbb_dispatcher();
|
||||||
|
|
||||||
|
$template_event_priority_array = [];
|
||||||
|
/**
|
||||||
|
* Allows assigning priority to template event listeners
|
||||||
|
*
|
||||||
|
* @event core.twig_event_tokenparser_constructor
|
||||||
|
* @var array template_event_priority_array Array with template event priority assignments per extension namespace
|
||||||
|
*
|
||||||
|
* @since 4.0.0-a1
|
||||||
|
*/
|
||||||
|
if ($phpbb_dispatcher)
|
||||||
|
{
|
||||||
|
$vars = ['template_event_priority_array'];
|
||||||
|
extract($phpbb_dispatcher->trigger_event('core.twig_event_tokenparser_constructor', compact($vars)));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->template_event_priority_array = $template_event_priority_array;
|
||||||
|
unset($template_event_priority_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +64,7 @@ class event extends \Twig\TokenParser\AbstractTokenParser
|
||||||
$stream = $this->parser->getStream();
|
$stream = $this->parser->getStream();
|
||||||
$stream->expect(\Twig\Token::BLOCK_END_TYPE);
|
$stream->expect(\Twig\Token::BLOCK_END_TYPE);
|
||||||
|
|
||||||
return new \phpbb\template\twig\node\event($expr, $this->environment, $token->getLine(), $this->getTag());
|
return new \phpbb\template\twig\node\event($expr, $this->environment, $token->getLine(), $this->getTag(), $this->template_event_priority_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,7 +88,10 @@ class twig extends \phpbb\template\base
|
||||||
|
|
||||||
foreach ($extensions as $extension)
|
foreach ($extensions as $extension)
|
||||||
{
|
{
|
||||||
$this->twig->addExtension($extension);
|
if (!$this->twig->hasExtension(get_class($extension)))
|
||||||
|
{
|
||||||
|
$this->twig->addExtension($extension);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add admin namespace
|
// Add admin namespace
|
||||||
|
|
|
@ -34,41 +34,48 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getNotificationUrl = '{{ U_WEBPUSH_GET_NOTIFICATION }}';
|
event.waitUntil((async() => {
|
||||||
const assetsVersion = parseInt('{{ ASSETS_VERSION }}', 10);
|
const getNotificationUrl = '{{ U_WEBPUSH_GET_NOTIFICATION }}';
|
||||||
|
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();
|
||||||
formData.append('item_id', itemId.toString(10));
|
formData.append('item_id', itemId.toString(10));
|
||||||
formData.append('type_id', typeId.toString(10));
|
formData.append('type_id', typeId.toString(10));
|
||||||
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 {
|
||||||
method: 'POST',
|
const response = await fetch(getNotificationUrl, {
|
||||||
headers: {
|
method: 'POST',
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
headers: {
|
||||||
},
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
body: formData,
|
},
|
||||||
})
|
body: formData,
|
||||||
.then(response => response.json())
|
});
|
||||||
.then(response => {
|
|
||||||
const responseBody = response.title + '\n' + response.text;
|
const responseData = await response.json();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
})());
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -71,7 +71,10 @@
|
||||||
<div>
|
<div>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<a href="<!-- IF contact.U_CONTACT -->{contact.U_CONTACT}<!-- ELSE -->{contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF -->>
|
<a href="<!-- IF contact.U_CONTACT -->{contact.U_CONTACT}<!-- ELSE -->{contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF -->>
|
||||||
{% if contact.ID == 'pm' %}
|
{% if contact.ICON %}
|
||||||
|
{% set color = contact.ICON_COLOR ? ({style: 'color: #' ~ contact.ICON_COLOR}) : [] %}
|
||||||
|
{{ Icon('font', contact.ICON, '', true, '', color) }}
|
||||||
|
{% elseif contact.ID == 'pm' %}
|
||||||
{{ Icon('font', 'message', '', true, 'far contact-icon') }}
|
{{ Icon('font', 'message', '', true, 'far contact-icon') }}
|
||||||
{% elseif contact.ID == 'email' %}
|
{% elseif contact.ID == 'email' %}
|
||||||
{{ Icon('font', 'at', '', true, 'fas contact-icon') }}
|
{{ Icon('font', 'at', '', true, 'fas contact-icon') }}
|
||||||
|
@ -149,6 +152,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>
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,10 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<a href="<!-- IF postrow.contact.U_CONTACT -->{postrow.contact.U_CONTACT}<!-- ELSE -->{postrow.U_POST_AUTHOR}<!-- ENDIF -->" title="{postrow.contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF -->>
|
<a href="<!-- IF postrow.contact.U_CONTACT -->{postrow.contact.U_CONTACT}<!-- ELSE -->{postrow.U_POST_AUTHOR}<!-- ENDIF -->" title="{postrow.contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF -->>
|
||||||
{% EVENT viewtopic_body_contact_icon_prepend %}
|
{% EVENT viewtopic_body_contact_icon_prepend %}
|
||||||
{% if postrow.contact.ID == 'pm' %}
|
{% if postrow.contact.ICON %}
|
||||||
|
{% set color = postrow.contact.ICON_COLOR ? ({style: 'color: #' ~ contact.ICON_COLOR}) : [] %}
|
||||||
|
{{ Icon('font', contact.ICON, '', true, '', color) }}
|
||||||
|
{% elseif postrow.contact.ID == 'pm' %}
|
||||||
{{ Icon('font', 'message', '', true, 'far contact-icon') }}
|
{{ Icon('font', 'message', '', true, 'far contact-icon') }}
|
||||||
{% elseif postrow.contact.ID == 'email' %}
|
{% elseif postrow.contact.ID == 'email' %}
|
||||||
{{ Icon('font', 'at', '', true, 'fas contact-icon') }}
|
{{ Icon('font', 'at', '', true, 'fas contact-icon') }}
|
||||||
|
|
|
@ -2193,8 +2193,11 @@ for ($i = 0, $end = count($post_list); $i < $end; ++$i)
|
||||||
|
|
||||||
if ($field_data['S_PROFILE_CONTACT'])
|
if ($field_data['S_PROFILE_CONTACT'])
|
||||||
{
|
{
|
||||||
|
$icon_data = json_decode($field_data['PROFILE_FIELD_ICON'], true);
|
||||||
$template->assign_block_vars('postrow.contact', array(
|
$template->assign_block_vars('postrow.contact', array(
|
||||||
'ID' => $field_data['PROFILE_FIELD_IDENT'],
|
'ID' => $field_data['PROFILE_FIELD_IDENT'],
|
||||||
|
'ICON' => $icon_data['name'],
|
||||||
|
'ICON_COLOR'=> $icon_data['color'],
|
||||||
'NAME' => $field_data['PROFILE_FIELD_NAME'],
|
'NAME' => $field_data['PROFILE_FIELD_NAME'],
|
||||||
'U_CONTACT' => $field_data['PROFILE_FIELD_CONTACT'],
|
'U_CONTACT' => $field_data['PROFILE_FIELD_CONTACT'],
|
||||||
));
|
));
|
||||||
|
|
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/cron/foo?f=5" 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,8 +16,6 @@
|
||||||
*/
|
*/
|
||||||
class phpbb_functional_extension_controller_test extends phpbb_functional_test_case
|
class phpbb_functional_extension_controller_test extends phpbb_functional_test_case
|
||||||
{
|
{
|
||||||
protected $phpbb_extension_manager;
|
|
||||||
|
|
||||||
private static $helper;
|
private static $helper;
|
||||||
|
|
||||||
protected static $fixtures = array(
|
protected static $fixtures = array(
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
*/
|
*/
|
||||||
class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_case
|
class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_case
|
||||||
{
|
{
|
||||||
protected $phpbb_extension_manager;
|
|
||||||
|
|
||||||
private static $helper;
|
private static $helper;
|
||||||
|
|
||||||
protected static $fixtures = array(
|
protected static $fixtures = array(
|
||||||
|
|
|
@ -17,8 +17,6 @@ require_once __DIR__ . '/../../phpBB/includes/acp/acp_modules.php';
|
||||||
*/
|
*/
|
||||||
class phpbb_functional_extension_module_test extends phpbb_functional_test_case
|
class phpbb_functional_extension_module_test extends phpbb_functional_test_case
|
||||||
{
|
{
|
||||||
protected $phpbb_extension_manager;
|
|
||||||
|
|
||||||
private static $helper;
|
private static $helper;
|
||||||
|
|
||||||
protected static $fixtures = array(
|
protected static $fixtures = array(
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
*/
|
*/
|
||||||
class phpbb_functional_extension_permission_lang_test extends phpbb_functional_test_case
|
class phpbb_functional_extension_permission_lang_test extends phpbb_functional_test_case
|
||||||
{
|
{
|
||||||
protected $phpbb_extension_manager;
|
|
||||||
|
|
||||||
private static $helper;
|
private static $helper;
|
||||||
|
|
||||||
protected static $fixtures = array(
|
protected static $fixtures = array(
|
||||||
|
|
105
tests/functional/extension_template_event_order_test.php
Normal file
105
tests/functional/extension_template_event_order_test.php
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
<?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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group functional
|
||||||
|
*/
|
||||||
|
class phpbb_functional_extension_template_event_order_test extends phpbb_functional_test_case
|
||||||
|
{
|
||||||
|
static private $helper;
|
||||||
|
|
||||||
|
static protected $fixtures = [
|
||||||
|
'./',
|
||||||
|
];
|
||||||
|
|
||||||
|
static public function setUpBeforeClass(): void
|
||||||
|
{
|
||||||
|
parent::setUpBeforeClass();
|
||||||
|
|
||||||
|
self::$helper = new phpbb_test_case_helpers(__CLASS__);
|
||||||
|
self::$helper->copy_ext_fixtures(__DIR__ . '/fixtures/ext/', self::$fixtures);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function tearDownAfterClass(): void
|
||||||
|
{
|
||||||
|
parent::tearDownAfterClass();
|
||||||
|
|
||||||
|
self::$helper->restore_original_ext_dir();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->purge_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
$this->uninstall_ext('foo/bar');
|
||||||
|
$this->uninstall_ext('foo/foo');
|
||||||
|
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function setup_extensions()
|
||||||
|
{
|
||||||
|
return ['foo/bar', 'foo/foo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check extensions template event listener prioritizing
|
||||||
|
*/
|
||||||
|
public function test_different_template_event_priority()
|
||||||
|
{
|
||||||
|
global $phpbb_root_path;
|
||||||
|
|
||||||
|
$crawler = self::request('GET', 'index.php');
|
||||||
|
$quick_links_menu = $crawler->filter('ul[role="menu"]')->eq(0);
|
||||||
|
$quick_links_menu_nodes_count = (int) $quick_links_menu->filter('li')->count();
|
||||||
|
// Ensure foo/foo template event goes before foo/bar one
|
||||||
|
$this->assertStringContainsString('FOO_FOO_QUICK_LINK', $quick_links_menu->filter('li')->eq($quick_links_menu_nodes_count - 4)->filter('span')->text());
|
||||||
|
$this->assertStringContainsString('FOO_BAR_QUICK_LINK', $quick_links_menu->filter('li')->eq($quick_links_menu_nodes_count - 3)->filter('span')->text());
|
||||||
|
|
||||||
|
// Change template events order to default, put foo/bar event before foo/foo one
|
||||||
|
$this->disable_ext('foo/bar');
|
||||||
|
$this->disable_ext('foo/foo');
|
||||||
|
|
||||||
|
$this->assertTrue(copy(__DIR__ . '/fixtures/ext/foo/bar/event/template_event_order_higher.php', $phpbb_root_path . 'ext/foo/bar/event/template_event_order.php'));
|
||||||
|
$this->assertTrue(copy(__DIR__ . '/fixtures/ext/foo/foo/event/template_event_order_lower.php', $phpbb_root_path . 'ext/foo/foo/event/template_event_order.php'));
|
||||||
|
|
||||||
|
$this->install_ext('foo/bar');
|
||||||
|
$this->install_ext('foo/foo');
|
||||||
|
|
||||||
|
$crawler = self::request('GET', 'index.php');
|
||||||
|
$quick_links_menu = $crawler->filter('ul[role="menu"]')->eq(0);
|
||||||
|
$quick_links_menu_nodes_count = (int) $quick_links_menu->filter('li')->count();
|
||||||
|
// Ensure foo/foo template event goes before foo/bar one
|
||||||
|
$this->assertStringContainsString('FOO_BAR_QUICK_LINK', $quick_links_menu->filter('li')->eq($quick_links_menu_nodes_count - 4)->filter('span')->text());
|
||||||
|
$this->assertStringContainsString('FOO_FOO_QUICK_LINK', $quick_links_menu->filter('li')->eq($quick_links_menu_nodes_count - 3)->filter('span')->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check extensions template event listener equal (default - 0) priority rendering
|
||||||
|
* Should render in the order of reading listener files from the filesystem
|
||||||
|
*/
|
||||||
|
public function test_same_template_event_priority()
|
||||||
|
{
|
||||||
|
global $phpbb_root_path;
|
||||||
|
|
||||||
|
$crawler = self::request('GET', 'index.php');
|
||||||
|
// Ensure foo/bar template event goes before foo/foo one (assuming they have been read from the filesystem in alphabetical order)
|
||||||
|
$this->assertStringContainsString('FOO_BAR_FORUMLIST_BODY_BEFORE', $crawler->filter('p[id*="forumlist_body_before"]')->eq(0)->text());
|
||||||
|
$this->assertStringContainsString('FOO_FOO_FORUMLIST_BODY_BEFORE', $crawler->filter('p[id*="forumlist_body_before"]')->eq(1)->text());
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,13 @@ services:
|
||||||
class: foo\bar\event\permission
|
class: foo\bar\event\permission
|
||||||
tags:
|
tags:
|
||||||
- { name: event.listener }
|
- { name: event.listener }
|
||||||
|
|
||||||
foo_bar.listener.user_setup:
|
foo_bar.listener.user_setup:
|
||||||
class: foo\bar\event\user_setup
|
class: foo\bar\event\user_setup
|
||||||
tags:
|
tags:
|
||||||
- { name: event.listener }
|
- { name: event.listener }
|
||||||
|
|
||||||
|
foo_bar.listener.template_event_order:
|
||||||
|
class: foo\bar\event\template_event_order
|
||||||
|
tags:
|
||||||
|
- { name: event.listener }
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?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 foo\bar\event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event listener
|
||||||
|
*/
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
|
class template_event_order implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
static public function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'core.twig_event_tokenparser_constructor' => 'set_template_event_priority',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_template_event_priority($event)
|
||||||
|
{
|
||||||
|
$template_event_priority_array = $event['template_event_priority_array'];
|
||||||
|
$template_event_priority_array['foo_bar'] = [
|
||||||
|
'event/navbar_header_quick_links_after' => -1,
|
||||||
|
];
|
||||||
|
$event['template_event_priority_array'] = $template_event_priority_array;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?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 foo\bar\event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event listener
|
||||||
|
*/
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
|
class template_event_order implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
static public function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'core.twig_event_tokenparser_constructor' => 'set_template_event_priority',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_template_event_priority($event)
|
||||||
|
{
|
||||||
|
$template_event_priority_array = $event['template_event_priority_array'];
|
||||||
|
$template_event_priority_array['foo_bar'] = [
|
||||||
|
'event/navbar_header_quick_links_after' => 1,
|
||||||
|
];
|
||||||
|
$event['template_event_priority_array'] = $template_event_priority_array;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<p id="foo_bar_forumlist_body_before">{{ lang('FOO_BAR_FORUMLIST_BODY_BEFORE') }}</p>
|
|
@ -0,0 +1 @@
|
||||||
|
<li><span>{{ lang('FOO_BAR_QUICK_LINK') }}</span></li>
|
|
@ -1,3 +1,8 @@
|
||||||
services:
|
services:
|
||||||
foo_foo.controller:
|
foo_foo.controller:
|
||||||
class: foo\foo\controller\controller
|
class: foo\foo\controller\controller
|
||||||
|
|
||||||
|
foo_foo.listener.template_event_order:
|
||||||
|
class: foo\foo\event\template_event_order
|
||||||
|
tags:
|
||||||
|
- { name: event.listener }
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?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 foo\foo\event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event listener
|
||||||
|
*/
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
|
class template_event_order implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
static public function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'core.twig_event_tokenparser_constructor' => 'set_template_event_priority',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_template_event_priority($event)
|
||||||
|
{
|
||||||
|
$template_event_priority_array = $event['template_event_priority_array'];
|
||||||
|
$template_event_priority_array['foo_foo'] = [
|
||||||
|
'event/navbar_header_quick_links_after' => 1,
|
||||||
|
];
|
||||||
|
$event['template_event_priority_array'] = $template_event_priority_array;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?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 foo\foo\event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event listener
|
||||||
|
*/
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
|
class template_event_order implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
static public function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'core.twig_event_tokenparser_constructor' => 'set_template_event_priority',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_template_event_priority($event)
|
||||||
|
{
|
||||||
|
$template_event_priority_array = $event['template_event_priority_array'];
|
||||||
|
$template_event_priority_array['foo_foo'] = [
|
||||||
|
'event/navbar_header_quick_links_after' => -1,
|
||||||
|
];
|
||||||
|
$event['template_event_priority_array'] = $template_event_priority_array;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<p id="foo_foo_forumlist_body_before">{{ lang('FOO_FOO_FORUMLIST_BODY_BEFORE') }}</p>
|
|
@ -0,0 +1 @@
|
||||||
|
<li><span>{{ lang('FOO_FOO_QUICK_LINK') }}</span></li>
|
|
@ -16,8 +16,6 @@
|
||||||
*/
|
*/
|
||||||
class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case
|
class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case
|
||||||
{
|
{
|
||||||
protected $phpbb_extension_manager;
|
|
||||||
|
|
||||||
private static $helper;
|
private static $helper;
|
||||||
|
|
||||||
protected static $fixtures = array(
|
protected static $fixtures = array(
|
||||||
|
|
95
tests/functional/profile_field_contact_icon_test.php
Normal file
95
tests/functional/profile_field_contact_icon_test.php
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
<?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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group functional
|
||||||
|
*/
|
||||||
|
class phpbb_functional_profile_field_contact_icon_test extends phpbb_functional_test_case
|
||||||
|
{
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->login();
|
||||||
|
$this->admin_login();
|
||||||
|
$this->add_lang('acp/profile');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_add_contact_field_icon()
|
||||||
|
{
|
||||||
|
// Custom profile fields page
|
||||||
|
$crawler = self::request('GET', 'adm/index.php?i=acp_profile&mode=profile&sid=' . $this->sid);
|
||||||
|
|
||||||
|
// Get any contact profile field, f.e. phpbb_twitter
|
||||||
|
$twitter_field = $crawler->filter('tbody tr')
|
||||||
|
->reduce(
|
||||||
|
function ($node, $i) {
|
||||||
|
$text = $node->text();
|
||||||
|
return (strpos($text, 'phpbb_twitter') !== false);
|
||||||
|
});
|
||||||
|
|
||||||
|
$twitter_edit_url = $twitter_field->filter('.actions a')->eq(2)->attr('href');
|
||||||
|
|
||||||
|
$crawler = self::request('GET', 'adm/' . $twitter_edit_url . '&sid=' . $this->sid);
|
||||||
|
|
||||||
|
$this->assertStringContainsString('phpbb_twitter', $crawler->text());
|
||||||
|
|
||||||
|
$form = $crawler->selectButton('Profile type specific options')->form([
|
||||||
|
'field_icon' => 'twitter',
|
||||||
|
'field_icon_color' => '1da1f2',
|
||||||
|
]);
|
||||||
|
$crawler= self::submit($form);
|
||||||
|
|
||||||
|
$this->assertStringContainsString('Profile type specific options', $crawler->text());
|
||||||
|
|
||||||
|
$form = $crawler->selectButton('Save')->form();
|
||||||
|
$crawler= self::submit($form);
|
||||||
|
$this->assertContainsLang('CHANGED_PROFILE_FIELD', $crawler->text());
|
||||||
|
|
||||||
|
// Ensure contact filed icon was saved correctly
|
||||||
|
$crawler = self::request('GET', 'adm/' . $twitter_edit_url . '&sid=' . $this->sid);
|
||||||
|
$this->assertEquals('twitter', $crawler->filter('#field_icon')->attr('value'));
|
||||||
|
$this->assertEquals('1da1f2', $crawler->filter('#contact_field_icon_bgcolor')->attr('value'));
|
||||||
|
$this->assertEquals(1, $crawler->filter('i.fa-twitter')->count());
|
||||||
|
$this->assertStringContainsString('#1da1f2;', $crawler->filter('i.fa-twitter')->attr('style'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @depends test_add_contact_field_icon
|
||||||
|
*/
|
||||||
|
public function test_display_field_icon()
|
||||||
|
{
|
||||||
|
$this->add_lang('ucp');
|
||||||
|
|
||||||
|
// Set Twitter profile field
|
||||||
|
$crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info');
|
||||||
|
$this->assertContainsLang('UCP_PROFILE_PROFILE_INFO', $crawler->filter('#cp-main h2')->text());
|
||||||
|
|
||||||
|
$form = $crawler->selectButton('Submit')->form([
|
||||||
|
'pf_phpbb_twitter' => 'phpbb_twitter',
|
||||||
|
]);
|
||||||
|
$crawler = self::submit($form);
|
||||||
|
$this->assertContainsLang('PROFILE_UPDATED', $crawler->filter('#message')->text());
|
||||||
|
|
||||||
|
// Ensure Twitter icon displays in topic
|
||||||
|
$crawler = self::request('GET', 'viewtopic.php?t=1');
|
||||||
|
$this->assertEquals('Twitter', $crawler->filter('#profile1 a[title="Twitter"]')->attr('title'));
|
||||||
|
$this->assertStringContainsString('#1da1f2', $crawler->filter('#profile1 a[title="Twitter"] > i.fa-twitter')->attr('style'));
|
||||||
|
|
||||||
|
// Ensure Twitter icon displays on view private message screen
|
||||||
|
$message_id = $this->create_private_message('Self PM', 'Self PM', [2]);
|
||||||
|
$crawler = self::request('GET', 'ucp.php?i=pm&mode=view&p=' . $message_id . '&sid=' . $this->sid);
|
||||||
|
$this->assertEquals('Twitter', $crawler->filter('.profile-contact a[title="Twitter"]')->attr('title'));
|
||||||
|
$this->assertStringContainsString('#1da1f2', $crawler->filter('.profile-contact a[title="Twitter"] > i.fa-twitter')->attr('style'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -644,7 +644,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
|
|
||||||
$meta_refresh = $crawler->filter('meta[http-equiv="refresh"]');
|
$meta_refresh = $crawler->filter('meta[http-equiv="refresh"]');
|
||||||
|
|
||||||
// Wait for extension to be fully enabled
|
// Wait for extension to be fully disabled
|
||||||
while (count($meta_refresh))
|
while (count($meta_refresh))
|
||||||
{
|
{
|
||||||
preg_match('#url=.+/(adm+.+)#', $meta_refresh->attr('content'), $match);
|
preg_match('#url=.+/(adm+.+)#', $meta_refresh->attr('content'), $match);
|
||||||
|
|
Loading…
Add table
Reference in a new issue