From f2f5e970485ab1aac73c56ab69f088d21e49d924 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 1 Oct 2026 07:00:59 -0700 Subject: [PATCH 1/3] Revert "Fix inconsistencies" This reverts commit 350c12beb70a8d8d2035fed86d0b01551843140e. --- composer.json | 4 ++-- migrations/add_popup_prompt.php | 4 ++-- migrations/add_user_popup_preference.php | 6 +++--- migrations/fix_acp_module_auth.php | 2 +- migrations/handle_subscriptions.php | 2 +- migrations/setup_site_icons.php | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 7e0c4d4..ac265aa 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,8 @@ "role": "Extensions Development Team Lead" }, { - "name": "Vinny", - "role": "Customisations Team" + "name": "Vinny", + "role": "Customisations Team" } ], "require": { diff --git a/migrations/add_popup_prompt.php b/migrations/add_popup_prompt.php index 1bf032e..98ba3cd 100644 --- a/migrations/add_popup_prompt.php +++ b/migrations/add_popup_prompt.php @@ -14,7 +14,7 @@ class add_popup_prompt extends migration { - public function effectively_installed(): bool + public function effectively_installed() { return $this->config->offsetExists('wpn_webpush_popup_prompt'); } @@ -24,7 +24,7 @@ public static function depends_on() return ['\phpbb\webpushnotifications\migrations\add_acp_configs']; } - public function update_data(): array + public function update_data() { return [ ['config.add', ['wpn_webpush_popup_prompt', 0]], diff --git a/migrations/add_user_popup_preference.php b/migrations/add_user_popup_preference.php index 6b32443..d6649d1 100644 --- a/migrations/add_user_popup_preference.php +++ b/migrations/add_user_popup_preference.php @@ -14,7 +14,7 @@ class add_user_popup_preference extends migration { - public function effectively_installed(): bool + public function effectively_installed() { return $this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_wpn_popup_disabled'); } @@ -24,7 +24,7 @@ public static function depends_on() return ['\phpbb\webpushnotifications\migrations\add_popup_prompt']; } - public function update_schema(): array + public function update_schema() { return [ 'add_columns' => [ @@ -35,7 +35,7 @@ public function update_schema(): array ]; } - public function revert_schema(): array + public function revert_schema() { return [ 'drop_columns' => [ diff --git a/migrations/fix_acp_module_auth.php b/migrations/fix_acp_module_auth.php index 2ae3458..076f203 100644 --- a/migrations/fix_acp_module_auth.php +++ b/migrations/fix_acp_module_auth.php @@ -14,7 +14,7 @@ class fix_acp_module_auth extends migration { - public function effectively_installed(): bool + public function effectively_installed() { $sql = 'SELECT module_id FROM ' . $this->table_prefix . "modules diff --git a/migrations/handle_subscriptions.php b/migrations/handle_subscriptions.php index 496802d..34c842e 100644 --- a/migrations/handle_subscriptions.php +++ b/migrations/handle_subscriptions.php @@ -19,7 +19,7 @@ public static function depends_on() return ['\phpbb\webpushnotifications\migrations\add_webpush']; } - public function effectively_installed(): bool + public function effectively_installed() { return !$this->db_tools->sql_table_exists($this->table_prefix . 'wpn_notification_push'); } diff --git a/migrations/setup_site_icons.php b/migrations/setup_site_icons.php index 15341b2..59ab98b 100644 --- a/migrations/setup_site_icons.php +++ b/migrations/setup_site_icons.php @@ -22,7 +22,7 @@ class setup_site_icons extends container_aware_migration /** @var filesystem $filesystem */ private $filesystem; - public function effectively_installed(): bool + public function effectively_installed() { return $this->get_filesystem()->exists($this->container->getParameter('core.root_path') . self::NEW_ICON_DIR); } From 2443849d3ac78e9054fb2dc244a046459cb03547 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 1 Oct 2026 07:02:22 -0700 Subject: [PATCH 2/3] Fix whitespaces --- composer.json | 114 +++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/composer.json b/composer.json index ac265aa..7e833f6 100644 --- a/composer.json +++ b/composer.json @@ -1,61 +1,61 @@ { - "name": "phpbb/webpushnotifications", - "type": "phpbb-extension", - "description": "An official phpBB extension that allows board users to receive browser-based push notifications.", - "homepage": "https://www.phpbb.com/customise/db/extension/webpushnotifications/", - "version": "1.1.1-dev", - "license": "GPL-2.0-only", - "authors": [ - { - "name": "Marc Alexander", - "homepage": "https://www.m-a-styles.de", - "role": "Extensions Team Consultant" - }, - { - "name": "Ruslan Uzdenov", - "homepage": "https://www.phpbbguru.net", - "role": "Extensions Development Team" - }, - { - "name": "Matt Friedman", - "homepage": "https://imattpro.github.io", - "role": "Extensions Development Team Lead" - }, - { + "name": "phpbb/webpushnotifications", + "type": "phpbb-extension", + "description": "An official phpBB extension that allows board users to receive browser-based push notifications.", + "homepage": "https://www.phpbb.com/customise/db/extension/webpushnotifications/", + "version": "1.1.1-dev", + "license": "GPL-2.0-only", + "authors": [ + { + "name": "Marc Alexander", + "homepage": "https://www.m-a-styles.de", + "role": "Extensions Team Consultant" + }, + { + "name": "Ruslan Uzdenov", + "homepage": "https://www.phpbbguru.net", + "role": "Extensions Development Team" + }, + { + "name": "Matt Friedman", + "homepage": "https://imattpro.github.io", + "role": "Extensions Development Team Lead" + }, + { "name": "Vinny", "role": "Customisations Team" - } - ], - "require": { - "php": ">=7.3", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "ext-openssl": "*", - "composer/installers": "~1.0", - "minishlink/web-push": "^7.0" - }, - "require-dev": { - "phing/phing": "~2.4" - }, - "suggest": { - "ext-gmp": "Optional but better for performance" - }, - "config": { - "allow-plugins": { - "composer/installers": true - } - }, - "extra": { - "display-name": "phpBB Browser Push Notifications", - "soft-require": { - "phpbb/phpbb": ">=3.3.12,<4.0.0@dev" - }, - "version-check": { - "host": "www.phpbb.com", - "directory": "/customise/db/extension/webpushnotifications", - "filename": "version_check", - "ssl": true - } - } + } + ], + "require": { + "php": ">=7.3", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "composer/installers": "~1.0", + "minishlink/web-push": "^7.0" + }, + "require-dev": { + "phing/phing": "~2.4" + }, + "suggest": { + "ext-gmp": "Optional but better for performance" + }, + "config": { + "allow-plugins": { + "composer/installers": true + } + }, + "extra": { + "display-name": "phpBB Browser Push Notifications", + "soft-require": { + "phpbb/phpbb": ">=3.3.12,<4.0.0@dev" + }, + "version-check": { + "host": "www.phpbb.com", + "directory": "/customise/db/extension/webpushnotifications", + "filename": "version_check", + "ssl": true + } + } } From 3db97c61af912ddf89699a77c0973198270f35df Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 1 Oct 2026 07:15:48 -0700 Subject: [PATCH 3/3] A little code clean up --- form/form_helper.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/form/form_helper.php b/form/form_helper.php index 594d482..c737d6f 100644 --- a/form/form_helper.php +++ b/form/form_helper.php @@ -52,7 +52,7 @@ public function __construct(config $config, request_interface $request, user $us public function get_form_tokens(string $form_name, ?int &$now = 0, ?string &$token_sid = '', ?string &$token = ''): array { $now = time(); - $token_sid = ($this->user->data['user_id'] == ANONYMOUS && !empty($this->config['form_token_sid_guests'])) ? $this->user->session_id : ''; + $token_sid = ((int) $this->user->data['user_id'] === ANONYMOUS && !empty($this->config['form_token_sid_guests'])) ? $this->user->session_id : ''; $token = sha1($now . $this->user->data['user_form_salt'] . $form_name . $token_sid); return [ @@ -73,7 +73,7 @@ public function check_form_tokens(string $form_name, ?int $timespan = null): boo if ($timespan === null) { // we enforce a minimum value of half a minute here. - $timespan = ($this->config['form_token_lifetime'] == -1) ? -1 : max(30, $this->config['form_token_lifetime']); + $timespan = ((int) $this->config['form_token_lifetime'] === -1) ? -1 : max(30, $this->config['form_token_lifetime']); } if ($this->request->is_set_post('creation_time') && $this->request->is_set_post('form_token')) @@ -83,10 +83,10 @@ public function check_form_tokens(string $form_name, ?int $timespan = null): boo $diff = time() - $creation_time; - // If creation_time and the time() now is zero we can assume it was not a human doing this (the check for if ($diff)... - if (defined('DEBUG_TEST') || $diff && ($diff <= $timespan || $timespan === -1)) + // If creation_time and the time() now is zero we can assume it was not a human doing this (the check for if ($diff)...) + if (defined('DEBUG_TEST') || ($diff && ($diff <= $timespan || $timespan === -1))) { - $token_sid = ($this->user->data['user_id'] == ANONYMOUS && !empty($this->config['form_token_sid_guests'])) ? $this->user->session_id : ''; + $token_sid = ((int) $this->user->data['user_id'] === ANONYMOUS && !empty($this->config['form_token_sid_guests'])) ? $this->user->session_id : ''; $key = sha1($creation_time . $this->user->data['user_form_salt'] . $form_name . $token_sid); if (hash_equals($key, $token))