Some php 8.2 fixes

Fix privacy settings, friends pagination and возможно fix messages. Resolves #1007 and resolves #1006
This commit is contained in:
lalka2018 2023-10-29 13:05:47 +03:00
parent 3f1c9cd5ff
commit f492353ae8
3 changed files with 4 additions and 4 deletions

View file

@ -131,7 +131,7 @@ class Correspondence
*/
function getPreviewMessage(): ?Message
{
$messages = $this->getMessages(1, NULL, 1);
$messages = $this->getMessages(1, NULL, 1, 0);
return $messages[0] ?? NULL;
}

View file

@ -128,7 +128,7 @@ final class MessengerPresenter extends OpenVKPresenter
$messages = [];
$correspondence = new Correspondence($this->user->identity, $correspondent);
foreach($correspondence->getMessages(1, $lastMsg === 0 ? NULL : $lastMsg) as $message)
foreach($correspondence->getMessages(1, $lastMsg === 0 ? NULL : $lastMsg, NULL, 0) as $message)
$messages[] = $message->simplify();
header("Content-Type: application/json");

View file

@ -55,7 +55,7 @@ final class UserPresenter extends OpenVKPresenter
$this->assertUserLoggedIn();
$user = $this->users->get($id);
$page = abs($this->queryParam("p") ?? 1);
$page = abs((int)($this->queryParam("p") ?? 1));
if(!$user)
$this->notFound();
elseif (!$user->getPrivacyPermission('friends.read', $this->user->identity ?? NULL))
@ -433,7 +433,7 @@ final class UserPresenter extends OpenVKPresenter
];
foreach($settings as $setting) {
$input = $this->postParam(str_replace(".", "_", $setting));
$user->setPrivacySetting($setting, min(3, abs($input ?? $user->getPrivacySetting($setting))));
$user->setPrivacySetting($setting, min(3, (int)abs((int)$input ?? $user->getPrivacySetting($setting))));
}
} else if($_GET['act'] === "finance.top-up") {
$token = $this->postParam("key0") . $this->postParam("key1") . $this->postParam("key2") . $this->postParam("key3");