Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
* text=auto eol=lf
*.png binary
docs/ export-ignore
.editorconfig export-ignore
35 changes: 35 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Lint

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
lint:
name: PHP ${{ matrix.php }} lint
runs-on: ubuntu-24.04
strategy:
matrix:
php: ['8.2', '8.5']
steps:
- uses: actions/checkout@v4

- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2

- name: PHP syntax check
run: find . -name '*.php' -not -path './.git/*' -not -path './vendor/*' -print0 | xargs -0 -n1 php -l

- name: Validate composer.json
run: composer validate --no-check-all --no-check-publish
30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
extension-tests:
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@master
with:
EXTNAME: phpbbmodders/restorejumpbox
PHPBB_BRANCH: master
EPV: 0
RUN_MYSQL_JOBS: 0
RUN_PGSQL_JOBS: 0
RUN_MSSQL_JOBS: 0
RUN_WINDOWS_JOBS: 0
PRIMARY_PHP_VERSION: '8.3'
PHP_VERSION_MATRIX: '["8.2", "8.5"]'

epv:
uses: phpbbmodders/.github/.github/workflows/epv.yml@v1
with:
EXTNAME: phpbbmodders/restorejumpbox
PHPBB_BRANCHES: '["3.3.x", "master"]'
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
# Restore Jumpbox

