Compare commits

...

10 commits

Author SHA1 Message Date
lionel-rowe
d4c66c955e
Merge 4b2a24ba5e into 2f43c1facd 2025-06-16 11:34:30 +02:00
Marc Alexander
2f43c1facd
[ticket/17399] Fix docblock and use space-ship operator
PHPBB-17399
2025-06-16 10:34:38 +02:00
Marc Alexander
d4a3311b76
Merge pull request #6829 from battye/ticket/17399
[ticket/17399] Fix selected language bug in installer
2025-06-15 09:08:49 +02:00
battye
8411da1819 [ticket/17399] Fix selected language in installer
This fixes a bug where a user could have other languages in the installer
but the language dropdown did not match the language shown.

PHPBB-17399
2025-06-14 14:35:18 +00:00
Marc Alexander
8f8a93fa71
Merge pull request #6818 from rxu/ticket/17515
[ticket/17515] Add template event before PM text - 3.3.x
2025-06-14 08:51:41 +02:00
Marc Alexander
c726382d84
Merge pull request #6824 from iMattPro/ticket/17519
[ticket/17519] Correctly encode cron task urls
2025-06-13 20:41:22 +02:00
Marc Alexander
5deeea025f
[ticket/17519] Add unit tests for task wrapper
PHPBB-17519
2025-06-12 21:00:24 +02:00
Matt Friedman
6947dc8c92 [ticket/17519] Correctly encode cron task urls
PHPBB-17519
2025-06-03 04:21:24 +00:00
rxu
ddc7f1df34
[ticket/17515] Add template event before PM text
PHPBB-17515
2025-05-22 13:29:47 +07:00
lionel-rowe
4b2a24ba5e [ticket/16983] Accessibility - fix elements with no focus style in ACP and Prosilver
PHPBB3-16983
2022-04-07 15:16:40 +01:00
15 changed files with 191 additions and 31 deletions

View file

@ -627,7 +627,6 @@ li {
font-size: 0.75em;
text-decoration: none;
cursor: inherit;
outline-style: none;
}
@media only screen and (max-width: 700px), only screen and (max-device-width: 700px)
@ -1173,10 +1172,6 @@ optgroup, select {
color: #000;
}
select:focus {
outline-style: none;
}
optgroup {
font-size: 1.00em;
font-weight: bold;
@ -1442,7 +1437,6 @@ input:focus, textarea:focus {
border: 1px solid #BC2A4D;
background-color: #E9E9E2;
color: #BC2A4D;
outline-style: none;
}
@media only screen and (max-width: 700px), only screen and (max-device-width: 700px)
@ -1592,11 +1586,6 @@ input.disabled {
color: #666666;
}
/* Focus states */
input.button1:focus, input.button2:focus {
outline-style: none;
}
/* jQuery popups
---------------------------------------- */
.phpbb_alert {

View file

@ -19,7 +19,7 @@
<form method="post" action="#" id="language_selector">
<fieldset class="nobg">
<label for="language">{L_SELECT_LANG}{L_COLON}</label>
<select id="language" name="language">
<select id="language" name="language">
<!-- BEGIN language_select_item -->
<option value="{language_select_item.VALUE}"<!-- IF language_select_item.SELECTED --> selected="selected"<!-- ENDIF -->>{language_select_item.NAME}</option>
<!-- END language_select_item -->

View file

@ -2806,6 +2806,13 @@ ucp_pm_viewmessage_custom_fields_before
* Purpose: Add data before the custom fields on the user profile when viewing
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
===
* Locations:

View file

@ -339,6 +339,14 @@ class helper
protected function render_language_select($selected_language = null)
{
$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)
{
$this->template->assign_block_vars('language_select_item', array(

View file

@ -67,6 +67,20 @@ class language_file_helper
);
}
usort($available_languages, [$this, 'sort_by_local_name']);
return $available_languages;
}
/**
* 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($a, $b): int
{
return $a['local_name'] <=> $b['local_name'];
}
}

View file

@ -4,4 +4,4 @@
to hide visually and `aria-hidden="true"` to hide from screen-readers; using
`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="">

View file

@ -130,6 +130,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 -->&nbsp;<!-- END bcc_recipient --><!-- ENDIF -->
</p>
{% EVENT ucp_pm_viewmessage_message_content_before %}
<div class="content">{MESSAGE}</div>

View file

@ -112,3 +112,11 @@ ul {
abbr[title] {
text-decoration: none;
}
/**
* Fixes accessibility issue introduced by `normalize.css` by re-adding outline
* to elements covered by the mouse when they are navigated into via keyboard
*/
a:hover {
outline: revert;
}

View file

@ -25,7 +25,6 @@
.button:focus,
.button:hover {
text-decoration: none;
outline: none;
}
.caret {

View file

@ -27,10 +27,6 @@ select {
font-size: 1em;
}
select:focus {
outline-style: none;
}
option {
padding-right: 1em;
}
@ -268,8 +264,6 @@ fieldset.submit-buttons input {
max-width: 100%;
font-size: 1.2em;
resize: vertical;
outline: 3px dashed transparent;
outline-offset: -4px;
-webkit-transition: all .5s ease, height 1ms linear;
-moz-transition: all .5s ease, height 1ms linear;
-ms-transition: all .5s ease, height 1ms linear;
@ -296,7 +290,6 @@ fieldset.submit-buttons input {
.inputbox:hover, .inputbox:focus {
border: 1px solid transparent;
outline-style: none;
}
input.inputbox { width: 85%; }
@ -383,11 +376,6 @@ input.disabled {
font-weight: normal;
}
/* Focus states */
input.button1:focus, input.button2:focus, input.button3:focus {
outline-style: none;
}
/* Topic and forum Search */
.search-box {
float: left;

142
tests/cron/wrapper_test.php Normal file
View file

@ -0,0 +1,142 @@
<?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;
// Test the engine can be used
$this->setup_engine([], $phpbb_root_path . 'styles/all/template');
$this->template->clear_cache();
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,
'/phpbb/',
'php',
$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,
'/phpbb/',
'php',
$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,
'/phpbb/',
'php',
$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,
'/phpbb/',
'php',
$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);
}
}

View file

@ -15,7 +15,7 @@ require_once __DIR__ . '/template_test_case.php';
class phpbb_template_extension_test extends phpbb_template_template_test_case
{
protected function setup_engine(array $new_config = array())
protected function setup_engine(array $new_config = array(), string $template_path = '')
{
global $config, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;

View file

@ -21,7 +21,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
/** @var string */
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;

View file

@ -1,4 +1,7 @@
<?php
use phpbb\template\twig\twig;
/**
*
* This file is part of the phpBB Forum Software package.
@ -14,6 +17,7 @@
class phpbb_template_template_test_case extends phpbb_test_case
{
protected $lang;
/** @var twig */
protected $template;
protected $template_path;
protected $user;
@ -69,7 +73,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
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;
@ -92,7 +96,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
$phpEx
);
$this->template_path = $this->test_path . '/templates';
$this->template_path = $template_path ?: $this->test_path . '/templates';
$container = new phpbb_mock_container_builder();
$cache_path = $phpbb_root_path . 'cache/twig';

View file

@ -15,7 +15,7 @@ require_once __DIR__ . '/template_test_case.php';
class phpbb_template_template_test_case_with_tree extends phpbb_template_template_test_case
{
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;