diff --git a/.idea/.gitignore b/.idea/.gitignore index 13566b81..ecca0076 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -5,4 +5,4 @@ /httpRequests/ # Datasource local storage ignored files /dataSources/ -/dataSources.local.xml +/dataSources.local.xml \ No newline at end of file diff --git a/.idea/intellij-latte/xmlSources/Latte.dtd b/.idea/intellij-latte/xmlSources/Latte.dtd index 0cf3a95a..9b8273f5 100644 --- a/.idea/intellij-latte/xmlSources/Latte.dtd +++ b/.idea/intellij-latte/xmlSources/Latte.dtd @@ -1,11 +1,8 @@ - - - @@ -13,34 +10,26 @@ - - - - + - - - + - - - - + - - + + \ No newline at end of file diff --git a/.idea/intellij-latte/xmlSources/Latte.xml b/.idea/intellij-latte/xmlSources/Latte.xml index 0bfceaf8..e7bb3f7a 100644 --- a/.idea/intellij-latte/xmlSources/Latte.xml +++ b/.idea/intellij-latte/xmlSources/Latte.xml @@ -1,290 +1,290 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - - - - + + + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 639900d1..f4364fd5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - - - + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index de1f1bbf..af99c76e 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -1,8 +1,8 @@ - - - - - + + + + + \ No newline at end of file diff --git a/.idea/openvk.iml b/.idea/openvk.iml index fe58bea6..16097db5 100644 --- a/.idea/openvk.iml +++ b/.idea/openvk.iml @@ -1,46 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml index 7b4f97fd..28cf2b65 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -1,48 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml index 797acea5..7b45e612 100644 --- a/.idea/runConfigurations.xml +++ b/.idea/runConfigurations.xml @@ -1,10 +1,10 @@ - - - + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 35eb1ddf..9db25eef 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - - - + + + \ No newline at end of file diff --git a/VKAPI/Handlers/Friends.php b/VKAPI/Handlers/Friends.php index ca9b7573..20c537a5 100644 --- a/VKAPI/Handlers/Friends.php +++ b/VKAPI/Handlers/Friends.php @@ -133,15 +133,18 @@ final class Friends extends VKAPIRequestHandler return $response; } - function getRequests(string $fields = "", int $offset = 0, int $count = 100): object + function getRequests(string $fields = "", int $offset = 0, int $count = 100, int $extended = 0): object { + if ($count >= 1000) + $this->fail(100, "One of the required parameters was not passed or is invalid."); + $this->requireUser(); $i = 0; $offset++; $followers = []; - foreach($this->getUser()->getFollowers() as $follower) { + foreach($this->getUser()->getFollowers($offset, $count) as $follower) { $followers[$i] = $follower->getId(); $i++; } @@ -149,8 +152,10 @@ final class Friends extends VKAPIRequestHandler $response = $followers; $usersApi = new Users($this->getUser()); - if(!is_null($fields)) - $response = $usersApi->get(implode(',', $followers), $fields, 0, $count); # FIXME + if($extended == 1) + $response = $usersApi->get(implode(',', $followers), $fields, 0, $count); + else + $response = $usersApi->get(implode(',', $followers), "", 0, $count); foreach($response as $user) $user->user_id = $user->id; diff --git a/Web/Events/NewMessageEvent.php b/Web/Events/NewMessageEvent.php index 49d102b3..3b828e90 100644 --- a/Web/Events/NewMessageEvent.php +++ b/Web/Events/NewMessageEvent.php @@ -27,14 +27,23 @@ class NewMessageEvent implements ILPEmitable if($peer === $userId) $peer = $msg->getRecipient()->getId(); + /* + * Source: + * https://github.com/danyadev/longpoll-doc + */ + return [ 4, # event type + $msg->getId(), # messageId 256, # checked for spam flag $peer, # TODO calculate peer correctly $msg->getSendTime()->timestamp(), # creation time in unix $msg->getText(), # text (formatted) + [], # empty additional info [], # empty attachments $msg->getId() << 2, # id as random_id + $peer, # conversation id + 0 # not edited yet ]; } } diff --git a/Web/Models/Entities/Alias.php b/Web/Models/Entities/Alias.php new file mode 100644 index 00000000..99f7baae --- /dev/null +++ b/Web/Models/Entities/Alias.php @@ -0,0 +1,34 @@ +getRecord()->owner_id; + } + + function getType(): string + { + if ($this->getOwnerId() < 0) + return "club"; + + return "user"; + } + + function getUser(): ?User + { + return (new Users)->get($this->getOwnerId()); + } + + function getClub(): ?Club + { + return (new Clubs)->get($this->getOwnerId() * -1); + } +} diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index 115bf8c2..f1045f62 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -908,6 +908,10 @@ class User extends RowModel $pClub = DatabaseConnection::i()->getContext()->table("groups")->where("shortcode", $code)->fetch(); if(!is_null($pClub)) return false; + + $pAlias = DatabaseConnection::i()->getContext()->table("aliases")->where("shortcode", $code)->fetch(); + if(!is_null($pAlias)) + return false; } $this->stateChanges("shortcode", $code); diff --git a/Web/Models/Repositories/Aliases.php b/Web/Models/Repositories/Aliases.php new file mode 100644 index 00000000..e74532a1 --- /dev/null +++ b/Web/Models/Repositories/Aliases.php @@ -0,0 +1,35 @@ +context = DB::i()->getContext(); + $this->aliases = $this->context->table("aliases"); + } + + private function toAlias(?ActiveRow $ar): ?Alias + { + return is_null($ar) ? NULL : new Alias($ar); + } + + function get(int $id): ?Alias + { + return $this->toAlias($this->aliases->get($id)); + } + + function getByShortcode(string $shortcode): ?Alias + { + return $this->toAlias($this->aliases->where("shortcode", $shortcode)->fetch()); + } +} diff --git a/Web/Models/Repositories/Clubs.php b/Web/Models/Repositories/Clubs.php index b7b59251..edbe75c6 100644 --- a/Web/Models/Repositories/Clubs.php +++ b/Web/Models/Repositories/Clubs.php @@ -1,6 +1,7 @@ toClub($this->clubs->where("shortcode", $url)->fetch()); + $shortcode = $this->toClub($this->clubs->where("shortcode", $url)->fetch()); + + if ($shortcode) + return $shortcode; + + $alias = (new Aliases)->getByShortcode($url); + + if (!$alias) return NULL; + if ($alias->getType() !== "club") return NULL; + + return $alias->getClub(); } function get(int $id): ?Club @@ -45,6 +56,9 @@ class Clubs function getPopularClubs(): \Traversable { + // TODO rewrite + + /* $query = "SELECT ROW_NUMBER() OVER (ORDER BY `subscriptions` DESC) as `place`, `target` as `id`, COUNT(`follower`) as `subscriptions` FROM `subscriptions` WHERE `model` = \"openvk\\\Web\\\Models\\\Entities\\\Club\" GROUP BY `target` ORDER BY `subscriptions` DESC, `id` LIMIT 30;"; $entries = DatabaseConnection::i()->getConnection()->query($query); @@ -54,6 +68,7 @@ class Clubs "club" => $this->get($entry["id"]), "subscriptions" => $entry["subscriptions"], ]; + */ } use \Nette\SmartObject; diff --git a/Web/Models/Repositories/Users.php b/Web/Models/Repositories/Users.php index 9cd7d001..63e77df0 100644 --- a/Web/Models/Repositories/Users.php +++ b/Web/Models/Repositories/Users.php @@ -1,6 +1,7 @@ context = DatabaseConnection::i()->getContext(); $this->users = $this->context->table("profiles"); + $this->aliases = $this->context->table("aliases"); } private function toUser(?ActiveRow $ar): ?User @@ -28,7 +31,17 @@ class Users function getByShortURL(string $url): ?User { - return $this->toUser($this->users->where("shortcode", $url)->fetch()); + $shortcode = $this->toUser($this->users->where("shortcode", $url)->fetch()); + + if ($shortcode) + return $shortcode; + + $alias = (new Aliases)->getByShortcode($url); + + if (!$alias) return NULL; + if ($alias->getType() !== "user") return NULL; + + return $alias->getUser(); } function getByChandlerUser(ChandlerUser $user): ?User diff --git a/Web/Presenters/AboutPresenter.php b/Web/Presenters/AboutPresenter.php index 6a281d07..dd503aff 100644 --- a/Web/Presenters/AboutPresenter.php +++ b/Web/Presenters/AboutPresenter.php @@ -64,7 +64,7 @@ final class AboutPresenter extends OpenVKPresenter $this->template->usersStats = (new Users)->getStatistics(); $this->template->clubsCount = (new Clubs)->getCount(); $this->template->postsCount = (new Posts)->getCount(); - $this->template->popularClubs = iterator_to_array((new Clubs)->getPopularClubs()); + $this->template->popularClubs = []; $this->template->admins = iterator_to_array((new Users)->getInstanceAdmins()); } diff --git a/Web/Presenters/AppsPresenter.php b/Web/Presenters/AppsPresenter.php index 02fb8922..8dcfb8a4 100644 --- a/Web/Presenters/AppsPresenter.php +++ b/Web/Presenters/AppsPresenter.php @@ -6,7 +6,7 @@ use openvk\Web\Models\Repositories\Applications; final class AppsPresenter extends OpenVKPresenter { private $apps; - + protected $presenterName = "apps"; function __construct(Applications $apps) { $this->apps = $apps; diff --git a/Web/Presenters/AuthPresenter.php b/Web/Presenters/AuthPresenter.php index f934f7fe..bb9d7272 100644 --- a/Web/Presenters/AuthPresenter.php +++ b/Web/Presenters/AuthPresenter.php @@ -84,6 +84,9 @@ final class AuthPresenter extends OpenVKPresenter if (strtotime($this->postParam("birthday")) > time()) $this->flashFail("err", tr("invalid_birth_date"), tr("invalid_birth_date_comment")); + if (!$this->postParam("confirmation")) + $this->flashFail("err", tr("error"), tr("checkbox_in_registration_unchecked")); + try { $user = new User; $user->setFirst_Name($this->postParam("first_name")); diff --git a/Web/Presenters/CommentPresenter.php b/Web/Presenters/CommentPresenter.php index cbdac84e..0429b32e 100644 --- a/Web/Presenters/CommentPresenter.php +++ b/Web/Presenters/CommentPresenter.php @@ -6,6 +6,7 @@ use openvk\Web\Models\Repositories\{Comments, Clubs}; final class CommentPresenter extends OpenVKPresenter { + protected $presenterName = "comment"; private $models = [ "posts" => "openvk\\Web\\Models\\Repositories\\Posts", "photos" => "openvk\\Web\\Models\\Repositories\\Photos", diff --git a/Web/Presenters/GiftsPresenter.php b/Web/Presenters/GiftsPresenter.php index b99e5ba9..8f59bdcb 100644 --- a/Web/Presenters/GiftsPresenter.php +++ b/Web/Presenters/GiftsPresenter.php @@ -7,6 +7,7 @@ final class GiftsPresenter extends OpenVKPresenter { private $gifts; private $users; + protected $presenterName = "gifts"; function __construct(Gifts $gifts, Users $users) { diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php index a83386db..00d74c2e 100644 --- a/Web/Presenters/GroupPresenter.php +++ b/Web/Presenters/GroupPresenter.php @@ -8,7 +8,8 @@ use Chandler\Security\Authenticator; final class GroupPresenter extends OpenVKPresenter { private $clubs; - + protected $presenterName = "group"; + function __construct(Clubs $clubs) { $this->clubs = $clubs; diff --git a/Web/Presenters/MaintenancePresenter.php b/Web/Presenters/MaintenancePresenter.php new file mode 100644 index 00000000..d4a5a6ef --- /dev/null +++ b/Web/Presenters/MaintenancePresenter.php @@ -0,0 +1,35 @@ +flashFail("err", tr("error"), tr("forbidden")); + + $this->template->name = [ + "photos" => tr("my_photos"), + "videos" => tr("my_videos"), + "messenger" => tr("my_messages"), + "user" => tr("users"), + "group" => tr("my_groups"), + "comment" => tr("comments"), + "gifts" => tr("gifts"), + "apps" => tr("apps"), + "notes" => tr("my_notes"), + "notification" => tr("my_feedback"), + "support" => tr("menu_support"), + "topics" => tr("topics") + ][$name] ?? $name; + } + + function renderAll(): void + { + + } +} diff --git a/Web/Presenters/MessengerPresenter.php b/Web/Presenters/MessengerPresenter.php index cea440ba..46094c43 100644 --- a/Web/Presenters/MessengerPresenter.php +++ b/Web/Presenters/MessengerPresenter.php @@ -9,11 +9,13 @@ final class MessengerPresenter extends OpenVKPresenter { private $messages; private $signaler; - + protected $presenterName = "messenger"; + function __construct(Messages $messages) { $this->messages = $messages; $this->signaler = SignalManager::i(); + parent::__construct(); } @@ -30,7 +32,7 @@ final class MessengerPresenter extends OpenVKPresenter function renderIndex(): void { $this->assertUserLoggedIn(); - + if(isset($_GET["sel"])) $this->pass("openvk!Messenger->app", $_GET["sel"]); @@ -93,6 +95,13 @@ final class MessengerPresenter extends OpenVKPresenter } $legacy = $this->queryParam("version") < 3; + + $time = intval($this->queryParam("wait")); + + if($time > 60) + $time = 60; + elseif($time == 0) + $time = 25; // default $this->signaler->listen(function($event, $eId) use ($id) { exit(json_encode([ @@ -101,7 +110,7 @@ final class MessengerPresenter extends OpenVKPresenter $event->getVKAPISummary($id), ], ])); - }, $id); + }, $id, $time); } function renderApiGetMessages(int $sel, int $lastMsg): void diff --git a/Web/Presenters/NotesPresenter.php b/Web/Presenters/NotesPresenter.php index 363d814c..50437ad7 100644 --- a/Web/Presenters/NotesPresenter.php +++ b/Web/Presenters/NotesPresenter.php @@ -6,7 +6,8 @@ use openvk\Web\Models\Entities\Note; final class NotesPresenter extends OpenVKPresenter { private $notes; - + protected $presenterName = "notes"; + function __construct(Notes $notes) { $this->notes = $notes; diff --git a/Web/Presenters/NotificationPresenter.php b/Web/Presenters/NotificationPresenter.php index d12f27f0..3bd7a321 100644 --- a/Web/Presenters/NotificationPresenter.php +++ b/Web/Presenters/NotificationPresenter.php @@ -3,6 +3,8 @@ namespace openvk\Web\Presenters; final class NotificationPresenter extends OpenVKPresenter { + protected $presenterName = "notification"; + function renderFeed(): void { $this->assertUserLoggedIn(); diff --git a/Web/Presenters/OpenVKPresenter.php b/Web/Presenters/OpenVKPresenter.php index 2a19fa03..5b7908a8 100755 --- a/Web/Presenters/OpenVKPresenter.php +++ b/Web/Presenters/OpenVKPresenter.php @@ -17,7 +17,8 @@ abstract class OpenVKPresenter extends SimplePresenter protected $deactivationTolerant = false; protected $errorTemplate = "@error"; protected $user = NULL; - + protected $presenterName; + private function calculateQueryString(array $data): string { $rawUrl = "tcp+stratum://fakeurl.net$_SERVER[REQUEST_URI]"; #HTTP_HOST can be tainted @@ -196,12 +197,13 @@ abstract class OpenVKPresenter extends SimplePresenter function onStartup(): void { $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"); - + $userValidated = 0; $cacheTime = OPENVK_ROOT_CONF["openvk"]["preferences"]["nginxCacheTime"] ?? 0; + if(!is_null($user)) { $this->user = (object) []; $this->user->raw = $user; @@ -226,7 +228,7 @@ abstract class OpenVKPresenter extends SimplePresenter } exit; } - + if($this->user->identity->isBanned() && !$this->banTolerant) { header("HTTP/1.1 403 Forbidden"); $this->getTemplatingEngine()->render(__DIR__ . "/templates/@banned.xml", [ @@ -247,23 +249,33 @@ abstract class OpenVKPresenter extends SimplePresenter ]); exit; } - + $userValidated = 1; $cacheTime = 0; # Force no cache if($this->user->identity->onlineStatus() == 0 && !($this->user->identity->isDeleted() || $this->user->identity->isBanned())) { $this->user->identity->setOnline(time()); $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)) $this->template->helpdeskTicketNotAnsweredCount = (new Tickets)->getTicketCount(0); } - + header("X-OpenVK-User-Validated: $userValidated"); header("X-Accel-Expires: $cacheTime"); setlocale(LC_TIME, ...(explode(";", tr("__locale")))); - + + if (!OPENVK_ROOT_CONF["openvk"]["preferences"]["maintenanceMode"]["all"]) { + if (OPENVK_ROOT_CONF["openvk"]["preferences"]["maintenanceMode"][$this->presenterName]) { + $this->pass("openvk!Maintenance->section", $this->presenterName); + } + } else { + if ($this->presenterName != "maintenance") { + $this->redirect("/maintenances/"); + } + } + parent::onStartup(); } diff --git a/Web/Presenters/PhotosPresenter.php b/Web/Presenters/PhotosPresenter.php index eacf76d4..3dd2a774 100644 --- a/Web/Presenters/PhotosPresenter.php +++ b/Web/Presenters/PhotosPresenter.php @@ -9,7 +9,8 @@ final class PhotosPresenter extends OpenVKPresenter private $users; private $photos; private $albums; - + protected $presenterName = "photos"; + function __construct(Photos $photos, Albums $albums, Users $users) { $this->users = $users; diff --git a/Web/Presenters/SupportPresenter.php b/Web/Presenters/SupportPresenter.php index 22f09201..8f4fd7d3 100644 --- a/Web/Presenters/SupportPresenter.php +++ b/Web/Presenters/SupportPresenter.php @@ -11,6 +11,7 @@ final class SupportPresenter extends OpenVKPresenter { protected $banTolerant = true; protected $deactivationTolerant = true; + protected $presenterName = "support"; private $tickets; private $comments; @@ -155,11 +156,12 @@ final class SupportPresenter extends OpenVKPresenter $this->notFound(); } else { if($ticket->getUserId() !== $this->user->id && $this->hasPermission('openvk\Web\Models\Entities\TicketReply', 'write', 0)) - $this->redirect("/support/tickets"); + $_redirect = "/support/tickets"; else - $this->redirect("/support"); + $_redirect = "/support?act=list"; $ticket->delete(); + $this->redirect($_redirect); } } } diff --git a/Web/Presenters/TopicsPresenter.php b/Web/Presenters/TopicsPresenter.php index 6dd1ec6c..528b51ad 100644 --- a/Web/Presenters/TopicsPresenter.php +++ b/Web/Presenters/TopicsPresenter.php @@ -7,7 +7,8 @@ final class TopicsPresenter extends OpenVKPresenter { private $topics; private $clubs; - + protected $presenterName = "topics"; + function __construct(Topics $topics, Clubs $clubs) { $this->topics = $topics; diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index bfda79e8..48ebb660 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -15,12 +15,13 @@ use Nette\Database\UniqueConstraintViolationException; final class UserPresenter extends OpenVKPresenter { private $users; - public $deactivationTolerant = false; + protected $presenterName = "user"; + function __construct(Users $users) { $this->users = $users; - + parent::__construct(); } diff --git a/Web/Presenters/VideosPresenter.php b/Web/Presenters/VideosPresenter.php index e7b24344..6db7771d 100644 --- a/Web/Presenters/VideosPresenter.php +++ b/Web/Presenters/VideosPresenter.php @@ -8,7 +8,8 @@ final class VideosPresenter extends OpenVKPresenter { private $videos; private $users; - + protected $presenterName = "videos"; + function __construct(Videos $videos, Users $users) { $this->videos = $videos; diff --git a/Web/Presenters/templates/Auth/Register.xml b/Web/Presenters/templates/Auth/Register.xml index 23f40aa1..16532cb1 100644 --- a/Web/Presenters/templates/Auth/Register.xml +++ b/Web/Presenters/templates/Auth/Register.xml @@ -87,12 +87,15 @@ {captcha_template()|noescape} + - + + {_checkbox_in_registration|noescape} +

