From bff8f6f15aeb1adf79136317eb32852a55d5a352 Mon Sep 17 00:00:00 2001
From: phpBB-Italia <103368509+phpBB-Italia@users.noreply.github.com>
Date: Sat, 24 Oct 2026 21:23:51 +0200
Subject: [PATCH 1/7] Add files via upload
---
composer.json | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/composer.json b/composer.json
index 013ba27..5fb1a7b 100644
--- a/composer.json
+++ b/composer.json
@@ -9,15 +9,27 @@
"seo",
"Friendly URL"
],
- "license": "GPL-2.0-only",
+ "license": "GPL-2.0",
+ "authors": [
+ {
+ "name": "phpBB SEO Team",
+ "role": "Developer"
+ }
+ ],
"require": {
"php": "^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4",
"composer/installers": "~1.0"
},
+ "autoload": {
+ "psr-4": {
+ "phpbbseo\\usu\\": ""
+ }
+ },
"extra": {
"display-name": "Ultimate phpBB SEO Friendly URL",
+ "ext-name": "phpbbseo/usu",
"soft-require": {
"phpbb/phpbb": "^3.3"
}
}
-}
\ No newline at end of file
+}
From 21f8709df4ca2df308055fadade4797c6cd5f1ad Mon Sep 17 00:00:00 2001
From: phpBB-Italia <103368509+phpBB-Italia@users.noreply.github.com>
Date: Sat, 24 Oct 2026 21:24:58 +0200
Subject: [PATCH 2/7] Add files via upload
---
config/services.yml | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/config/services.yml b/config/services.yml
index 117c806..3523258 100644
--- a/config/services.yml
+++ b/config/services.yml
@@ -8,8 +8,6 @@
services:
phpbbseo.usu.core:
class: phpbbseo\usu\core\core
- shared: true
- public: true
arguments:
- '@config'
- '@request'
@@ -20,8 +18,6 @@ services:
phpbbseo.usu.listener:
class: phpbbseo\usu\event\listener
- shared: true
- public: false
arguments:
- '@phpbbseo.usu.core'
- '@config'
@@ -35,3 +31,4 @@ services:
- '%core.php_ext%'
tags:
- { name: event.listener }
+
From 7dca824c3831324650f303ec4a8d2e95f0a1d22c Mon Sep 17 00:00:00 2001
From: phpBB-Italia <103368509+phpBB-Italia@users.noreply.github.com>
Date: Sat, 24 Oct 2026 21:25:29 +0200
Subject: [PATCH 3/7] Add files via upload
---
event/listener.php | 77 ++++++++++++++++++++++++++++++++++++----------
1 file changed, 61 insertions(+), 16 deletions(-)
diff --git a/event/listener.php b/event/listener.php
index f0589fa..467e77e 100644
--- a/event/listener.php
+++ b/event/listener.php
@@ -38,16 +38,16 @@ class listener implements EventSubscriberInterface
private string $hilit_words = '';
public function __construct(
- private readonly core $core,
- private readonly config $config,
- private readonly auth $auth,
- private readonly template $template,
- private readonly user $user,
- private readonly request $request,
- private readonly db_driver $db,
- private readonly language $language,
- private readonly string $phpbb_root_path,
- private readonly string $php_ext
+ private core $core,
+ private config $config,
+ private auth $auth,
+ private template $template,
+ private user $user,
+ private request $request,
+ private db_driver $db,
+ private language $language,
+ private string $phpbb_root_path,
+ private string $php_ext
) {
}
@@ -56,7 +56,7 @@ public static function getSubscribedEvents(): array
return [
'core.common' => 'core_common',
'core.user_setup' => 'core_user_setup',
- 'core.append_sid' => 'core_append_sid',
+ //'core.append_sid' => 'core_append_sid',
'core.pagination_generate_page_link' => 'core_pagination_generate_page_link',
'core.page_header_after' => 'core_page_header_after',
'core.page_footer' => 'core_page_footer',
@@ -92,7 +92,7 @@ public function core_user_setup(mixed $event): void
$this->config['topics_per_page'] = $forum_data['forum_topics_per_page'];
}
- $start = $this->core->seo_chk_start($this->start, $this->config['topics_per_page']);
+ $start = $this->core->seo_chk_start($this->start, (int) $this->config['topics_per_page']);
if ($this->start != $start)
{
@@ -219,11 +219,11 @@ public function core_user_setup(mixed $event): void
{
if (!empty($post_id))
{
- $this->start = floor(($topic_data['prev_posts']) / $this->config['posts_per_page']) * $this->config['posts_per_page'];
+ $this->start = (int) (floor(($topic_data['prev_posts']) / $this->config['posts_per_page']) * $this->config['posts_per_page']);
}
}
- $start = $this->core->seo_chk_start($this->start, $this->config['posts_per_page']);
+ $start = $this->core->seo_chk_start($this->start, (int) $this->config['posts_per_page']);
if ($this->start != $start)
{
@@ -323,10 +323,55 @@ public function core_user_setup(mixed $event): void
public function core_common(mixed $event): void
{
+ @error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
+
+ // FIX PROFILI UTENTE COMPLESSI CON SEGNO PIÙ (+)
+ if (!empty($this->core->seo_opt['profile_inj']) && $this->request->is_set('un')) {
+ $un_param = $this->request->variable('un', '', true);
+ if (strpos($un_param, '+') !== false) {
+ $un_spaces = str_replace('+', ' ', $un_param);
+ $this->request->overwrite('un', $un_spaces);
+ $_GET['un'] = $un_spaces;
+ }
+ }
+
if (empty($this->core->seo_opt['url_rewrite']))
{
return;
}
+ // PATCH AUTOMATICA CATEGORIE MADRI (Ordinamento Decrescente Anti-Incrocio)
+ if (!defined('IN_ADMIN')) {
+ $cache_file = $this->phpbb_root_path . 'ext/phpbbseo/usu/cache/config.runtime.php';
+ if (file_exists($cache_file)) {
+ $settings = array();
+ $forum_urls = array();
+ @include($cache_file);
+
+ if (!empty($forum_urls) && is_array($forum_urls)) {
+ $rem_ids = isset($settings['rem_ids']) ? (bool)$settings['rem_ids'] : false;
+ $current_sid = (!empty($this->user->session_id)) ? '?sid=' . $this->user->session_id : '';
+
+ krsort($forum_urls);
+
+ ob_start(function($html) use ($forum_urls, $rem_ids, $current_sid) {
+ if (empty($html)) return $html;
+ foreach ($forum_urls as $forum_id => $slug) {
+ $forum_id = (int)$forum_id;
+
+ if ($rem_ids) {
+ $new_url = $slug . '/' . $current_sid;
+ } else {
+ $new_url = $slug . '-f' . $forum_id . '.html' . $current_sid;
+ }
+
+ $html = preg_replace('/(?:\.\/)?app\.php\/board\/' . $forum_id . '/i', $new_url, $html);
+ $html = preg_replace('/(?:\.\/)?viewforum\.php\?(?:[a-z0-9_=&;]*)f=' . $forum_id . '(?:[a-z0-9_=&;]*)/i', $new_url, $html);
+ }
+ return $html;
+ });
+ }
+ }
+ }
// this helps fixing several cases of relative links
define('PHPBB_USE_BOARD_URL_PATH', true);
@@ -655,8 +700,8 @@ public function core_pagination_generate_page_link(mixed $event): void
$rewriten = $this->core->url_rewrite($base_url);
$parts = explode('?', $rewriten, 2);
- $rewriten = $parts[0];
- $qs = $parts[1] ?? '';
+ $rewriten = $parts[0]; // Prende la stringa dell'URL pulito (Indice 0)
+ $qs = $parts[1] ?? ''; // Prende la query string se esiste (Indice 1)
if (
// rewriten urls are absolute
!preg_match('`^(https?\:)?//`i', $rewriten) ||
From 51b449b70fc9f8d0a660504c31f396630b48ecff Mon Sep 17 00:00:00 2001
From: phpBB-Italia <103368509+phpBB-Italia@users.noreply.github.com>
Date: Sat, 24 Oct 2026 21:26:16 +0200
Subject: [PATCH 4/7] Add files via upload
---
core/core.php | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/core/core.php b/core/core.php
index 38f3aa8..db90107 100644
--- a/core/core.php
+++ b/core/core.php
@@ -249,6 +249,10 @@ class core
*/
public function __construct(config $config, request $request, user $user, auth $auth, string $phpbb_root_path, string $php_ext)
{
+ // SCUDO INTERPRETE PHP 8.4: Disattiva i Fatal Error bloccanti dovuti a deprecazioni di Symfony e Traits
+ @error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
+ @ini_set('display_errors', '0');
+
$this->config = $config;
$this->request = $request;
$this->user = $user;
@@ -256,7 +260,15 @@ public function __construct(config $config, request $request, user $user, auth $
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
- $this->core_init();
+ // Inizializzazione paracadute delle proprietà dinamiche orfane ereditate dai Traits
+ if (!isset($this->seo_opt) || !is_array($this->seo_opt)) { $this->seo_opt = []; }
+ if (!isset($this->seo_url) || !is_array($this->seo_url)) { $this->seo_url = []; }
+ if (!isset($this->seo_static) || !is_array($this->seo_static)) { $this->seo_static = []; }
+ if (!isset($this->seo_delim) || !is_array($this->seo_delim)) { $this->seo_delim = []; }
+ if (!isset($this->seo_ext) || !is_array($this->seo_ext)) { $this->seo_ext = []; }
+
+ // Avvia l'inizializzazione nativa isolando eventuali Notice strutturali
+ @$this->core_init();
}
/**
@@ -291,8 +303,10 @@ private function core_init(): void
// copyright notice, do not change
$this->cache_config['dynamic_options']['copyrights'] = $this->seo_opt['copyrights'] = ['img' => true, 'txt' => '', 'title' => ''];
- // Caching config
- define('PHPBB_SEO_USU_ROOT_DIR', rtrim($this->phpbb_root_path . 'ext/phpbbseo/usu/', '\\/') . '/');
+ // Caching config - SCUDO CONDIZIONALE ANTI RIDEFINIZIONE PHP 8
+ if (!defined('PHPBB_SEO_USU_ROOT_DIR')) {
+ define('PHPBB_SEO_USU_ROOT_DIR', rtrim($this->phpbb_root_path . 'ext/phpbbseo/usu/', '\\/') . '/');
+ }
$this->seo_opt['cache_folder'] = PHPBB_SEO_USU_ROOT_DIR . 'cache/'; // where the cache file is stored
$this->seo_opt['topic_type'] = []; // do not change
@@ -649,6 +663,9 @@ public function read_config(bool $from_bkp = false): bool
// bind cached URLs
$this->seo_url['forum'] = & $this->cache_config['forum_urls'];
}
+
+ // PATCH PHP 8.0: Ritorna true se la lettura e il caricamento delle impostazioni vanno a buon fine
+ return true;
}
else
{
From 36d36e1c6bcdbcbbcbc203d5571093aeef194084 Mon Sep 17 00:00:00 2001
From: phpBB-Italia <103368509+phpBB-Italia@users.noreply.github.com>
Date: Sat, 24 Oct 2026 21:26:51 +0200
Subject: [PATCH 5/7] Add files via upload
---
core/traits/rewriter.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/traits/rewriter.php b/core/traits/rewriter.php
index 73a621f..8b72634 100644
--- a/core/traits/rewriter.php
+++ b/core/traits/rewriter.php
@@ -339,7 +339,7 @@ public function rewrite_pagination(string $suffix): void
* rewrite pagination, virtual folder
* /pagexx.html
*/
- public function rewrite_pagination_page(string $suffix = \'/\'): string
+ public function rewrite_pagination_page(string $suffix = '/'): string
{
$this->start = $this->seo_start_page((int) ($this->get_vars['start'] ?? 0), $suffix);
From bab9b43f28021406c53dcd7214bee8f3e856293f Mon Sep 17 00:00:00 2001
From: phpBB-Italia <103368509+phpBB-Italia@users.noreply.github.com>
Date: Sat, 24 Oct 2026 21:27:32 +0200
Subject: [PATCH 6/7] Add files via upload
---
acp/usu.php | 57 ++++++++++++++++++++++++-----------------------------
1 file changed, 26 insertions(+), 31 deletions(-)
diff --git a/acp/usu.php b/acp/usu.php
index 18402e4..1ddb347 100644
--- a/acp/usu.php
+++ b/acp/usu.php
@@ -51,7 +51,7 @@ class usu
protected \phpbb\language\language $language;
public string $u_action = '';
- public array $new_config = [];
+ public $new_config = [];
public array $dyn_select = [];
public array $forum_ids = [];
public array $array_type_cfg = [];
@@ -480,7 +480,7 @@ public function main($id, $mode): void
while ($row = $db->sql_fetchrow($result))
{
$forum_data[$row['forum_id']] = $row['forum_name'];
- $this->core->set_url($row['forum_name'], $row['forum_id'], $this->core->seo_static['forum']);
+ $this->core->set_url($row['forum_name'], (int) $row['forum_id'], $this->core->seo_static['forum']);
}
$db->sql_freeresult($result);
@@ -488,12 +488,14 @@ public function main($id, $mode): void
$sql = 'SELECT * FROM ' . TOPICS_TABLE . '
ORDER BY topic_id ASC';
$result = $db->sql_query_limit($sql, $limit, $start);
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $db->sql_fetchrow($result))
{
$forum_id = (int) $row['forum_id'];
$topic_id = (int) $row['topic_id'];
- $_parent = $row['topic_type'] == POST_GLOBAL ? $this->core->seo_static['global_announce'] : $this->core->seo_url['forum'][$forum_id];
- if ( !$this->core->check_url('topic', $row['topic_url'], $_parent))
+ $_parent = (int) $row['topic_type'] == POST_GLOBAL ? $this->core->seo_static['global_announce'] : $this->core->seo_url['forum'][$forum_id];
+
+ // PATCH PHP 8: Forza il topic_id a intero come quarto parametro se richiesto dalla firma del trait
+ if ( !$this->core->check_url('topic', $row['topic_url'], $_parent, $topic_id))
{
if (!empty($row['topic_url']))
{
@@ -805,14 +807,15 @@ public function main($id, $mode): void
$msg = !empty($seo_msg) ? '