From 2ebeab3f94166bf0605b7b519196489e49ed52d8 Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Sun, 20 Oct 2024 23:13:14 +0300 Subject: [PATCH] results highlight, midnight changes, player insear --- Web/Models/Entities/User.php | 7 +- Web/Models/Repositories/Users.php | 2 +- Web/Presenters/AudioPresenter.php | 24 +++++- Web/Presenters/SearchPresenter.php | 1 + Web/Presenters/templates/Audio/bigplayer.xml | 2 +- Web/Presenters/templates/Search/Index.xml | 81 +++++++++++++------ Web/Presenters/templates/Videos/List.xml | 6 +- .../templates/components/comment.xml | 11 ++- Web/Presenters/templates/components/video.xml | 8 +- Web/static/css/audios.css | 9 ++- Web/static/css/main.css | 11 +++ Web/static/js/openvk.cls.js | 34 ++++++-- locales/ru.strings | 2 +- themepacks/midnight/stylesheet.css | 64 +++++++++------ 14 files changed, 190 insertions(+), 72 deletions(-) diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index b18da92c..18d7fea9 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -1321,10 +1321,15 @@ class User extends RowModel return true; } - function isClosed() + function isClosed(): bool { return (bool) $this->getProfileType(); } + + function isHideFromGlobalFeedEnabled(): bool + { + return $this->isClosed(); + } function getRealId() { diff --git a/Web/Models/Repositories/Users.php b/Web/Models/Repositories/Users.php index e9de0cf8..a2f298b1 100644 --- a/Web/Models/Repositories/Users.php +++ b/Web/Models/Repositories/Users.php @@ -62,7 +62,7 @@ class Users switch($order['type']) { case 'id': case 'reg_date': - $order_str = 'since ' . ($order['invert'] ? 'ASC' : 'DESC'); + $order_str = 'id ' . ($order['invert'] ? 'ASC' : 'DESC'); break; case 'rating': $order_str = 'rating DESC'; diff --git a/Web/Presenters/AudioPresenter.php b/Web/Presenters/AudioPresenter.php index ccf6cf49..e1584366 100644 --- a/Web/Presenters/AudioPresenter.php +++ b/Web/Presenters/AudioPresenter.php @@ -146,7 +146,7 @@ final class AudioPresenter extends OpenVKPresenter $isAjax = $this->postParam("ajax", false) == 1; if(!is_null($this->queryParam("gid")) && !is_null($this->queryParam("playlist"))) { - exit('ты тупой еблан'); + $this->flashFail("err", tr("forbidden"), tr("not_enough_permissions_comment"), null, $isAjax); } if(!is_null($this->queryParam("gid"))) { @@ -689,6 +689,28 @@ final class AudioPresenter extends OpenVKPresenter $audios = $stream->page($page, 10); $audiosCount = $stream->size(); break; + case "classic_search_context": + $data = json_decode($this->postParam("context_entity"), true); + + $params = []; + $order = [ + "type" => $data['order'] ?? 'id', + "invert" => (int)$data['invert'] == 1 ? true : false + ]; + + if($data['genre'] && $data['genre'] != 'any') + $params['genre'] = $data['genre']; + + if($data['only_performers'] && (int)$data['only_performers'] == 1) + $params['only_performers'] = '1'; + + if($data['with_lyrics'] && (int)$data['with_lyrics'] == 1) + $params['with_lyrics'] = '1'; + + $stream = $this->audios->find($data['query'], $params, $order); + $audios = $stream->page($page, 10); + $audiosCount = $stream->size(); + break; } $pagesCount = ceil($audiosCount / $perPage); diff --git a/Web/Presenters/SearchPresenter.php b/Web/Presenters/SearchPresenter.php index 5ffeeb49..bc4b8d8d 100644 --- a/Web/Presenters/SearchPresenter.php +++ b/Web/Presenters/SearchPresenter.php @@ -107,6 +107,7 @@ final class SearchPresenter extends OpenVKPresenter $count = $results->size(); $this->template->order = $order; + $this->template->invert = $invert; $this->template->data = $this->template->iterator = iterator_to_array($iterator); $this->template->count = $count; $this->template->section = $section; diff --git a/Web/Presenters/templates/Audio/bigplayer.xml b/Web/Presenters/templates/Audio/bigplayer.xml index 12d37630..4baa9dbd 100644 --- a/Web/Presenters/templates/Audio/bigplayer.xml +++ b/Web/Presenters/templates/Audio/bigplayer.xml @@ -1,4 +1,4 @@ -
+