diff --git a/Web/Presenters/AboutPresenter.php b/Web/Presenters/AboutPresenter.php index 7952c57f..4c7f916b 100644 --- a/Web/Presenters/AboutPresenter.php +++ b/Web/Presenters/AboutPresenter.php @@ -63,6 +63,7 @@ final class AboutPresenter extends OpenVKPresenter $this->template->languages = getLanguages(); if(!is_null($_GET['lg'])){ + $this->assertNoCSRF(); setLanguage($_GET['lg']); } } diff --git a/Web/Presenters/AuthPresenter.php b/Web/Presenters/AuthPresenter.php index cc34f8d3..4e11f97e 100644 --- a/Web/Presenters/AuthPresenter.php +++ b/Web/Presenters/AuthPresenter.php @@ -182,6 +182,7 @@ final class AuthPresenter extends OpenVKPresenter function renderLogout(): void { $this->assertUserLoggedIn(); + $this->assertNoCSRF(); $this->authenticator->logout(); Session::i()->set("_su", NULL); diff --git a/Web/Presenters/OpenVKPresenter.php b/Web/Presenters/OpenVKPresenter.php index 93675004..3f023385 100755 --- a/Web/Presenters/OpenVKPresenter.php +++ b/Web/Presenters/OpenVKPresenter.php @@ -208,8 +208,8 @@ abstract class OpenVKPresenter extends SimplePresenter } $this->template->ticketAnsweredCount = (new Tickets)->getTicketsCountByuId($this->user->id, 1); - if($user->can("write")->model('openvk\Web\Models\Entities\TicketReply')->whichBelongsTo(0)) - $this->template->helpdeskTicketAnsweredCount = (new Tickets)->getTicketCount(0); + if($user->can("write")->model("openvk\Web\Models\Entities\TicketReply")->whichBelongsTo(0)) + $this->template->helpdeskTicketNotAnsweredCount = (new Tickets)->getTicketCount(0); } setlocale(LC_TIME, ...(explode(";", tr("__locale")))); diff --git a/Web/Presenters/SupportPresenter.php b/Web/Presenters/SupportPresenter.php index ac680ff7..053113c2 100644 --- a/Web/Presenters/SupportPresenter.php +++ b/Web/Presenters/SupportPresenter.php @@ -7,6 +7,7 @@ use openvk\Web\Models\Entities\TicketComment; use openvk\Web\Models\Repositories\TicketComments; // use openvk\Web\Models\Repositories\Users; use openvk\Web\Models\RowModel; +use openvk\Web\Util\Telegram; use Nette\Database\Table\ActiveRow; use Chandler\Database\DatabaseConnection; use Chandler\Session\Session; @@ -52,6 +53,18 @@ final class SupportPresenter extends OpenVKPresenter $ticket->setText($this->postParam("text")); $ticket->setcreated(time()); $ticket->save(); + + $helpdeskChat = OPENVK_ROOT_CONF["openvk"]["credentials"]["telegram"]["helpdeskChat"]; + if($helpdeskChat) { + $serverUrl = ovk_scheme(true) . $_SERVER["SERVER_NAME"]; + $ticketText = ovk_proc_strtr($this->postParam("text"), 1500); + $telegramText = "📬 Новый тикет!\n\n"; + $telegramText .= "{$ticket->getName()}\n"; + $telegramText .= "$ticketText\n\n"; + $telegramText .= "Автор: {$ticket->getUser()->getCanonicalName()} ({$ticket->getUser()->getRegistrationIP()})\n"; + Telegram::send($helpdeskChat, $telegramText); + } + header("HTTP/1.1 302 Found"); header("Location: /support/view/" . $ticket->getId()); } else { diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 2edea129..bef3812f 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -142,7 +142,7 @@ final class UserPresenter extends OpenVKPresenter if ($this->postParam("marialstatus") <= 8 && $this->postParam("marialstatus") >= 0) $user->setMarital_Status($this->postParam("marialstatus")); - if ($this->postParam("politViews") <= 8 && $this->postParam("politViews") >= 0) + if ($this->postParam("politViews") <= 9 && $this->postParam("politViews") >= 0) $user->setPolit_Views($this->postParam("politViews")); if ($this->postParam("gender") <= 1 && $this->postParam("gender") >= 0) diff --git a/Web/Presenters/templates/@layout.xml b/Web/Presenters/templates/@layout.xml index a1cd39aa..ad47f7f4 100644 --- a/Web/Presenters/templates/@layout.xml +++ b/Web/Presenters/templates/@layout.xml @@ -108,7 +108,7 @@