From c5d6c86a9dee33f857e533e64a7a528965c71ac5 Mon Sep 17 00:00:00 2001 From: n1rwana <93197434+n1rwana@users.noreply.github.com> Date: Thu, 25 Aug 2022 16:23:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B1=D0=BB=D0=BE=D0=BA=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20/=20=D0=9F=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Web/Models/Entities/BugReport.php | 3 ++- Web/Presenters/BugtrackerPresenter.php | 19 +++++++++++++++++-- Web/static/js/openvk.cls.js | 20 ++++++++++++++------ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Web/Models/Entities/BugReport.php b/Web/Models/Entities/BugReport.php index 563b9baa..5d1606a7 100644 --- a/Web/Models/Entities/BugReport.php +++ b/Web/Models/Entities/BugReport.php @@ -50,7 +50,8 @@ class BugReport extends RowModel tr("bug_tracker_status_closed"), tr("bug_tracker_status_requires_adjustment"), tr("bug_tracker_status_locked"), - tr("bug_tracker_status_rejected") + tr("bug_tracker_status_rejected"), + "Переоткрыт" ]; $status_id = $this->getRecord()->status; diff --git a/Web/Presenters/BugtrackerPresenter.php b/Web/Presenters/BugtrackerPresenter.php index 3dd105a9..d8eb86e4 100644 --- a/Web/Presenters/BugtrackerPresenter.php +++ b/Web/Presenters/BugtrackerPresenter.php @@ -85,6 +85,7 @@ final class BugtrackerPresenter extends OpenVKPresenter function renderChangeStatus(int $report_id): void { $this->assertUserLoggedIn(); + $this->assertNoCSRF(); $this->willExecuteWriteAction(); if ($this->user->identity->isBannedInBt()) @@ -101,7 +102,8 @@ final class BugtrackerPresenter extends OpenVKPresenter tr("bug_tracker_status_closed"), tr("bug_tracker_status_requires_adjustment"), tr("bug_tracker_status_locked"), - tr("bug_tracker_status_rejected") + tr("bug_tracker_status_rejected"), + "Переоткрыт" ]; $report = (new BugtrackerReports)->get($report_id); @@ -119,6 +121,7 @@ final class BugtrackerPresenter extends OpenVKPresenter function renderChangePriority(int $report_id): void { $this->assertUserLoggedIn(); + $this->assertNoCSRF(); $this->willExecuteWriteAction(); if ($this->user->identity->isBannedInBt()) @@ -204,7 +207,7 @@ final class BugtrackerPresenter extends OpenVKPresenter $product = $this->postParam("product"); $device = $this->postParam("device"); - if (!$title || !$text || !$priority || !$product || !$device) + if (!$title || !$text || !$product || !$device || $priority === NULL) $this->flashFail("err", tr("error"), tr("bug_tracker_fields_error")); $id = DB::i()->getContext()->table("bugs")->insert([ @@ -223,6 +226,7 @@ final class BugtrackerPresenter extends OpenVKPresenter function renderCreateProduct(): void { $this->assertUserLoggedIn(); + $this->assertNoCSRF(); $this->willExecuteWriteAction(); if ($this->user->identity->isBannedInBt()) @@ -269,6 +273,7 @@ final class BugtrackerPresenter extends OpenVKPresenter function renderManageAccess(int $product_id): void { $this->assertUserLoggedIn(); + $this->assertNoCSRF(); $this->willExecuteWriteAction(); if ($this->user->identity->isBannedInBt()) @@ -312,6 +317,7 @@ final class BugtrackerPresenter extends OpenVKPresenter function renderManagePrivacy(int $product_id): void { $this->assertUserLoggedIn(); + $this->assertNoCSRF(); $this->willExecuteWriteAction(); if ($this->user->identity->isBannedInBt()) @@ -344,6 +350,7 @@ final class BugtrackerPresenter extends OpenVKPresenter function renderManageStatus(int $product_id): void { $this->assertUserLoggedIn(); + $this->assertNoCSRF(); $this->willExecuteWriteAction(); if ($this->user->identity->isBannedInBt()) @@ -376,6 +383,7 @@ final class BugtrackerPresenter extends OpenVKPresenter function renderKickTester(int $uid): void { $this->assertUserLoggedIn(); + $this->assertNoCSRF(); $this->willExecuteWriteAction(); if ($this->user->identity->isBannedInBt()) @@ -391,12 +399,16 @@ final class BugtrackerPresenter extends OpenVKPresenter $user->setBlock_in_bt_reason($comment); $user->save(); + if ($this->postParam("ban_reports")) + DB::i()->getConnection()->query("UPDATE bugs SET status = 6 WHERE reporter = " . $uid); + $this->flashFail("succ", "Успех", $user->getCanonicalName() . " был исключён из программы OVK Testers."); } function renderUnbanTester(int $uid): void { $this->assertUserLoggedIn(); + $this->assertNoCSRF(); $this->willExecuteWriteAction(); if ($this->user->identity->isBannedInBt()) @@ -410,6 +422,9 @@ final class BugtrackerPresenter extends OpenVKPresenter $user->setBlock_in_bt_reason(NULL); $user->save(); + if ($this->postParam("unban_reports")) + DB::i()->getConnection()->query("UPDATE bugs SET status = 8 WHERE reporter = " . $uid); + $this->flashFail("succ", "Успех", $user->getCanonicalName() . " был разблокирован в баг-трекере."); } } \ No newline at end of file diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js index 4e232add..8d3b3b42 100755 --- a/Web/static/js/openvk.cls.js +++ b/Web/static/js/openvk.cls.js @@ -458,23 +458,27 @@ function showBtStatusChangeDialog(report, currentBalance, hash) {