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
118 changes: 59 additions & 59 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": "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
}
}
"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
}
}
}
10 changes: 5 additions & 5 deletions form/form_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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'))
Expand All @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions migrations/add_popup_prompt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -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]],
Expand Down
6 changes: 3 additions & 3 deletions migrations/add_user_popup_preference.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -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' => [
Expand All @@ -35,7 +35,7 @@ public function update_schema(): array
];
}

public function revert_schema(): array
public function revert_schema()
{
return [
'drop_columns' => [
Expand Down
2 changes: 1 addition & 1 deletion migrations/fix_acp_module_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion migrations/handle_subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion migrations/setup_site_icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down