A planned phpBB 4.0 extension to bring back the public forum jumpbox if [phpBB PR #6927](https://github.com/phpbb/phpbb/pull/6927) lands.
A development extension that restores the public forum jumpbox on prosilver forum and topic pages after the removal proposed in [phpBB PR #6927](https://github.com/phpbb/phpbb/pull/6927).

See the [initial scope](docs/TODO.md) for the proposed behavior and acceptance checks.
For testing on phpBB 4.0 with the removal applied, place the extension in `ext/phpbbmodders/restorejumpbox` and enable **Restore Jumpbox** in the ACP.

In **ACP → General → Load settings**, set **Show the public jumpbox** to **No** to hide the selector while keeping its permission-filtered links available to phpbb-tui.

## Screenshots

[<img src="docs/images/screenshots/forum.png" alt="Forum page" width="440" height="309">](docs/images/screenshots/forum.png)
[<img src="docs/images/screenshots/topic.png" alt="Topic page" width="440" height="309">](docs/images/screenshots/topic.png)
[<img src="docs/images/screenshots/mobile.png" alt="Mobile forum page" width="390" height="844">](docs/images/screenshots/mobile.png)

[Full screenshot gallery](docs/images/screenshots/README.md)

## TODO

See the [scope and acceptance checks](docs/TODO.md).

## Contributing

Expand All @@ -12,3 +26,7 @@ See the [initial scope](docs/TODO.md) for the proposed behavior and acceptance c
## Acknowledgments

- Initial scope drafted with [Codex](https://openai.com/codex/).

## License

Licensed under the [GNU General Public License v2.0](license.txt).
26 changes: 26 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "phpbbmodders/restorejumpbox",
"type": "phpbb-extension",
"description": "Restores the public forum jumpbox on phpBB 4.0.",
"version": "0.1.0-dev",
"license": "GPL-2.0-only",
"authors": [
{
"name": "phpBB Modders",
"email": "board@phpbbmodders.com",
"homepage": "https://www.phpbbmodders.com/",
"role": "Extension Developer"
}
],
"require": {
"php": "^8.2",
"composer/installers": "^2.0"
},
"extra": {
"display-name": "Restore Jumpbox",
"soft-require": {
"phpbb/phpbb": ">=4.0.0-a2-dev,<4.1.0-dev"
}
},
"homepage": "https://www.phpbbmodders.com/"
}
12 changes: 12 additions & 0 deletions config/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
phpbbmodders.restorejumpbox.listener:
class: phpbbmodders\restorejumpbox\event\listener
arguments:
- '@config'
- '@request'
- '@template'
- '@user'
- '%core.root_path%'
- '%core.php_ext%'
tags:
- { name: event.listener }
13 changes: 13 additions & 0 deletions docs/images/screenshots/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Restore Jumpbox screenshots

## Forum page

[<img src="forum.png" alt="Forum page" width="440" height="309">](forum.png)

## Topic page

[<img src="topic.png" alt="Topic page" width="440" height="309">](topic.png)

## Mobile forum page

[<img src="mobile.png" alt="Mobile forum page" width="390" height="844">](mobile.png)
Binary file added docs/images/screenshots/forum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/screenshots/mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/screenshots/topic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions event/listener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?php
/**
* Restore Jumpbox extension for the phpBB Forum Software package
*
* @copyright (c) 2026, phpBB Modders, https://www.phpbbmodders.com/
* @license GNU General Public License, version 2 (GPL-2.0)
*/

namespace phpbbmodders\restorejumpbox\event;

use phpbb\config\config;
use phpbb\request\request_interface;
use phpbb\template\template;
use phpbb\user;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class listener implements EventSubscriberInterface
{
public function __construct(
private config $config,
private request_interface $request,
private template $template,
private user $user,
private string $root_path,
private string $php_ext,
)
{
}

public static function getSubscribedEvents(): array
{
return [
'core.acp_board_config_edit_add' => 'add_visibility_setting',
'core.page_footer' => 'populate_jumpbox',
];
}

public function add_visibility_setting(\phpbb\event\data $event): void
{
if ($event['mode'] !== 'load' || isset($this->config['load_jumpbox']))
{
return;
}

$this->user->add_lang_ext('phpbbmodders/restorejumpbox', 'acp');
$display_vars = $event['display_vars'];
$visibility_setting = [
'lang' => 'RESTOREJUMPBOX_VISIBLE',
'validate' => 'bool',
'type' => 'radio:yes_no',
'explain' => true,
];
$settings = [];
foreach ($display_vars['vars'] as $key => $value)
{
if ($value === 'ACP_SUBMIT_CHANGES')
{
$settings['legend_restorejumpbox'] = 'RESTOREJUMPBOX_SETTINGS';
$settings['restorejumpbox_visible'] = $visibility_setting;
}
$settings[$key] = $value;
}
$display_vars['vars'] = $settings;
$event['display_vars'] = $display_vars;
}

/**
* Populate the public selector using core's permission-filtered forum tree.
*/
public function populate_jumpbox(): void
{
// Builds before the core removal still provide their own jumpbox.
if (isset($this->config['load_jumpbox']))
{
return;
}

$page = $this->user->page['page_name'] ?? '';
if ($page !== 'viewforum.' . $this->php_ext && $page !== 'viewtopic.' . $this->php_ext)
{
return;
}

if ($page === 'viewtopic.' . $this->php_ext && $this->request->variable('view', '') === 'print')
{
return;
}

\make_jumpbox(
\append_sid($this->root_path . 'viewforum.' . $this->php_ext),
$this->request->variable('f', 0),
false,
false,
true,
);
$this->template->assign_vars([
'S_RESTOREJUMPBOX' => true,
'S_RESTOREJUMPBOX_HIDDEN' => !(bool) ($this->config['restorejumpbox_visible'] ?? true),
]);
}
}
27 changes: 27 additions & 0 deletions ext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* Restore Jumpbox extension for the phpBB Forum Software package
*
* @copyright (c) 2026, phpBB Modders, https://www.phpbbmodders.com/
* @license GNU General Public License, version 2 (GPL-2.0)
*/

namespace phpbbmodders\restorejumpbox;

class ext extends \phpbb\extension\base
{
public function is_enableable(): array|bool
{
if (phpbb_version_compare(PHPBB_VERSION, '4.0.0-a2-dev', '>=')
&& phpbb_version_compare(PHPBB_VERSION, '4.1.0-dev', '<')
&& version_compare(PHP_VERSION, '8.2.0', '>='))
{
return true;
}

$language = $this->container->get('language');
$language->add_lang('install_failed', 'phpbbmodders/restorejumpbox');

return [$language->lang('RESTOREJUMPBOX_NOT_ENABLEABLE')];
}
}
18 changes: 18 additions & 0 deletions language/en/acp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Restore Jumpbox extension for the phpBB Forum Software package
*
* @copyright (c) 2026, phpBB Modders, https://www.phpbbmodders.com/
* @license GNU General Public License, version 2 (GPL-2.0)
*/

if (!defined('IN_PHPBB'))
{
exit;
}

$lang = array_merge($lang ?? [], [
'RESTOREJUMPBOX_SETTINGS' => 'Restore Jumpbox',
'RESTOREJUMPBOX_VISIBLE' => 'Show the public jumpbox',
'RESTOREJUMPBOX_VISIBLE_EXPLAIN' => 'Hide the jumpbox from visitors while keeping permission-filtered forum links available to clients such as phpbb-tui.',
]);
16 changes: 16 additions & 0 deletions language/en/install_failed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* Restore Jumpbox extension for the phpBB Forum Software package
*
* @copyright (c) 2026, phpBB Modders, https://www.phpbbmodders.com/
* @license GNU General Public License, version 2 (GPL-2.0)
*/

if (!defined('IN_PHPBB'))
{
exit;
}

$lang = array_merge($lang ?? [], [
'RESTOREJUMPBOX_NOT_ENABLEABLE' => 'Restore Jumpbox requires phpBB 4.0.0-a2-dev or later in the 4.0 series and PHP 8.2 or later.',
]);
Loading
Loading