mirror of
https://github.com/openvk/openvk
synced 2024-11-14 19:19:14 +03:00
AJAX: Fix compatibility with PHP 8.2
This commit is contained in:
parent
d9412b2df8
commit
195cf9807e
9 changed files with 32 additions and 27 deletions
|
@ -48,11 +48,11 @@ class APIToken extends RowModel
|
|||
$this->delete();
|
||||
}
|
||||
|
||||
function save(): void
|
||||
function save(?bool $log = false): void
|
||||
{
|
||||
if(is_null($this->getRecord()))
|
||||
$this->stateChanges("secret", bin2hex(openssl_random_pseudo_bytes(36)));
|
||||
|
||||
parent::save();
|
||||
parent::save($log);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,11 +105,11 @@ class IP extends RowModel
|
|||
$this->stateChanges("ip", $ip);
|
||||
}
|
||||
|
||||
function save(): void
|
||||
function save(?bool $log = false): void
|
||||
{
|
||||
if(is_null($this->getRecord()))
|
||||
$this->stateChanges("first_seen", time());
|
||||
|
||||
parent::save();
|
||||
parent::save($log);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,14 +121,14 @@ abstract class Media extends Postable
|
|||
$this->stateChanges("hash", $hash);
|
||||
}
|
||||
|
||||
function save(): void
|
||||
function save(?bool $log = false): void
|
||||
{
|
||||
if(!is_null($this->processingPlaceholder) && is_null($this->getRecord())) {
|
||||
$this->stateChanges("processed", 0);
|
||||
$this->stateChanges("last_checked", time());
|
||||
}
|
||||
|
||||
parent::save();
|
||||
parent::save($log);
|
||||
}
|
||||
|
||||
function delete(bool $softly = true): void
|
||||
|
|
|
@ -54,11 +54,11 @@ class PasswordReset extends RowModel
|
|||
}
|
||||
}
|
||||
|
||||
function save(): void
|
||||
function save(?bool $log = false): void
|
||||
{
|
||||
$this->stateChanges("key", base64_encode(openssl_random_pseudo_bytes(46)));
|
||||
$this->stateChanges("timestamp", time());
|
||||
|
||||
parent::save();
|
||||
parent::save($log);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,12 +279,12 @@ class Poll extends Attachable
|
|||
return $poll;
|
||||
}
|
||||
|
||||
function save(): void
|
||||
function save(?bool $log = false): void
|
||||
{
|
||||
if(empty($this->choicesToPersist))
|
||||
throw new InvalidStateException;
|
||||
|
||||
parent::save();
|
||||
parent::save($log);
|
||||
foreach($this->choicesToPersist as $option) {
|
||||
DatabaseConnection::i()->getContext()->table("poll_options")->insert([
|
||||
"poll" => $this->getId(),
|
||||
|
|
|
@ -151,7 +151,7 @@ abstract class Postable extends Attachable
|
|||
throw new ISE("Setting virtual id manually is forbidden");
|
||||
}
|
||||
|
||||
function save(): void
|
||||
function save(?bool $log = false): void
|
||||
{
|
||||
$vref = $this->upperNodeReferenceColumnName;
|
||||
|
||||
|
@ -170,7 +170,7 @@ abstract class Postable extends Attachable
|
|||
$this->stateChanges("edited", time());
|
||||
}
|
||||
|
||||
parent::save();
|
||||
parent::save($log);
|
||||
}
|
||||
|
||||
use Traits\TAttachmentHost;
|
||||
|
|
|
@ -197,8 +197,10 @@ abstract class OpenVKPresenter extends SimplePresenter
|
|||
{
|
||||
$user = Authenticator::i()->getUser();
|
||||
|
||||
$this->template->isXmas = intval(date('d')) >= 1 && date('m') == 12 || intval(date('d')) <= 15 && date('m') == 1 ? true : false;
|
||||
$this->template->isTimezoned = Session::i()->get("_timezoneOffset");
|
||||
if(!is_null($this->template)) {
|
||||
$this->template->isXmas = intval(date('d')) >= 1 && date('m') == 12 || intval(date('d')) <= 15 && date('m') == 1 ? true : false;
|
||||
$this->template->isTimezoned = Session::i()->get("_timezoneOffset");
|
||||
}
|
||||
|
||||
$userValidated = 0;
|
||||
$cacheTime = OPENVK_ROOT_CONF["openvk"]["preferences"]["nginxCacheTime"] ?? 0;
|
||||
|
@ -208,8 +210,10 @@ abstract class OpenVKPresenter extends SimplePresenter
|
|||
$this->user->raw = $user;
|
||||
$this->user->identity = (new Users)->getByChandlerUser($user);
|
||||
$this->user->id = $this->user->identity->getId();
|
||||
$this->template->thisUser = $this->user->identity;
|
||||
$this->template->userTainted = $user->isTainted();
|
||||
if(!is_null($this->template)) {
|
||||
$this->template->thisUser = $this->user->identity;
|
||||
$this->template->userTainted = $user->isTainted();
|
||||
}
|
||||
|
||||
if($this->user->identity->isDeleted() && !$this->deactivationTolerant) {
|
||||
if($this->user->identity->isDeactivated()) {
|
||||
|
@ -257,8 +261,9 @@ abstract class OpenVKPresenter extends SimplePresenter
|
|||
$this->user->identity->save();
|
||||
}
|
||||
|
||||
$this->template->ticketAnsweredCount = (new Tickets)->getTicketsCountByUserId($this->user->id, 1);
|
||||
if($user->can("write")->model("openvk\Web\Models\Entities\TicketReply")->whichBelongsTo(0))
|
||||
if(!is_null($this->template))
|
||||
$this->template->ticketAnsweredCount = (new Tickets)->getTicketsCountByUserId($this->user->id, 1);
|
||||
if(!is_null($this->template) && $user->can("write")->model("openvk\Web\Models\Entities\TicketReply")->whichBelongsTo(0))
|
||||
$this->template->helpdeskTicketNotAnsweredCount = (new Tickets)->getTicketCount(0);
|
||||
}
|
||||
|
||||
|
@ -275,8 +280,8 @@ abstract class OpenVKPresenter extends SimplePresenter
|
|||
$this->redirect("/maintenances/");
|
||||
}
|
||||
}
|
||||
|
||||
$this->template->__isAjax= $this->requestParam("al");
|
||||
if(!is_null($this->template))
|
||||
$this->template->__isAjax= $this->requestParam("al");
|
||||
parent::onStartup();
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ final class WallPresenter extends OpenVKPresenter
|
|||
$this->template->paginatorConf = (object) [
|
||||
"count" => $count,
|
||||
"page" => (int) ($_GET["p"] ?? 1),
|
||||
"amount" => sizeof($posts),
|
||||
"amount" => sizeof((array) $posts),
|
||||
"perPage" => $pPage,
|
||||
];
|
||||
foreach($posts as $post)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
style="position: absolute; top: 40%; left: 50%; background: #4C4C4C; padding: 20px 30px; border-radius: 3px; opacity: 0.8;"/>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="__current_url" value="{=$_SERVER[REQUEST_URI]}" />
|
||||
<input type="hidden" id="__current_url" value="{=$_SERVER['REQUEST_URI']}" />
|
||||
<div id="sudo-banner" n:if="isset($thisUser) && $userTainted">
|
||||
<p>
|
||||
Вы вошли как <b>{$thisUser->getCanonicalName()}</b>. Пожалуйста, уважайте
|
||||
|
|
Loading…
Reference in a new issue