{_log_in} diff --git a/Web/Presenters/templates/Maintenance/All.xml b/Web/Presenters/templates/Maintenance/All.xml new file mode 100644 index 00000000..e8f88e2c --- /dev/null +++ b/Web/Presenters/templates/Maintenance/All.xml @@ -0,0 +1,20 @@ +{extends "../@layout.xml"} + +{block title} + {_global_maintenance} +{/block} + +{block header} + {_global_maintenance} +{/block} + +{block content} +
+
+ + + {_undergoing_global_maintenance} + +
+
+{/block} diff --git a/Web/Presenters/templates/Maintenance/Section.xml b/Web/Presenters/templates/Maintenance/Section.xml new file mode 100644 index 00000000..9bdb0965 --- /dev/null +++ b/Web/Presenters/templates/Maintenance/Section.xml @@ -0,0 +1,20 @@ +{extends "../@layout.xml"} + +{block title} + {_section_maintenance} +{/block} + +{block header} + {_section_maintenance} +{/block} + +{block content} +
+
+ + + {tr("undergoing_section_maintenance", $name)|noescape} + +
+
+{/block} diff --git a/Web/Presenters/templates/User/Friends.xml b/Web/Presenters/templates/User/Friends.xml index d85fbd56..ed140cf1 100644 --- a/Web/Presenters/templates/User/Friends.xml +++ b/Web/Presenters/templates/User/Friends.xml @@ -53,7 +53,7 @@
{_online}
-
+
{_req}
{/block} diff --git a/Web/Presenters/templates/User/Groups.xml b/Web/Presenters/templates/User/Groups.xml index 18c2e9d8..cc32b3d0 100644 --- a/Web/Presenters/templates/User/Groups.xml +++ b/Web/Presenters/templates/User/Groups.xml @@ -79,9 +79,9 @@ {/block} {block actions} + {_check_community} {if $x->canBeModifiedBy($thisUser ?? NULL)} {var $clubPinned = $thisUser->isClubPinned($x)} - {_check_community} {if $clubPinned} {_remove_from_left_menu} @@ -89,21 +89,21 @@ {_add_to_left_menu} {/if} - {if $x->getSubscriptionStatus($thisUser) == false} - - {else} - - {/if} + {/if} + {if $x->getSubscriptionStatus($thisUser) == false} + + {else} + {/if} {/block} diff --git a/Web/di.yml b/Web/di.yml index ac18fc31..ba4ea463 100644 --- a/Web/di.yml +++ b/Web/di.yml @@ -44,4 +44,6 @@ services: - openvk\Web\Models\Repositories\Applications - openvk\Web\Models\Repositories\ContentSearchRepository - openvk\Web\Models\Repositories\PostsChanges + - openvk\Web\Models\Repositories\Aliases - openvk\Web\Models\Repositories\BannedLinks + - openvk\Web\Presenters\MaintenancePresenter diff --git a/Web/routes.yml b/Web/routes.yml index 6be8011b..eee1d637 100644 --- a/Web/routes.yml +++ b/Web/routes.yml @@ -337,3 +337,7 @@ routes: handler: "UnknownTextRouteStrategy->delegate" placeholders: shortCode: "[a-z][a-z0-9\\@\\.\\_]{0,30}[a-z0-9]" + - url: "/maintenance/{text}" + handler: "Maintenance->section" + - url: "/maintenances/" + handler: "Maintenance->all" diff --git a/install/sqls/00031-banned-urls.sql b/install/sqls/00032-banned-urls.sql similarity index 64% rename from install/sqls/00031-banned-urls.sql rename to install/sqls/00032-banned-urls.sql index c208eb37..0df7b275 100644 --- a/install/sqls/00031-banned-urls.sql +++ b/install/sqls/00032-banned-urls.sql @@ -1,14 +1,13 @@ CREATE TABLE `links_banned` ( `id` bigint UNSIGNED NOT NULL, - `domain` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, - `regexp_rule` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, - `reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci, + `domain` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `regexp_rule` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci, `initiator` bigint UNSIGNED NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; ALTER TABLE `links_banned` ADD PRIMARY KEY (`id`); ALTER TABLE `links_banned` MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT; -COMMIT; \ No newline at end of file diff --git a/install/sqls/00033-shortcode-aliases.sql b/install/sqls/00033-shortcode-aliases.sql new file mode 100644 index 00000000..d47975c0 --- /dev/null +++ b/install/sqls/00033-shortcode-aliases.sql @@ -0,0 +1,11 @@ +CREATE TABLE `aliases` ( + `id` bigint UNSIGNED NOT NULL, + `owner_id` bigint NOT NULL, + `shortcode` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + +ALTER TABLE `aliases` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `aliases` + MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT; diff --git a/locales/en.strings b/locales/en.strings index 2e3461b7..240dd5d0 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -1147,3 +1147,12 @@ "url_is_banned_default_reason" = "The link you are trying to open may lead you to a site that was created for the purpose of deceiving users with the intention of gaining profit."; "url_is_banned_title" = "Link to a suspicious site"; "url_is_banned_proceed" = "Follow the link"; + +/* Maintenance */ + +"global_maintenance" = "Undergoing maintenance"; +"section_maintenance" = "The section is not available"; +"undergoing_global_maintenance" = "Unfortunately, the instance is now closed for technical work. We are already working on troubleshooting. Please try to come back later."; +"undergoing_section_maintenance" = "Unfortunately, the $1 section is temporarily unavailable. We are already working on troubleshooting. Please try to come back later."; + +"topics" = "Topics"; diff --git a/locales/list.yml b/locales/list.yml index e072c152..b6ff0a44 100644 --- a/locales/list.yml +++ b/locales/list.yml @@ -13,7 +13,7 @@ list: flag: "ua" name: "Ukrainian" native_name: "Україньска" - author: "Andrej Lenťaj, Maxim Hrabovi (dechioyo) and Kirill (mbsoft)" + author: "Yaroslav Bjelograd, Andrej Lenťaj, Maxim Hrabovi (dechioyo) and Kirill (mbsoft)" - code: "by" flag: "by" name: "Belarussian" diff --git a/locales/ru.strings b/locales/ru.strings index abdee6ff..6a7b8f46 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -15,6 +15,8 @@ "password" = "Пароль"; "registration" = "Регистрация"; "forgot_password" = "Забыли пароль?"; +"checkbox_in_registration" = "Я согласен с политикой конфиденциальности и правилами сайта"; +"checkbox_in_registration_unchecked" = "Вы должны согласиться с политикой конфиденциальности и правилами, чтобы зарегистрироваться."; "login_failed" = "Не удалось войти"; "invalid_username_or_password" = "Неверное имя пользователя или пароль. Забыли пароль?"; @@ -990,7 +992,7 @@ "changes_saved_comment" = "Новые данные появятся на вашей странице"; "photo_saved" = "Фотография сохранена"; -"photo_saved_comment" = "Новое изображние профиля появится у вас на странице"; +"photo_saved_comment" = "Новое изображение профиля появится у вас на странице"; "shared_succ" = "Запись появится на вашей стене. Нажмите на уведомление, чтобы перейти к своей стене."; @@ -1206,3 +1208,12 @@ "url_is_banned_default_reason" = "Ссылка, по которой вы попытались перейти, может вести на сайт, который был создан с целью обмана пользователей и получения за счёт этого прибыли."; "url_is_banned_title" = "Ссылка на подозрительный сайт"; "url_is_banned_proceed" = "Перейти по ссылке"; + +/* Maintenance */ + +"global_maintenance" = "Технические работы"; +"section_maintenance" = "Раздел недоступен"; +"undergoing_global_maintenance" = "К сожалению, сейчас инстанс закрыт на технические работы. Мы уже работаем над устранением неисправностей. Пожалуйста, попробуйте зайти позже."; +"undergoing_section_maintenance" = "К сожалению, раздел $1 временно недоступен. Мы уже работаем над устранением неисправностей. Пожалуйста, попробуйте зайти позже."; + +"topics" = "Темы"; diff --git a/locales/ua.strings b/locales/ua.strings index ef701a0b..fdeca0bc 100644 --- a/locales/ua.strings +++ b/locales/ua.strings @@ -15,6 +15,8 @@ "password" = "Пароль"; "registration" = "Реєстрація"; "forgot_password" = "Забули пароль?"; +"checkbox_in_registration" = "Я згоден з політикою конфіденційності і правилами сайту"; +"checkbox_in_registration_unchecked" = "Ви повинні погодитися з політикою конфіденційності та правилами, щоб зареєструватися."; "login_failed" = "Не вдалося увійти"; "invalid_username_or_password" = "Неправильне ім'я користувача або пароль. Забули пароль?"; @@ -210,6 +212,7 @@ /* Friends */ +"friends" = "Друзі"; "followers" = "Підписники"; "follower" = "Підписник"; "friends_add" = "Додати в друзі"; @@ -218,10 +221,11 @@ "friends_accept" = "Прийняти заявку"; "send_message" = "Відправити повідомлення"; "incoming_req" = "Підписники"; +"outcoming_req" = "Вихідні"; +"req" = "Заявки"; "outcoming_req" = "Заявки"; "friends_online" = "Друзі онлайн"; "all_friends" = "Усі друзі"; -"req" = "Заявки"; "req_zero" = "Не знайдено жодної заявки..."; "req_one" = "Знайдена $1 заявка"; @@ -235,18 +239,18 @@ "friends_many" = "$1 друзів"; "friends_other" = "$1 друзів"; -"friends_list_zero" = "У вас поки немає друзів"; -"friends_list_one" = "У Вас $1 друг"; -"friends_list_few" = "У Вас $1 друг"; -"friends_many" = "$1 друзів"; -"friends_other" = "$1 друзів"; - "friends_online_zero" = "Жодного друга онлайн"; "friends_online_one" = "$1 друг онлайн"; "friends_online_few" = "$1 друга онлайн"; "friends_online_many" = "$1 друзів онлайн"; "friends_online_other" = "$1 друзів онлайн"; +"friends_list_zero" = "У вас поки немає друзів"; +"friends_list_one" = "У Вас $1 друг"; +"friends_list_few" = "У Вас $1 друг"; +"friends_many" = "$1 друзів"; +"friends_other" = "$1 друзів"; + "followers_zero" = "Жодного підписника"; "followers_one" = "$1 підписник"; "followers_few" = "$1 підписника"; @@ -1122,6 +1126,17 @@ "admin_commerce_disabled" = "Комерція відключена системним адміністратором"; "admin_commerce_disabled_desc" = "Налаштування ваучерів та подарунків будуть збережені, але не матимуть впливу."; +"admin_banned_links" = "Заблоковані посилання"; +"admin_banned_link" = "Посилання"; +"admin_banned_domain" = "Домен"; +"admin_banned_link_description" = "З протоколом (https://example.org/)"; +"admin_banned_link_regexp" = "Регулярний вираз"; +"admin_banned_link_regexp_description" = "Підставляється після домену, зазначеного вище. Не заповнюйте, якщо хочете заблокувати весь домен"; +"admin_banned_link_reason" = "Причина"; +"admin_banned_link_initiator" = "Ініціатор"; +"admin_banned_link_not_specified" = "Посилання не зазначено"; +"admin_banned_link_not_found" = "Посилання не знайдено"; + /* Paginator (deprecated) */ "paginator_back" = "Назад"; @@ -1185,3 +1200,12 @@ "cookies_popup_content" = "Цей веб-сайт використовує cookies для того, щоб ідентифікувати вашу сесію і нічого більше. Ознайомтеся з нашою політикою конфіденційності для отримання додаткової інформації."; "cookies_popup_agree" = "Згоден"; + +/* Away */ + +"url_is_banned" = "Перехід неможливий"; +"url_is_banned_comment" = "Адміністрація $1 не рекомендує переходити за цим посиланням."; +"url_is_banned_comment_r" = "Адміністрація $1 не рекомендує переходити за цим посиланням.

Підстава: $2"; +"url_is_banned_default_reason" = "Посилання, за яким Ви спробували перейти, може вести на сайт, що був створений з метою обману користувачів і отримання шляхом цього неправомірного прибутку."; +"url_is_banned_title" = "Посилання на підозрілий сайт"; +"url_is_banned_proceed" = "Перейти за посиланням"; diff --git a/openvk-example.yml b/openvk-example.yml index f9f1254d..71d887bf 100644 --- a/openvk-example.yml +++ b/openvk-example.yml @@ -59,6 +59,20 @@ openvk: susLinks: warnings: true showReason: true + maintenanceMode: + all: false + photos: false + videos: false + messenger: false + user: false + group: false + comment: false + gifts: false + apps: false + notes: false + notification: false + support: false + topics: false ton: enabled: false address: "🅿"