mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/17010] Clean up code and remove unused method
PHPBB3-17010
This commit is contained in:
parent
a86d222ab0
commit
adf639e871
1 changed files with 5 additions and 27 deletions
|
@ -113,9 +113,9 @@ class webpush
|
||||||
|
|
||||||
$sql = 'SELECT push_data
|
$sql = 'SELECT push_data
|
||||||
FROM ' . $this->notification_webpush_table . '
|
FROM ' . $this->notification_webpush_table . '
|
||||||
WHERE user_id = ' . $this->user->id() . '
|
WHERE user_id = ' . (int) $this->user->id() . '
|
||||||
AND notification_type_id = ' . $type_id . '
|
AND notification_type_id = ' . (int) $type_id . '
|
||||||
AND item_id = ' . $item_id;
|
AND item_id = ' . (int) $item_id;
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$notification_data = $this->db->sql_fetchfield('push_data');
|
$notification_data = $this->db->sql_fetchfield('push_data');
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
@ -229,8 +229,8 @@ class webpush
|
||||||
$endpoint = $data['endpoint'];
|
$endpoint = $data['endpoint'];
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . $this->push_subscriptions_table . '
|
$sql = 'DELETE FROM ' . $this->push_subscriptions_table . '
|
||||||
WHERE user_id = ' . $this->user->id() . "
|
WHERE user_id = ' . (int) $this->user->id() . "
|
||||||
AND endpoint = '" . $this->db->sql_escape($endpoint) . "'";
|
AND endpoint = '" . (int) $this->db->sql_escape($endpoint) . "'";
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
return new JsonResponse([
|
return new JsonResponse([
|
||||||
|
@ -238,26 +238,4 @@ class webpush
|
||||||
'form_tokens' => $this->form_helper->get_form_tokens(self::FORM_TOKEN_UCP),
|
'form_tokens' => $this->form_helper->get_form_tokens(self::FORM_TOKEN_UCP),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get subscriptions for current user
|
|
||||||
*
|
|
||||||
* @return array Subscriptions for user
|
|
||||||
*/
|
|
||||||
protected function get_subscriptions(): array
|
|
||||||
{
|
|
||||||
$subscriptions = [];
|
|
||||||
|
|
||||||
$sql = 'SELECT endpoint, expiration_time
|
|
||||||
FROM ' . $this->push_subscriptions_table . '
|
|
||||||
WHERE user_id = ' . $this->user->id();
|
|
||||||
$result = $this->db->sql_query($sql);
|
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$subscriptions[] = $row;
|
|
||||||
}
|
|
||||||
$this->db->sql_freeresult($result);
|
|
||||||
|
|
||||||
return $subscriptions;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue