Skip to content

Commit 03ad361

Browse files
authored
Merge pull request #133 from iMattPro/fixes
Fix some bugs
2 parents ce76fd8 + 3dbf41b commit 03ad361

4 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎ext.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected function check_phpbb_version()
7878
*/
7979
protected function check_php_version()
8080
{
81-
if (phpbb_version_compare(PHP_VERSION_ID, '70300', '<'))
81+
if (PHP_VERSION_ID < 70300)
8282
{
8383
$this->errors[] = 'PHP_VERSION_ERROR';
8484
}

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"private": true,
23
"name": "phpbb-web-push-notifications",
34
"author": "phpBB Limited",
45
"license": "GPL-2.0",

‎styles/all/template/ucp_notifications_webpush.html‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<script>
22
phpbbWebpushOptions = {
3-
serviceWorkerUrl: '{{ U_WEBPUSH_WORKER_URL }}',
4-
subscribeUrl: '{{ U_WEBPUSH_SUBSCRIBE }}',
5-
unsubscribeUrl: '{{ U_WEBPUSH_UNSUBSCRIBE }}',
6-
togglePopupUrl: '{{ U_WEBPUSH_TOGGLE_POPUP }}',
3+
serviceWorkerUrl: '{{ U_WEBPUSH_WORKER_URL|e('js') }}',
4+
subscribeUrl: '{{ U_WEBPUSH_SUBSCRIBE|e('js') }}',
5+
unsubscribeUrl: '{{ U_WEBPUSH_UNSUBSCRIBE|e('js') }}',
6+
togglePopupUrl: '{{ U_WEBPUSH_TOGGLE_POPUP|e('js') }}',
77
ajaxErrorTitle: '{{ lang_js('AJAX_ERROR_TITLE') }}',
8-
vapidPublicKey: '{{ VAPID_PUBLIC_KEY }}',
8+
vapidPublicKey: '{{ VAPID_PUBLIC_KEY|e('js') }}',
99
formTokens: {
10-
creationTime: '{{ WEBPUSH_FORM_TOKENS.creation_time }}',
11-
formToken: '{{ WEBPUSH_FORM_TOKENS.form_token }}',
10+
creationTime: {{ WEBPUSH_FORM_TOKENS.creation_time|int }},
11+
formToken: '{{ WEBPUSH_FORM_TOKENS.form_token|e('js') }}',
1212
},
1313
subscriptions: [
1414
{% for sub in SUBSCRIPTIONS %}
15-
{endpoint: '{{ sub.endpoint }}', expiration: '{{ sub.expiration }}' },
15+
{endpoint: '{{ sub.endpoint|e('js') }}', expirationTime: {{ sub.expirationTime|int }} },
1616
{% endfor %}
1717
],
18-
}
18+
};
1919
</script>
2020

2121
{% INCLUDEJS '@phpbb_webpushnotifications/webpush.js' %}

‎ucp/controller/webpush.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private function get_anonymous_notifications(): string
222222
$user_lang = $row['user_lang'];
223223

224224
$expected_push_token = hash('sha256', $user_form_token . $push_token);
225-
if ($expected_push_token === $token)
225+
if (hash_equals($expected_push_token, $token))
226226
{
227227
if ($user_lang !== $this->language->get_used_language())
228228
{

0 commit comments

Comments
 (0)