From 4b95283a5543ca9d566b49a50b7f95c7bfbc0052 Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Mon, 30 Dec 2024 15:56:06 +0300 Subject: [PATCH] things --- Web/Models/Repositories/Documents.php | 4 +- Web/Presenters/CommentPresenter.php | 2 +- Web/Presenters/WallPresenter.php | 2 +- Web/Presenters/templates/Documents/List.xml | 2 +- .../templates/Documents/components/image.xml | 2 +- .../templates/components/attachment.xml | 18 ++- .../templates/components/textArea.xml | 4 + Web/Presenters/templates/components/wall.xml | 2 +- Web/static/css/main.css | 19 ++- Web/static/js/al_docs.js | 110 ++++++++++++++++++ Web/static/js/al_wall.js | 4 + locales/en.strings | 72 ++++++++++++ 12 files changed, 226 insertions(+), 15 deletions(-) diff --git a/Web/Models/Repositories/Documents.php b/Web/Models/Repositories/Documents.php index b102c30f..b6c51bf0 100644 --- a/Web/Models/Repositories/Documents.php +++ b/Web/Models/Repositories/Documents.php @@ -27,7 +27,7 @@ class Documents } # By "Virtual ID" and "Absolute ID" (to not leak owner's id). - function getDocumentById(int $virtual_id, int $real_id, ?string $access_key = NULL): ?Document + function getDocumentById(int $virtual_id, int $real_id, string $access_key = NULL): ?Document { $doc = $this->documents->where(['virtual_id' => $virtual_id, 'id' => $real_id]); /*if($access_key) { @@ -74,7 +74,7 @@ class Documents function getTypes(int $owner_id): array { - $result = DatabaseConnection::i()->getConnection()->query("SELECT `type`, COUNT(*) AS `count` FROM `documents` WHERE `owner` = $owner_id AND `deleted` = 0 AND `unlisted` = 0 GROUP BY `type` ORDER BY `type`"); + $result = DatabaseConnection::i()->getConnection()->query("SELECT `type`, COUNT(*) AS `count` FROM `documents` WHERE `owner` = ? AND `deleted` = 0 AND `unlisted` = 0 GROUP BY `type` ORDER BY `type`", $owner_id); $response = []; foreach($result as $res) { if($res->count < 1 || $res->type == 0) continue; diff --git a/Web/Presenters/CommentPresenter.php b/Web/Presenters/CommentPresenter.php index 7ab74ac0..76279ad6 100644 --- a/Web/Presenters/CommentPresenter.php +++ b/Web/Presenters/CommentPresenter.php @@ -88,7 +88,7 @@ final class CommentPresenter extends OpenVKPresenter if(!empty($this->postParam("vertical_attachments"))) { $vertical_attachments_array = array_slice(explode(",", $this->postParam("vertical_attachments")), 0, OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["maxAttachments"]); if(sizeof($vertical_attachments_array) > 0) { - $vertical_attachments = parseAttachments($vertical_attachments_array, ['audio', 'note']); + $vertical_attachments = parseAttachments($vertical_attachments_array, ['audio', 'note', 'doc']); } } diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index 12067ad0..3a7605bb 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -294,7 +294,7 @@ final class WallPresenter extends OpenVKPresenter if(!empty($this->postParam("vertical_attachments"))) { $vertical_attachments_array = array_slice(explode(",", $this->postParam("vertical_attachments")), 0, OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["maxAttachments"]); if(sizeof($vertical_attachments_array) > 0) { - $vertical_attachments = parseAttachments($vertical_attachments_array, ['audio', 'note']); + $vertical_attachments = parseAttachments($vertical_attachments_array, ['audio', 'note', 'doc']); } } diff --git a/Web/Presenters/templates/Documents/List.xml b/Web/Presenters/templates/Documents/List.xml index 61613c50..10f23944 100644 --- a/Web/Presenters/templates/Documents/List.xml +++ b/Web/Presenters/templates/Documents/List.xml @@ -27,7 +27,7 @@ getId()}"{/if}> -